Hello,
I would like to have an indicator that shows me the high / low / close / of the previous day and that shows me the premarket high / low from 4:00 to 9:30 EST. NY
With horizontal lines.
Thanks for your help
This thread should help to get you going – does not include premarket window. you will have to adjust the times for your region.
Plot Yesterday’s High, Low and Close
There you go:
DEFPARAM DrawOnLastBarOnly = true
ONCE PrevHH = high
ONCE PrevLL = low
ONCE PrecCL = close
ONCE HH = high
ONCE LL = low
ONCE CL = close
ONCE pmHH = high
ONCE pmLL = low
If OpenTime = 000000 OR (OpenTime >= 000000 AND OpenTime < OpenTime[1])THEN
PrevHH = HH
PrevLL = LL
PrevCL = close[1]
LL = low
HH = high
CL = close
BarID = BarIndex
ENDIF
If OpenTime = 040000 OR (OpenTime >= 040000 AND OpenTime < OpenTime[1])THEN
pmLL = low
pmHH = high
pmBarID= BarIndex
ENDIF
IF (OpenTime >= 040000) AND (OpenTime <= 093000) THEN
pmLL = min(pmLL,low)
pmHH = max(pmHH,high)
ENDIF
HH = max(HH,high)
LL = min(LL,low)
CL = close
//
DrawSegment(BarID,PrevHH,BarIndex,PrevHH) coloured(0,128,0,155) style(line,2) //Green
DrawSegment(BarID,PrevLL,BarIndex,PrevLL) coloured(0,0,255,255) style(line,2) //Blue
DrawSegment(BarID,PrevCL,BarIndex,PrevCL) coloured(255,0,0,255) style(line,2) //Red
//
DrawSegment(pmBarID,pmHH,BarIndex,pmHH) coloured(0,178,238,255) style(dottedline,3) //Cyan
DrawSegment(pmBarID,pmLL,BarIndex,pmLL) coloured(0,178,238,255) style(dottedline,3) //Cyan
RETURN
premarket data are plotted using cyan dotted bolder lines.
Thank you very much, how can I make a change so that the measurement of the previous day is only between 9:00 and 16:00?
Replace 040000 with 090000 and 093000 with 160000.
The Premarket Lines, works great, but for the Previous Day I only want to take the time for the previous day between 8:30 to 15:00.
¿How can i change this?
Thanks.
There you go:
DEFPARAM DrawOnLastBarOnly = true
ONCE PrevHH = high
ONCE PrevLL = low
ONCE PrecCL = close
ONCE HH = high
ONCE LL = low
ONCE CL = close
ONCE pmHH = high
ONCE pmLL = low
If OpenTime = 083000 OR (OpenTime >= 083000 AND OpenTime < OpenTime[1])THEN
PrevHH = HH
PrevLL = LL
PrevCL = CL//close[1]
LL = low
HH = high
CL = close
BarID = BarIndex
ENDIF
If OpenTime = 040000 OR (OpenTime >= 040000 AND OpenTime < OpenTime[1])THEN
pmLL = low
pmHH = high
pmBarID= BarIndex
ENDIF
IF (OpenTime >= 040000) AND (OpenTime <= 093000) THEN
pmLL = min(pmLL,low)
pmHH = max(pmHH,high)
ENDIF
IF (OpenTime >= 083000) AND (OpenTime <= 150000) THEN
HH = max(HH,high)
LL = min(LL,low)
CL = close
ENDIF
//
DrawSegment(BarID,PrevHH,BarIndex,PrevHH) coloured(0,128,0,155) style(line,2) //Green
DrawSegment(BarID,PrevLL,BarIndex,PrevLL) coloured(0,0,255,255) style(line,2) //Blue
DrawSegment(BarID,PrevCL,BarIndex,PrevCL) coloured(255,0,0,255) style(line,2) //Red
//
DrawSegment(pmBarID,pmHH,BarIndex,pmHH) coloured(0,178,238,255) style(dottedline,3) //Cyan
DrawSegment(pmBarID,pmLL,BarIndex,pmLL) coloured(0,178,238,255) style(dottedline,3) //Cyan
RETURN