Does anyone have a suggestion on how to code the highest high or lowest low since crossing an MA and marking that bar on the screen? Thanks!
Not tested:
Once MyHigh = 0
Once MyLow = 0
CrossOver = close crosses over average[200,0](close)
CrossUnder = close crosses under average[200,0](close)
If CrossOver or CrossUnder Then
MyHigh = high
MyLow = low
drawtext("●",barindex,high+15*pipsize,Dialog,Bold,10) coloured(255,0,0,255)
Endif
MyHigh = max(MyHigh,high)
MyLow = min(MyLow,low)
Return MyHigh as “HI”,MyLow as “LO”
Many thanks for the code and it works somewhat. What I am trying to do is plot something above the highest high between two crossings. For example, we cross above an MA, stay above for a while, then cross below. I am trying to mark the highest high in that time interval.
Make an example, possibly attaching a screenshot of what you want to see.
I hope this make sense. Thanks for the help.
(not tested):
Once MyHigh = 0
Once MyLow = 0
CrossOver = close crosses over average[200,0](close)
CrossUnder = close crosses under average[200,0](close)
If CrossOver or CrossUnder Then
MyHigh = high
MyLow = low
Endif
MyHigh = max(MyHigh,high)
MyLow = min(MyLow,low)
IF MyHigh <> MyHigh[1] THEN
DrawArrowDown(BarIndex,high + 10 * pipsize) coloured(0,128,0,255)
ENDIF
IF MyLow <> MyLow[1] THEN
DrawArrowUP(BarIndex,high + 10 * pipsize) coloured(255,0,0,255)
ENDIF
Return
Many thanks. It has put me on the right track.
Do you need text on crossings, as well?
No that is ok. It seems ProRealTime just does the processing on the last bar so as the bars develop it leaves the arrows behind it. It would be good if the previous arrows could be erased. Currently I am writing over them with white.
There you go:
Defparam DrawOnLastBarOnly = true
Once MyHigh = 0
Once MyLow = 0
CrossOver = close crosses over average[200,0](close)
CrossUnder = close crosses under average[200,0](close)
If CrossOver or CrossUnder Then
MyHigh = high
MyLow = low
Endif
MyHigh = max(MyHigh,high)
MyLow = min(MyLow,low)
IF MyHigh <> MyHigh[1] THEN
HiBar = BarIndex
ENDIF
IF MyLow <> MyLow[1] THEN
LoBar = BarIndex
ENDIF
DrawArrowDown(HiBar,MyHigh + 10 * pipsize) coloured(0,128,0,255)
DrawArrowUP(LoBar,MyLow - 10 * pipsize) coloured(255,0,0,255)
Return