Bar colour related to ATR
Forums › ProRealTime English forum › ProBuilder support › Bar colour related to ATR
- This topic has 10 replies, 4 voices, and was last updated 3 years ago by efahmy.
-
-
01/29/2021 at 4:02 PM #15984501/29/2021 at 4:52 PM #159852
CLOSE is a price, ATR is a price range (difference in price).
CLOSE will always be > ATR.
01/29/2021 at 5:02 PM #15985601/29/2021 at 6:13 PM #159865There you go:
12345MyAtr = AverageTrueRange[14](close) * 1.5IF Range > MyATR THENDrawCandle(Open,High,Low,Close) coloured(180,82,205,255)ENDIFRETURNadd it to the price chart (not below).
Choose colours at http://cloford.com/resources/colours/500col.htm.
1 user thanked author for this post.
01/29/2021 at 7:00 PM #15987101/31/2021 at 5:31 PM #159998I 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
01/31/2021 at 7:24 PM #160002There you go:
12345678910MyAtr = AverageTrueRange[14](close) * 1.5IF Range > MyATR THENDrawCandle(Open,High,Low,Close) coloured(180,82,205,255)If close > open thenDrawText(“*”,barindex,high + range)ElseDrawText(“*”,barindex,low - range)EndifENDIFRETURNif bullish “*” will be plotted above the candle, below otherwise.
1 user thanked author for this post.
02/01/2021 at 9:43 AM #16002008/10/2021 at 10:58 AM #175001Hi 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
08/10/2021 at 11:18 AM #175004How 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.
08/10/2021 at 11:30 AM #175008 -
AuthorPosts
Find exclusive trading pro-tools on