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?
Does your variables always return 0? Did you test them with a GRAPH instruction in your strategy already?
Also, a “defparam preloadbars=100” should help. Because you need historical datas to compute correctly the indicator.
Where is “n” variable defined?