I tried to use Darvas indicator for building strategies
I call it as it is written in the manual but received only zeros
Below I present the code strategy and indicator
user's indicator Darvas
hh = highest[n]
ll = lowest[n]
once state = 2
v = hh
if hh = high[n-1] and high[n-1] > high and high[n-1] > low and (state = 1 or state = 2 ) then
v = hh
state = 0
x = 0
elsif ll = low[n-1] and low[n-1] < low and low[n-1] < high and ( state = 0 or state = 2 ) then
x = ll
state = 1
v = 0
elsif state = 0 and high > v[1] then
v = 0
x = 0
state = 2
elsif state = 1 and low < x[1] then
x = 0
v = 0
state = 2
else
v = v[1]
x = x[1]
endif
return v AS "Darvas R", x AS "Darvas S"
call in trading system program
myDarvasR, myDarvasS = CALL “Darvas Boxes Forever”[4]
i receive values myDarvasR, myDarvasS are equal zeros all time
What is my errors?
I fell by chance on this old subject, sorry for late answer 🙂
Your code of Darvas boxes use future data, that’s why it is not possible to use it in a trading strategy with ProOrder/ProBacktest.