Advanced backtest

Dear Sirs, some time ago I bougth a trading strategy from a well known web site.
I would like to ask to the forum if Amibroker is able to perform a backtest so sofisticated.
Consider a portoflio composed by all the stocks included in a specific index (Russell 1000 or SP500 or whatsoever you want).
Basically, it is a 2 step process:
I° step: after the close of the session, esploration of the portfolio to filter the stock that meet a specific set up criteria for buying
II° step: perform a series of backtest picking the stocks (see later) randomly from the set up list coming from the exploration, because the number of free slot I have generally is smaller than the number of the stocks that meet the set up. In this way I can explore all the possible combination (or at leat, a good part) simulating the real trading.

Example: at the beginning I have an account of 10000 $ that I split in 10 slot of 1000 $ each. As time goes by and on a specific day suppose that the account has grown. The value of each slot will be equity/10 and some one will be free for trading while other will not. In that day for example there will be free only 4 slot and therefore I’ll have to perform a lot of backtest picking from the set up list, randomly, group of 4 stocks. That’s all.

I hope to have been able to explain.

@gibasse If I understand your question correctly, you are asking if AmiBroker is capable of adjusting the position size for your trading systems rules.

The simple answer is YES it can.

Some possible parts of the User Guide for you to review and an introductory video,

And an example of code you may need,

MaxPositions = 10;

SetOption("MaxOpenPositions", MaxPositions); 
SetPositionSize( 100 / MaxPositions , spsPercentOfEquity);  // Compounded

SetOption("AllowPositionShrinking", True);

@gibasse One way to test random stock selection is with random position score. If you want to repeat the test many times, you can optimize an unused variable with a wide range of possible values. When the position score is random, each optimization step will produce different results. You could export the optimization results to a spreadsheet for further analysis.

@gibasse are you thinking of Monte Carlo simulation of a trading system? If so, Amibroker has built in Monte Carlo functionality.