TradingView
RicardoSantos
2021년 10월 12일 오전 9시 57분

FunctionLinearRegression 

Bitcoin / U.S. dollarBitstamp

설명

Library "FunctionLinearRegression"
Method for Linear Regression using array sample points.

linreg(sample_x, sample_y) Performs Linear Regression over the provided sample points.
  Parameters:
    sample_x: float array, sample points X value.
    sample_y: float array, sample points Y value.
  Returns: tuple with:
_predictions: Array with adjusted Y values.
_max_dev: Max deviation from the mean.
_min_dev: Min deviation from the mean.
_stdev/_sizeX: Average deviation from the mean.

draw(sample_x, sample_y, extend, mid_color, mid_style, mid_width, std_color, std_style, std_width, max_color, max_style, max_width) Method for drawing the Linear Regression into chart.
  Parameters:
    sample_x: float array, sample point X value.
    sample_y: float array, sample point Y value.
    extend: string, default=extend.none, extend lines.
    mid_color: color, default=color.blue, middle line color.
    mid_style: string, default=line.style_solid, middle line style.
    mid_width: int, default=2, middle line width.
    std_color: color, default=color.aqua, standard deviation line color.
    std_style: string, default=line.style_dashed, standard deviation line style.
    std_width: int, default=1, standard deviation line width.
    max_color: color, default=color.purple, max range line color.
    max_style: string, default=line.style_dotted, max line style.
    max_width: int, default=1, max line width.
  Returns: line array.
코멘트
PineCoders
m_b_round
Legend, thanks.
bula1
A noob question but still taking a shot at this one... How can I make turn the rsi values into a float array to be compatible with the function? Been scratching my head at this for hours, thought it'd be more efficient to ask you.
PineCoders
This publication is now featured in our Editors' Picks: tradingview.com/scripts/editors-picks/?script_type=libraries
In the name of all TradingViewers, thank you for your valuable contribution to the community, and congrats!
irtrader_425798
Thanks you so much
It's amazing
Pratik_4Clover
Thank you ^^
BorC
how to use the Pine library version5
RicardoSantos
@BorC, in your script add the following line:
import RicardoSantos/FunctionLinearRegression/1 as linear linear.draw(array.from(bar_index, bar_index+10, bar_index+20), array.from(open, open*1.1, open*0.9))

as easy as that :)
BorC
@RicardoSantos, thank a lot
irtrader_425798
@RicardoSantos, it was useful
더보기