Help with fixiing code

Forums ProRealTime English forum ProBuilder support Help with fixiing code

  • This topic has 3 replies, 2 voices, and was last updated 4 days ago by avatarIván.
Viewing 4 posts - 1 through 4 (of 4 total)
  • #245068

    Can someone help me with the problem showing on the following code? line 6 between period and close I dont have any knowlege regarding coding and have created this code using chatGTP. Many thanks.

     

    // Set the period for calculation
    period = 50

    // Calculate linear regression line
    slope = LinearRegressionSlope[period](close)
    intercept = LinearRegressionIntercept[period](close)
    regression_line = intercept + slope * BarIndex

    // Calculate standard error
    sum_squared_errors = 0
    for i = 0 to period – 1 do
    predicted = intercept + slope * (BarIndex – i)
    sum_squared_errors = sum_squared_errors + (close[i] – predicted)^2
    next
    std_error = sqrt(sum_squared_errors / period)

    // Upper and lower channel lines
    upper_channel = regression_line + std_error
    lower_channel = regression_line – std_error

    // Plot the lines
    RETURN regression_line AS “Regression Line”, upper_channel AS “Upper Channel”, lower_channel AS “Lower Channel”

    #245069

    Thanks, how can I access this?

     

    #245070

    // Set the period for calculation
    period = 50

    // Calculate linear regression line
    slope = LinearRegressionSlope[period](close)
    intercept = LinearRegressionIntercept[period](close)
    regression_line = intercept + slope * BarIndex

    // Calculate standard error
    sum_squared_errors = 0
    for i = 0 to period – 1 do
    predicted = intercept + slope * (BarIndex – i)
    sum_squared_errors = sum_squared_errors + (close[i] – predicted)^2
    next
    std_error = sqrt(sum_squared_errors / period)

    // Upper and lower channel lines
    upper_channel = regression_line + std_error
    lower_channel = regression_line – std_error

    // Plot the lines
    RETURN regression_line AS “Regression Line”, upper_channel AS “Upper Channel”, lower_channel AS “Lower Channel”

    #245079

    hi! here you have the code. Be careful with “_”.

     

    2 users thanked author for this post.
Viewing 4 posts - 1 through 4 (of 4 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login