//Average value of Highest Close and Lowest Close
ONCE HighestClose = Close[0]
ONCE HighestMirrorClose = MirrorClose[0]
// Calulate the highest close value
IF Close >= Close[1] THEN
IF Close >= HighestClose THEN
HighestClose = Close
ENDIF
ENDIF
// Calculate the difference between the highest close value and close
DifHighestClose = HighestClose - Close
// Mirror this difference in the highest close value
MirrorClose = HighestClose + DifHighestClose
// Calculate the highest mirror close value
IF MirrorClose >= MirrorClose[1] THEN
IF MirrorClose >= HighestMirrorClose THEN
HighestMirrorClose = MirrorClose
ENDIF
ENDIF
// Mirror or rotate the highest mirror close value in/with the highest close value
LowestClose = HighestClose - (HighestMirrorClose - HighestClose )
// Average of highest close and lowest close
MidHighestLowest = (HighestClose + LowestClose) / 2
DRAWTEXT("O", barindex, close)coloured(0,0,0)
IF Close[0] >= MidHighestLowest THEN
r=0
g=0
b=255
ELSE
r=255
g=0
b=0
ENDIF
RETURN Close coloured(r,g,b), MidHighestLowest
Thank you Sever, that visually interesting. I moved your post into the forum to discuss about, could you explain a bit how do you calculate that middle line and how you are using it? It seems to be the middle line of highest/lowest Close but for the whole data available on the chart?
Yes Nicolas, it is the middle line of the highest close and lowest close for the whole data on the chart.
You can use it as buy or sell border, gives also a good long term impression of the price range .
It is most interessant if a price is moving in a range, so you have a good view of the market fluctuations.
If you want you can adapt the code by setting a percentage above or beneath the middle line as buy or stop limit.