Errors converting Indicator to version 4
Posted: Fri Apr 22, 2022 5:39 pm
Hello,
I'm trying to convert this indicator of Lazybear to version 4. I need to make a strategy but I'm getting a lot of errors. The indicator is called Absolute Strength Index Oscillator
The errors that I'm getting are the next:
Thank you in advance!
I'm trying to convert this indicator of Lazybear to version 4. I need to make a strategy but I'm getting a lot of errors. The indicator is called Absolute Strength Index Oscillator
Code: Select all
//@version=4
strategy("ASIO", overlay=true,
initial_capital=30000,
commission_type=strategy.commission.cash_per_order,
commission_value=4)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Absolute Strength Index Oscillator
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
divisor3= input(true, "--------ASIO--------")
sh=input(false, title="Show as Histo")
lma=input(21, title="EMA Length")
ld=input(34, title="Signal Length")
osl=10
calc_abssio( ) =>
A = iff(close>close[1], nz(A[1])+(close/close[1])-1,nz(A[1]))
M = iff(close==close[1], nz(M[1])+1.0/osl,nz(M[1]))
D = iff(close<close[1], nz(D[1])+(close[1]/close)-1,nz(D[1]))
iff (D+M/2==0, 1, 1-1/(1+(A+M/2)/(D+M/2)))
abssi=calc_abssio()
abssio = (abssi - ema(abssi,lma))
alp=2.0/(ld+1)
mt=alp*abssio+(1-alp)*nz(mt[1])
ut=alp*mt+(1-alp)*nz(ut[1])
s=((2-alp)*mt-ut)/(1-alp)
d=abssio-s
plot(not sh ? abssio : na, color=(abssio > 0 ? abssio >= s ? green : orange : abssio <=s ? red :orange), title="ABSSIO", style=histogram, linewidth=2)
Do you know what am I doing wrong?line 17: Undeclared identifier 'A';
line 18: Undeclared identifier 'M';
line 19: Undeclared identifier 'D';
line 20: Undeclared identifier 'D';
line 20: Undeclared identifier 'M';
line 20: Undeclared identifier 'A';
line 20: Variable 'A' is not found in scope 'calc_abssio', cannot register side effect;
line 20: Variable 'M' is not found in scope 'calc_abssio', cannot register side effect;
line 20: Variable 'D' is not found in scope 'calc_abssio', cannot register side effect;
line 24: Undeclared identifier 'abssi';
line 26: Undeclared identifier 'abssio';
line 26: Undeclared identifier 'mt';
line 27: Undeclared identifier 'mt';
line 27: Undeclared identifier 'ut';
line 28: Undeclared identifier 'mt';
line 28: Undeclared identifier 'ut';
Thank you in advance!