Hi all! May I ask someone to kindly code me an indicator that shows a horizontal line from the previous daily candle high and low. I’ve seen various codes for highs and lows of daily timeframes but I’m after a horizontal line from the previous daily candle itself (not the timeframe) to the current day
I’ve been looking through the forum to find what I thought must be a request or feature by someone but…nope!
Can someone help with this for me please?
I’ve attached a screenshot of what I’m trying to describe.
There you go:
DEFPARAM DrawOnLastBarOnly = true
Timeframe(Daily,UpdateOnClose)
lowD = low
highD = high
//
timeframe(default)
ONCE StartBAR = BarIndex
IF (lowD <> lowD[1]) OR (highD <> highD[1]) THEN
StartBAR = BarIndex
ENDIF
DrawSegment(StartBAR,highD,BarIndex + 1,highD) coloured("Cyan") style(line,4)
DrawSegment(StartBAR,lowD, BarIndex + 1,lowD) coloured("Cyan") style(line,4)
RETURN
There you go:
Press CTRL+C to Copy, CTRL+V to Paste
1
2
3
4
5
6
7
8
9
10
11
12
13
|
DEFPARAM DrawOnLastBarOnly = true
Timeframe(Daily,UpdateOnClose)
lowD = low
highD = high
//
timeframe(default)
ONCE StartBAR = BarIndex
IF (lowD <> lowD[1]) OR (highD <> highD[1]) THEN
StartBAR= BarIndex
ENDIF
DrawSegment(StartBAR,highD,BarIndex + 1,highD) coloured(“Cyan”) style(line,4)
DrawSegment(StartBAR,lowD, BarIndex + 1,lowD) coloured(“Cyan”) style(line,4)
RETURN
|
Bless you, thanks Roberto, I’ve applied it but its showing the current high and low, not the previous candle. Can you adjust it for me please?
Replace lines 3-4 by:
lowD = low[1]
highD = high[1]
You are appreciated! Thank you!
Replace lines 3-4 by:
|
|
lowD = low[1]
highD = high[1]
|
I guess you can tell I’m not good with coding. This is much appreciated. Enjoy your weekend. Thank you!
My lines weren’t prepositioned at low and close so Just to let any one else interested in this code know, I replaced the 1’s with 0’s. The original code is just as useful for lower timeframes and reading price but you can essentially do the same thing with the final code. Thanks so much once again.