I just want to draw two lines, the high and low of the live trading day from a timestamp. Essentially ORB at 45 minutes from market open. I’ve been modifying this indicator many ways, but I just can’t get anywhere with it, and I’m losing my mind. This should be simple…
Open Range Breakout Indicator ORB
RubberToe – ‘Struggling with a simple task’ is not a meaningful title. Your title has been edited.
- Give your topic a meaningful title. Describe your question or your subject in your title. Do not use meaningless titles such as ‘Coding Help Needed’.
There you go, just change the time as best fits you:
once maxii=undefined
once minii=undefined
once maxi1=undefined
once mini1=undefined
once maxi2=undefined
once mini2=undefined
once maxi3=undefined
once mini3=undefined
if time=090000 then
maxi=high
mini=low
Endif
maxi=max(high,maxi)
mini=min(low,mini)
lerange=(maxi-mini)/2
maxii=maxi
minii=mini
maxi1=maxi+lerange
mini1=mini-lerange
maxi2=maxi+2*lerange
mini2=mini-2*lerange
maxi3=maxi+3*lerange
mini3=mini-3*lerange
return maxii as "Maxi première heure de cotation", minii as "Mini première heure de cotation", maxi1 as "Maxi1" ,mini1 as "Mini1",maxi2 as "Maxi2" ,mini2 as "Mini2",maxi3 as "Maxi3" ,mini3 as "Mini3"
Thank you for looking at this, but we are hitting the same problem.
The lines are still draw dynamically throughout the trend, but I only need two static lines set off the highest/lowest price in the first 30 minutes after the open. The lines would start at a time (for example 11:00 am EST and stop at the end of the trading day.
I’ve been trying the DRAWSEGMENT command, but I can’t find good examples and the documentation is pretty thin…
OK, some success. I modified the code and set to 30 minute timeframe, which seems to do the range nicely. Now I need a way to not draw the line for those first 30 minutes….
once maxii=undefined
once minii=undefined
//once maxi1=undefined
//once mini1=undefined
//once maxi2=undefined
// mini2=undefined
//once maxi3=undefined
//once mini3=undefined
timeframe(30mn)
if time=110000 then
maxi=high
mini=low
Endif
//maxi=max(high,maxi)
//mini=min(low,mini)
//lerange=(maxi-mini)/2
maxii=maxi
minii=mini
//maxi1=maxi+lerange
//mini1=mini-lerange
//maxi2=maxi+2*lerange
//mini2=mini-2*lerange
//maxi3=maxi+3*lerange
//mini3=mini-3*lerange
return maxii as "Maxi première heure de cotation", minii as "Mini première heure de cotation"
//, maxi1 as "Maxi1" ,mini1 as "Mini1",maxi2 as "Maxi2" ,mini2 as "Mini2",maxi3 as "Maxi3" ,mini3 as "Mini3"
how about this little code (just change the ORB and end of session times that fits you) :
orbstart = 090000
orbend = 110000
endsession = 174500
if opentime = orbstart then
ORBH = high
ORBL = low
endif
if opentime >= orbstart and opentime <= orbend then
ORBH = max(high,ORBH)
ORBL = min(low,ORBL)
endif
alpha = 255 * (opentime > orbend and opentime <= endsession)
return ORBH coloured(0,0,0, alpha) as "ORB HIGH" , ORBL coloured(0,0,0, alpha) AS "ORB LOW"