Modification to the (ARLS) Anderson Regression Line Stretch

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #68507 quote
    rowestock
    Participant
    New

    Hi Nicolas,

    I am revisiting this indicator to modify and improve it.

    Is it possible to replace style(histogram) with style(candle) in the code?

    I would like to see extremes and the wicks/shadows of candles as the histogram can’t show me that and thus the ARLS indicator applies to the close of the bar only.

    My code and screenshot is below. Hope this is possible!

    // Define variables
    a=LinearRegression[30](close)
    b=Close
    
    // Calculation of difference between the 30 period regression line and the last price expressed as a percentage of the current price
    c=(b-a)/b*100
    if c>0 then
    r=0
    b=255
    else
    r=255
    b=0
    endif
    //deviationP=1000
    dev=std[deviationP](c)
    
    return c coloured(r,0,b) style(histogram) as "ARLS", 0 as "Zero", 0+3*dev style(dottedline,2) as "plus 3 dev", 0+2*dev coloured(255,0,0) style(line,3) as "plus 2 dev", 0-3*dev style(dottedline,2) as "minus 3 dev", 0-2*dev coloured(255,0,0) style(line,3)  as "minus 2 dev"
    
    #68573 quote
    Nicolas
    Keymaster
    Master

    That should do the trick:

    // Define variables
    a=LinearRegression[30](close)
    b=Close
    ao=LinearRegression[30](open)
    bo=open
    ah=LinearRegression[30](high)
    bh=high
    al=LinearRegression[30](low)
    bl=low
    
    // Calculation of difference between the 30 period regression line and the last price expressed as a percentage of the current price
    c=(b-a)/b*100
    
    deviationP=1000
    dev=std[deviationP](c)
    
    oopen = (bo-ao)/bo*100
    hhigh = (bh-ah)/bh*100
    llow = (bl-al)/bl*100
    
    if c>oopen then
    r=0
    b=255
    else
    r=255
    b=0
    endif
    
    drawcandle(oopen,hhigh,llow,c) coloured(r,0,b)
    
    return 0 as "Zero", 0+3*dev style(dottedline,2) as "plus 3 dev", 0+2*dev coloured(255,0,0) style(line,3) as "plus 2 dev", 0-3*dev style(dottedline,2) as "minus 3 dev", 0-2*dev coloured(255,0,0) style(line,3)  as "minus 2 dev" //c coloured(r,0,b) style(histogram) as "ARLS",
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Modification to the (ARLS) Anderson Regression Line Stretch


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
rowestock @rowestock Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
7 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/16/2018
Status: Active
Attachments: 2 files
Logo Logo
Loading...