Original basis was Pre-Market EUR/USA (Opening Range) | Graph Indicator Ver. 1.0 from Swapping, here and here .
Added some changes and features.
– segment for opening price;
– segment for yesterday’s closing price;
– Automatic detection of the timeframe;
– Automatic configuration for 1-5-10-15-30min charts.
Attached a version for EUR and USA.
Enjoy
Thomas
// Opening Range EUR with Close and Open.
// Added some changes and features.
// - segment for opening price;
// - segment for yesterday's closing price;
// - Automatic detection of the timeframe;
// - Automatic configuration for 1-5-10-15-30min charts.
// 17.06.2019 (Release 1.1)
// Thomas Geisler
// Sharing ProRealTime knowledge (alt+16)
// Original basis was Pre-Market EUR (Opening Range) | Graph Indicator Ver. 1.0
// from Swapping
// --- property settings
//Info = 1 // (0=false; 1=true)
//Delta = 10 // gap number/rectangle
//Alpha = 255 // transparency letter
//HighLow = 1 // (0=false; 1=true)
//OpenClose = 1 // (0=false; 1=true)
// --- end
DefParam CalculateOnLastBars = 1400 // enough for one day (23h) when using 1min timeframe
// --- init
alpha = max(alpha,0)
alpha = min(alpha,255)
// --- end
//Automatic time detection
once NbBar = 1
if BarIndex < NbBar+2 then
MyDay=openday
dayminutes = 1440*(MyDay-MyDay[1])
MyHour=openhour
hourminutes = 60*(MyHour-MyHour[1])
MyMin=openminute
barminutes = MyMin - MyMin[1] + hourminutes + dayminutes
barminutes=abs(barminutes)
Mybarminutes = lowest[NbBar](barminutes)[1]
endif
// Select timeframe between 1 and max 30 minutes to define the parameters for drawing
if Mybarminutes = 1 then
Frame = 60
myStart = 080100
elsif Mybarminutes = 5 then // 5 minutes
Frame = 12 // 12 candels
myStart = 080500 // opening plus 5 min
elsif Mybarminutes = 10 then
Frame = 6
myStart = 081000
elsif Mybarminutes = 15 then
Frame = 4
myStart = 081500
elsif Mybarminutes = 30 then
Frame = 2
myStart = 083000
endif
starttime = myStart // 08h00 Depending on the timeframe
endtime = 090000 // 09h00
if time = starttime then
startbar = barindex
endif
if time = endtime then
endbar = barindex
endif
if time >= starttime and time <= endtime then
if high > hh then
hh = high
endif
if low < ll or ll = 0 then
ll = low
endif
endif
if intradaybarindex = 0 then
hh = 0
ll = 0
endif
if time = 173000 then //Close Yesterday at time 17:30
cl = close
endif
if date = today and time > endtime then //draw Box OpenRange (OPR) only for today
DrawRectangle(startbar,hh,endbar,ll) coloured(0,255,255,alpha) // alpha (transparence)
endif
if date = today and time = endtime then // High/Low/Opening only for today
upper = highest[Frame](high)
lower = lowest[Frame](low)
op = close
dif = round(abs(upper-lower))
info = info // draw the info OPR, High, Low, Using Timeframe as text
elsif info = 1 then
DrawText("OPR #dif#pts",startbar+5,upper+(delta+5),SansSerif,Standard,12) coloured(255,0,255,alpha)
DrawText("#hh#",startbar+5,upper+(delta),SansSerif,Standard,12) coloured(0,255,255,alpha)
DrawText("#ll#",startbar+5,lower-(delta),SansSerif,Standard,12) coloured(0,255,255,alpha)
//DrawText("Timeframe #Time1o5o10o15# min.",startbar+5,lower-(delta+5),SansSerif,Standard,12) coloured(255,0,255,alpha)
endif
if date = today and time >= endtime and time <= 220000 then
If HighLow = 1 then// Draw Segment High,Low and Opening from OPR, as Support/Resist, to select time
DrawSegment(barindex-HighLow,upper,barindex,upper) coloured(0,255,255,alpha) // High OPR
DrawSegment(barindex-HighLow,lower,barindex,lower) coloured(0,255,255,alpha) // Low OPR
endif
If OpenClose = 1 then// Draw Segment High,Low and Opening from OPR, as Support/Resist, to select time
DrawSegment(barindex-OpenClose,op,barindex,op) coloured(255,0,204,alpha) // Opening
DrawSegment(barindex-OpenClose,cl,barindex,cl) coloured(255,0,0,alpha) //Close Yesterday
endif
endif
return