get_linear_regression(bar_index_array, prices_array, stdDev_mult) : Generates the linear regression channel for an array of values. Parameters: bar_index_array (array<int>): (array<int>): Array with bar indexes prices_array (array<float>): (array<float>): Array with prices stdDev_mult (float): (float): Standard deviation multiple for the channels Returns: : Returns x1, x2, y1_mid, y2_mid, y1_up, y2_up, y1_dn, y2_dn, m, b, R2, stdDev
get_optimal_linearRegression_channel(max_length, min_length, source, stdDev_mult) : Gets the best fitting linear regression using optimum length Parameters: max_length (int): (int): Maximum bar length min_length (int): (int): Minimum bar length source (float): (float): Source for the regression stdDev_mult (float): (float): Array with prices Returns: : Returns three line objects
get_cuadratic_Regression(x_array, y_array, bars_to_project) : Gets the best fitting linear regression using optimum length Parameters: x_array (array<int>): (array<int>): Maximum bar length y_array (array<float>): (array<float>): Minimum bar length bars_to_project (int): (int): Array with prices Returns: : Returns three line objects
Release Notes
v2
Added: get_cuadratic_regression(x_array, y_array, bars_to_project) : Gets the best fitting linear regression using optimum length Parameters: x_array (array<float>): (array<int>): Maximum bar length y_array (array<float>): (array<float>): Minimum bar length bars_to_project (int): (int): Array with prices Returns: : Returns three line objects
Removed: get_cuadratic_Regression(x_array, y_array, bars_to_project) : Gets the best fitting linear regression using optimum length
Release Notes
v3
Release Notes
v4
Release Notes
v5
Updated: get_optimal_linearRegression_channel(max_length, min_length, source, stdDev_mult, show_data_table, tableYpos, tableXpos, table_textSize) : Gets the best fitting linear regression using optimum length Parameters: max_length (int): (int): Maximum bar length min_length (int): (int): Minimum bar length source (float): (float): Source for the regression stdDev_mult (float): (float): Array with prices show_data_table (bool): (bool): Activates and shows the data table tableYpos (string) tableXpos (string) table_textSize (string) Returns: : Returns three line objects
Release Notes
v6
Updated: get_optimal_linearRegression_channel(max_length, min_length, source, stdDev_mult, show_data_table, tableYpos, tableXpos, table_textSize) : Gets the best fitting linear regression using optimum length Parameters: max_length (int): (int): Maximum bar length min_length (int): (int): Minimum bar length source (float): (float): Source for the regression stdDev_mult (float): (float): Array with prices show_data_table (bool): (bool): Activates and shows the data table tableYpos (string) tableXpos (string) table_textSize (string) Returns: : Returns three line objects for the channel, plus the optimal length and maximum r2
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in a publication is governed by House rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.