Hello!
With the great help from this forum I have the indicator below on my charts. Thanks!
But I realise I need some modification which I am struggling with. What I want is that the line of the previous high and low should be drawn (one single horisantal line not connected with the other days) on each day, not just the current day. Keeping in mind that the day in the intraday chart should be defined as midnight to midnight according to the set timezone.
Anyone could help me with this?
Thank you!
DEFPARAM DrawOnLastBarOnly = True
ONCE NYtime = 000000
ONCE CurO = open
ONCE CurH = high
ONCE PrevH = high
ONCE CurL = low
ONCE PrevL = low
ONCE CurHw = high
ONCE CurLw = low
ONCE PrevHw = high
ONCE PrevLw = low
ONCE OdW = 0
IF OpenDayOfWeek < OpenDayOfWeek[1] THEN
OdW = 1
ENDIF
IF (OpenTime = NYtime) OR ((OpenTime > NYtime) AND (OpenTime[1] < NyTime)) THEN
IF OdW = 1 THEN
PrevHw= CurHw
PrevLw= CurLw
CurHw = high
CurLw = low
OdW = 0
ENDIF
CurO = open
PrevH = CurH
PrevL = CurL
CurH = high
CurL = low
Start = BarIndex
ENDIF
CurH = max(high,CurH)
CurL = min(low,CurL)
CurHw = max(high,CurHw)
CurLw = min(low,CurLw)
DrawSegment(Start,CurO,BarIndex,CurO) coloured("Black") style(Line,2)
DrawSegment(start,PrevH,BarIndex,PrevH) coloured("red") style(Line,2)
DrawSegment(start,PrevL,Barindex,PrevL) coloured("red") style(Line,2)
RETURN PrevH coloured("Blue") style(Line,2) AS "Previous DAY high",PrevL coloured("Red") Style(Line,2) AS "Previous DAY low",PrevHw coloured("Gold") style(Line,2) AS "Previous WEEK high",PrevLw coloured("Fuchsia") Style(Line,2) AS "Previous WEEK low"
JSParticipant
Senior
Hi Tom,
When I use your indicator, the “previous high” and “previous low” are already drawn every day… (or do I not understand your question?)
JSParticipant
Senior
By the way, a very good and effective indicator…
Yes, sorry for the confusion. It does that, my mistake with setting it up.
But is it possible to get rid of the connecting lines between the different days? I only want the horisontal lines.
JSParticipant
Senior
Hi Tom,
In its current form, that is not possible…
Otherwise, you have to calculate the whole indicator differently using arrays…
Hi, I used this trick with some indicator sometime ago and it worked:
if opentime >=235900 and opentime <= 000100 then //if we work in the 1min TF
alpha = 0
else
alpha = 255
endif
.....
return prevh coloured (0,0,255,alpha) //repeat with the rest of the lines
As you see the trick is just zero the alpha (intensity of the color ) between the last and first candles of the day (235900 and 000100 in the 1 min TF) to hide the ugly vertical lines.
below snippet is simple and works on all TF’s 😉
alpha= 255
if opentime =000000 then
alpha = 0
endif
.....
return prevh coloured ("blue",alpha) //repeat with the rest of the lines