Bar colour related to ATR

Forums ProRealTime English forum ProBuilder support Bar colour related to ATR

Viewing 11 posts - 1 through 11 (of 11 total)
  • #159845

    I am looking for the code to change the colour of the bar to purple when the close is greater than the ATR * 1,5 . The colour change also applicable on bars of historic charts

    Any suggestions are appreciated.

    #159852

    CLOSE is a price, ATR is a price range (difference in price).

    CLOSE will always be > ATR.

     

    #159856

    Thanks a lot for your quick reply.

    Actually what I should have written:

    When (high – low) > (ATR * 1,5) colour of bar to  change to purple.

    Thanks.

    #159865

    There you go:

    add it to the price chart (not below).

    Choose colours at http://cloford.com/resources/colours/500col.htm.

     

     

    1 user thanked author for this post.
    #159871

    Fantastic, much appreciated,

    #159998

    I realise now that due to the change of the colour of the bar, I am not able to see whether it is a bullish or a bearish bar.
    Would it be possible to add a marker above the bar in the event of a bullish bar or a marker below the bar in the event of a bearish bar.

    Thanks a lot in advance.

    Coen

    #160002

    There you go:

    if bullish “*” will be plotted above the candle, below otherwise.

     

    1 user thanked author for this post.
    #160020

    Thanks a lot, works great!

    #175001

    Hi Rob,

    Could you please check the below code, its similar to the above mentioned one but more detailed.

    AGBAR1 = AverageTrueRange[14](close) * 0.75

    AGBAR2 = AverageTrueRange[14](close) * 1

    AGBAR3 = AverageTrueRange[14](close) * 1.5

    IF Range > AGBAR1 AND close > open THEN

    DrawCandle(Open,High,Low,Close) coloured(0,255,0,255)

    IF Range > AGBAR2 AND close > open THEN

    DrawCandle(Open,High,Low,Close) coloured(0,205,0,255)

    IF Range > AGBAR3 AND close > open THEN

    DrawCandle(Open,High,Low,Close) coloured(0,139,0,255)

    ENDIF

    ELSIF Range > AGBAR1 AND close < open THEN

    DrawCandle(Open,High,Low,Close) coloured(255,193,193,255)

    ELSIF Range > AGBAR2 AND close < open THEN

    DrawCandle(Open,High,Low,Close) coloured(255,48,48,255)

    ELSIF Range > AGBAR3 AND close < open THEN

    DrawCandle(Open,High,Low,Close) coloured(139,26,26,255)

    ELSE DrawCandle(Open,High,Low,Close) coloured(234,234,234,255)

    ENDIF

    RETURN

    #175004

    How can it work for you?

    There are two errors:

    • after ELSE there cannot be anything, so the DRAWCANDLE has to start on a new line
    • the final ENDIF (just before RETURN) is missing.

     

    #175008

    It’s working now, thanks mate

Viewing 11 posts - 1 through 11 (of 11 total)

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