AmiBroker’s portfolio backtester allows to define stock ranking and selection criteria by means of PositionScore variable. This is explained in details in the following tutorial chapter:
http://www.amibroker.com/guide/h_portfolio.html
If PositionScore is not defined or it has the same value for two or more symbols, then AmiBroker will use the following rules:
- transaction with greater PositionSize is preferred – the comparison method depends on the position sizing approach used in our code:
- If we use SetPositionSize( dollarvalue, spsValue) – then $ value is compared.
- If we use SetPositionSize( shares, spsShares) – then number of shares is used for comparison.
- If we use SetPositionSize( perc, spsPercentOfEquity) – then % equity matters.
- alphabetical order
- long trades rather than short trades, if both occur at the same time for the same symbol.