the following are the coding done for the esignal backtesting for the bollinger indicator (%b) - entry -exit - stoploss - target .
PROGRAM
global variable Declaration :
Var xUpper=null;
Var xLower=null;
Var Stop=null;
Var Target=null;
Var bInit=false;
function main()
{
if(getCurrentBarIndex()==0)
return;
if(bInit==false)
xUpper=Upperbollingerband(10);
xlower=Lowerbollingerband(10);
bInit=true;
}
return new Array(xUpper.getvalue(0), Xlower.getvalue(0));
Var nU=xUpper.getvalue(-1);
Var nL=xLower.getvalue(-1);
if(nU==null || nL==null)
return;
if(Strategy.isLong()==false && Low(0)<=nL)
{
Strategy.doLong("Long Signal",Strategy.LIMIT , Strategy.THISBAR, Strategy.DEFAULT , Math.Min(nL ,open(0));
elseif(Strategy.isShort()==false && high(0)>=nU)
{
Strategy.doShort("Short Signal ", Strategy.LIMIT , Strategy.THISBAR , Strategy.DEFAULT , Math.max(nU,open(0));
}
}
stop = Entry - 3*ATR(10);
Target =Entry+5*ATR(10);
}
Plz check the code , i am getting compling and execution problem for the backtesting code . can anyone correct the mistakes .Revert me back with right executsble code.
hari prasad
mail : [email protected]
PROGRAM
global variable Declaration :
Var xUpper=null;
Var xLower=null;
Var Stop=null;
Var Target=null;
Var bInit=false;
function main()
{
if(getCurrentBarIndex()==0)
return;
if(bInit==false)
xUpper=Upperbollingerband(10);
xlower=Lowerbollingerband(10);
bInit=true;
}
return new Array(xUpper.getvalue(0), Xlower.getvalue(0));
Var nU=xUpper.getvalue(-1);
Var nL=xLower.getvalue(-1);
if(nU==null || nL==null)
return;
if(Strategy.isLong()==false && Low(0)<=nL)
{
Strategy.doLong("Long Signal",Strategy.LIMIT , Strategy.THISBAR, Strategy.DEFAULT , Math.Min(nL ,open(0));
elseif(Strategy.isShort()==false && high(0)>=nU)
{
Strategy.doShort("Short Signal ", Strategy.LIMIT , Strategy.THISBAR , Strategy.DEFAULT , Math.max(nU,open(0));
}
}
stop = Entry - 3*ATR(10);
Target =Entry+5*ATR(10);
}
Plz check the code , i am getting compling and execution problem for the backtesting code . can anyone correct the mistakes .Revert me back with right executsble code.
hari prasad
mail : [email protected]