Hi,
I need to plot a horizontal line (on every timeframe’s chart) showing the Daily High and Low for the last trading day (of course it has some meaning only on lower timeframes than the Daily).
Thanks a lot for your assistance,
Gil.
I moved your topic to the english forum, instead of the french one.
Not tested, but it could be something like this:
defparam drawonlastbaronly=true
if intradaybarindex=0 then
first=barindex
endif
drawsegment(first,dlow(1),barindex,dlow(1))
drawsegment(first,dhigh(1),barindex,dhigh(1))
return
Nicolas, it works everyday but on monday, since on monday it refers to weekend data.
I arranged this code to account for mondays, unless someone WANTS to refer to we data, in that case your code is fine (or my code won’t need the OpenDayOfWeek test).
DEFPARAM DrawOnLastBarOnly = True
IF OpenDayOfWeek = 1 THEN //one more day to look back on Monday
PastBars = 2
ELSE
PastBars = 1
ENDIF
IF IntraDayBarIndex = 0 THEN
x = Dhigh(PastBars)
y = Dlow(PastBars)
ENDIF
DRAWHLINE(x) coloured(0,255,0,255)
DRAWHLINE(y) coloured(255,0,0,255)
RETURN
Many thanks Roberto and Nicolas, I appreciate it !