Hi, Nicolas et al,
I am probably being a little dim, but I am struggling to get the exactness I require.
I am trying to get the highs and lows between two times. Could you cast your eyes over this to see where I am going wrong?
Many thanks,
Robert
defparam drawonlastbaronly=false
////////////Asia////////////
once ascount=0
AsOP=020000
AsCl=050000
if time=asop then
ascount=ascount+1
$stct[0]=barindex
$price[0]=open
elsif time=ascl then
$endct[0]=(barindex)
$close[0]=highest[ascount](high)
endif
for i=$stct[0] to $endct[0] do
drawrectangle($stct[0],$price[0],$endct[0],$close[0])
break
next
////////////London///////////
//LonOp=020000
//LonCl=050000
////////////NY//////////////
//NYOp=070000
//NYCl=100000
DRAWCANDLE(open, high, low, close)
return
Hi Robert, getting highest and lowest between two times has been coded a few times, if you prefer a site “search” solution, keywords like “open range” or “initial balance” or “world sessions” should return several ways of doing it. Most recent one I remember is: https://www.prorealcode.com/topic/condition-range-asiatique/#post-193414
from which you can adapt lines 3 to 12 with:
AsOP=020000
AsCl=050000
if opentime=AsOP then
hh=high
ll=low
baropen=barindex
endif
if opentime>AsOP and opentime<AsCl then
hh=max(hh,high)
ll=min(ll,low)
endif
if time=AsCl then
barclose=barindex
drawrectangle(baropen, ll, barclose, hh)
endif
return