Hello everyone!
I'm starting on Amibroker and if anyone could help me I would be very grateful.
I am trying to calculate the CAR25 for montecarlo and that it appears in the Trade List. When I run the backtest on a single symbol it works fine.
But when I use the Individual Backtest the boxes are empty.
I wanted to know if there is an event when each symbol ends to be able to call it.
//Test
// System settings
SetOption( "Initialequity", 100000 );
SetOption( "MaxOpenPositions", 1 );
SetPositionSize( 10000, spsValue );
SetTradeDelays( 1, 1, 1, 1 );
BuyPrice = SellPrice = O;
Buy=Sell=Short=Cover=0;
// Parameters
MALength = 10;
// Indicators
LongTermMA = MA(C, MALength);
// Entry Rules
EntryRule1 = Close > LongTermMA;
// Exit Rules
ExitRule1 = Close < LongTermMA;
// Signals
Buy = EntryRule1;
Sell = ExitRule1;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
SetOption( "MCEnable", True );
SetOption( "MCRuns", 1000 );
SetCustomBacktestProc( "" );
if( Status( "action" ) == actionPortfolio ));//Is there an event when each symbol ends?
{
bo = GetBacktesterObject();
bo.Backtest();
mc = bo.GetMonteCarloSim();
if( mc )
{
// get 25-th percentile of final equity and CAR distribution
bo.AddCustomMetric( "CAR25", mc.GetValue( "CAR", 25 ) );
}
}
Thanks!!