Backtesting performance-Entry and exit based on Stop orders

alokdaga

Active Member
#1
I want to backtest a system where the entry is based on stop based orders. E.g . Entry is taken above the high+few ticks above the signal bar. So I need to have that level as entry level in backtest whereas right now the close is taken as entry price... Can anybody guide if it is possible to do so? Thanks
 

jahan

Well-Known Member
#2
I want to backtest a system where the entry is based on stop based orders. E.g . Entry is taken above the high+few ticks above the signal bar. So I need to have that level as entry level in backtest whereas right now the close is taken as entry price... Can anybody guide if it is possible to do so? Thanks
Hello,

offcourse u can do that......i don't know about other charting software's but Amibroker can do it for u....

In Amibroker go to HELP tab and press SEARCH a window will popup in search widow type.."stop order" and select the first one you will get the idea how to code ur algorithm...

Regards,
 

alokdaga

Active Member
#3
Coding part I have already done... But I need to backtest... but the backtest is being done on the closing price of bar which triggers the level and not the level itself...
 
#6
back testing code
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]