dear all,
I'm trying to write my first user-function. But it doesnt work.
let me use the manual function example to explane you my problem:
function IIR2( input, f0, f1, f2 )
{
result[ 0 ] = input[ 0 ];
result[ 1 ] = input[ 1 ];
for( i = 2; i < BarCount; i++ )
{
result[ i ] = f0 * input[ i ] +
f1 * result[ i - 1 ] +
f2 * result[ i - 2 ];
}
return result;
}
Now, it works very well if I call it inside the same backtest in which there is the function, but it doesn't work if I call it from another backtest (after have saved it as function with the name IIR2.afl in custom directory).
This instruction (again from manual) :
Plot( Close, "Price", colorBlack, styleCandle );
Plot( IIR2( Close, 0.2, 1.4, -0.6 ), "function example", colorRed );
give the following error about the second row:
sintax error: unexpected '(' expecting ')' or ','
thank you in advance,
Cippo
I'm trying to write my first user-function. But it doesnt work.
let me use the manual function example to explane you my problem:
function IIR2( input, f0, f1, f2 )
{
result[ 0 ] = input[ 0 ];
result[ 1 ] = input[ 1 ];
for( i = 2; i < BarCount; i++ )
{
result[ i ] = f0 * input[ i ] +
f1 * result[ i - 1 ] +
f2 * result[ i - 2 ];
}
return result;
}
Now, it works very well if I call it inside the same backtest in which there is the function, but it doesn't work if I call it from another backtest (after have saved it as function with the name IIR2.afl in custom directory).
This instruction (again from manual) :
Plot( Close, "Price", colorBlack, styleCandle );
Plot( IIR2( Close, 0.2, 1.4, -0.6 ), "function example", colorRed );
give the following error about the second row:
sintax error: unexpected '(' expecting ')' or ','
thank you in advance,
Cippo