Hello,
I always thought that in ProRealTime I could not use the the values of bars of next week (d+5), next month (d+20) and so on, for calculating the current bar (d) of a calculated indicator.
However, I am surprised to see that in the Darvas boxes indicator bellow, PRT is able to do so.
In an uptrend ticker, the top-left corner of a box is derived from the highest value of a bar some days ahead. How can this be possible.
Could you please explain the mechanism used?
Thank you in advance
Vicente
k=48
once tth=undefined
once ttl=undefined
n=(k*2)-4
p=(n/2)-1
h1=dpo[n](high)
moyh=high-h1
hi=(moyh-moyh[1]+(high[p])/n)*n
hi=(round(hi*100))/100
l1=dpo[n](low)
moyl=low-l1
lo=(moyl-moyl[1]+(low[p])/n)*n
lo=(round(lo*100))/100
low1=(round(low*100))/100
high1=(round(high*100))/100
if barindex > 100 then
if box=1 and (high1>tth or low1<ttl) then
box=0
flag=0
endif
if box=0 and flag=0 and low1<=lo[46] and low1<=lo[45] and low1<=lo[44] then
th=low1
flag=1
endif
if box=0 and flag=1 then
for zz=0 to 44
if lo[47-zz-1]<th or lo[47-zz-2]<th or lo[47-zz-3]<th then
flag=0
break
endif
if hi[47-zz]>hi[47-zz-1] and hi[47-zz]>hi[47-zz-2] and hi[47-zz]>hi[47-zz-3] then
box=1
ttl=th
tth=hi[47-zz]
break
endif
next
endif
else
tth=undefined
ttl=undefined
endif
if box=1 then
ba=ttl
else
ba=tth
endif
return ba coloured by box-1, tth coloured by box-1, ttl coloured by box-1
Because this indicator use DPO to know in advance the ahead bars of the price. DPO is known to use future prices, so in this case its values are reversed to get prices and use it in a different manner.