Custom Backtesting

#1
Hi,

Is it Possible to use Portfolio Equity in Calculating an array?For Eg I have written the following code:

SetOption("InitialEquity" , 1000000);
NiftyClose = Foreign("$NIFTY-NSE" , "C" ) ;
MarginPerLot = (NiftyClose * LotSize) / 15 ;
TotalLots = round(Foreign("~~~Equity", "C" )/ MarginPerLot) ;

But Foreign("~~~Equity", "C" ) doesn't change and always remains as 1000000.How do I use Custom Backtester here?
 

mastermind007

Well-Known Member
#2
Even I am looking for a very good example of custom backtest routines of Amibroker.

I had simulated my own backtester in exploration and had defined my own equity array in AFL. From my POV, this is more effective because each scrip has its own equity allocation and it does not bite into another scrip's equity.

Unless, I am stress-testing the AFL and focussing on worst case scenarios of capital wipeout, I keep InitialEquity value as high as possible.
 

KS990

New Member
#3
The formula to calculate margin Per Lot
MarginPerLot = ( Current price of the Underlying * Lotsize ) / 15 . The max Number of Lots I can trade will be:
MaxLotsTraded = Current Equity Value / MarginPerLot
My question is How do I get the Current Equity Value?
 

Similar threads