System test settings window

Here you can define the following parameters of back-testing:

General tab

Initial equity - defines the size of your account. Please note that in multiple security backtest it is per-symbol equity value

Positions considered (long, short, both long and short)

Futures mode

This check box in the settings page is the key to backtesting futures. It instructs backtester to use margin deposit and point value in calculations.

Min. shares

The minimum number of shares that are allowed to buy/short. Backtester will not enter trades below that limit. Should be 1 for stocks. Fractional values are good for mutual funds.

Margin requirement

This setting defines percentage margin requirement for entire account. The default value of Margin requirement is 100. This means that you have to provide 100% funds to enter the trade, and this is the way how backtester worked in previous versions. But now you can simulate a margin account. When you buy on margin you are simply borrowing money from your broker to buy stock. With current regulations you can put up 50% of the purchase price of the stock you wish to buy and borrow the other half from your broker. To simulate this just enter 50 in the Margin requirement field (see pic. 1) . If your intial equity is set to 10000 your buying power will be then 20000 and you will be able to enter bigger positions. Please note that this settings sets the margin for entire account and it is NOT related to futures trading at all. In other words you can trade stocks on margin account.

Commissions

Annual interest rate

This setting allows you to define annual interest earned when you are out of the market or your position is less than available equity.

Periodicity

This setting controls bar interval used for backtesting/scan/exploration/optimization. To backtest intraday data you should switch to proper interval there and then run the backtest.

Allow position size shrinking

If you mark this box AmiBroker will shrink down positions if available equity is less than requested position size (via PositionSize variable). If this box is unmarked positions will not be entered in such case.

Activate stops immediatelly

When you trade on open and want to have built-in stops activated on the same bar - just mark this box.

If you trade on close and want built-in stops to be activated from the next bar - unmark this box.

You may ask why do not simply check the buyprice or shortprice array if it is equal to open price. Unfortunatelly this won't work. Why? Simply because there are doji days when open price equals close and then backtester will never know if trade was entered at market open or close.

Round lot size

Various instruments are traded with various "trading units" or "blocks". For example you can purchase fractional number of units of mutual fund, but you can not purchase fractional number of shares. Sometimes you have to buy in 10s or 100s lots. AmiBroker now allows you to specify the block size on global and per-symbol level.

You can define per-symbol round lot size in the Symbol->Information page. The value of zero means that the symbol has no special round lot size and will use "Default round lot size" (global setting) from the Automatic Analysis settings page. If default size is set also to zero it means that fractional number of shares/contracts are allowed.

You can also control round lot size directly from your AFL formula using RoundLotSize reserved variable, for example:

RoundLotSize = 10;

Tick size

This setting controls the minimum price move of given symbol. You can define it on global and per-symbol level. As with round lot size, you can define per-symbol tick size in the Symbol->Information page. The value of zero instructs AmiBroker to use "default tick size" defined in the Settings page of Automatic Analysis window. If default tick size is also set to zero it means that there is no minimum price move.

You can set and retrieve the tick size also from AFL formula using TickSize reserved variable, for example:

TickSize = 0.01;

Note that the tick size setting affects ONLY trades exited by built-in stops and/or ApplyStop(). The backtester assumes that price data follow tick size requirements and it does not change price arrays supplied by the user.

So specifying tick size makes sense only if you are using built-in stops so exit points are generated at "allowed" price levels instead of calculated ones. For example in Japan - you can not have fractional parts of yen so you should define global ticksize to 1, so built-in stops exit trades at integer levels.

Reverse entry signal forces exit

When it is ON (the default setting) - backtester works as in previous versions and closes already open positon if new entry signal in reverse direction is encountered. If this switch is OFF - even if reverse signal occurs backtester maintains currently open trade and does not close positon until regular exit (sell or cover) signal is generated.
In other words when this switch is OFF backtester ignores Short signals during long trades and ignores Buy signals during short trades.

Allow same bar exit (single bar trade)

When it is ON (the default settings) - entry and exit at the very same bar is allowed (as in previous versions)
if it is OFF - exit can happen starting from next bar only (this applies to regular signals,there is a separate setting for ApplyStop-generated exits). Switching it to OFF allows to reproduce the behaviour of MS backtester that is not able to handle same day exits.

Trade tab

Stop tab

See APPLYSTOP function for more details on different stop settings

Report tab

Result list shows

This decides which format of result list is used by new backtester. Possible choices:

Risk free rates

Defines risk free rates for Sharpe and UPI stats

Distribution charts spacing

Defines the spacing of profit, MAE and MFE distribution charts. The spacing is the % amount of profit/MAE/MFE per single bar in a chart.

Generate detailed reports for individual backtests

This causes that in Individual backtest mode full report is generated and stored for every security under test. Note that this will slow down the test and take up quite a bit of hard disk space

Include trade list in the report

When turned ON (by default) the backtest report includes also trade list. Note that trade lists may be huge and consume quite a bit of disk space

Warn before time-consuming optimizations

When turned ON (by default), AmiBroker will display confirmation dialog box when your optimization has more than 300 steps.

Portfolio tab

Max. Open Positions

Max. Open Positions - the maximum number of simultaneously open positions. .Settable also using SetOption("MaxOpenPositions", number ) function.

Pad and align to reference symbol

When this is turned on, all symbols' quotes are padded and aligned to reference symbol. Note: by default this setting is OFF. Use responsibly. It may slow down backtest and introduce some slight changes to indicator values when your data has holes and holes are filled with previous bar data. The feature is intended to be used ONLY when your system uses general market timing (generates global signals based on data and/or indicators calculated using Foreign from 'reference' symbol). Note 2: if reference symbol does not exist, data won't be padded.

Add artificial future bar

When checked AmiBroker adds tommorrow's bar and this enables you to see tommorrow's (or next bar) trade recommendations when your system uses one bar delay. Artificial future bar is has incremented date and volume set to zero and all price fields (OHLC) set to CLOSE price of last data bar.

Old tab

Drawdown figures based on...

Drawdown figures in the backtest report measure equity dip experienced during the trade(s). To calculate the dip you can use the worst case scenario: low price for long trades and high price for short trades or single price (open or close) for both long and short trades. "Drawdown figures based on..." setting (pic. 2) allows you to choose the price(s) used to calculate drowndowns. Using worst case scenario you will get a few percent bigger drawdowns than using close or open price. On the other hand Equity() function always uses shortprice/coverprice array so you may choose open or close field here to match drawdowns as observed in equity line.

Formula

- mark this box to include AFL formula in the backtest report

Settings

- mark this box to include settings in the backtest report

Incl. out-of-market pos

- mark this box to include out-of-market positions in the backtest report

Overall summary

- mark this box to include sum of individual symbol backtest results

Symbol summary

- mark this box to include per-symbol summaries

Trade list

- choose format of trade list included in the report