SetBacktestMode
- Sets working mode of the backtester

Trading system toolbox
(AFL 3.0)


SYNTAX SetBacktestMode( mode )
RETURNS NOTHING
FUNCTION Sets working mode of the backtester. A 'mode' parameter is one of the following backtest modes:

Supported backtest modes:

  • backtestRegular - regular, signal-based backtest, redundant signals are removed as shown in this picture
  • backtestRegularRaw - signal-based backtest, redundant (raw) entry signals are NOT removed, only one position per symbol allowed
  • backtestRegularRawMulti - signal-based backtest, redundant (raw) entry signals are NOT removed, MULTIPLE positions per symbol will be open if BUY/SHORT signal is true for more than one bar and there are free funds, Sell/Cover exit all open positions on given symbol, Scale-In/Out work on all open positions of given symbol at once.
  • backtestRegularRaw2 - for custom backtester users only, the same as backtestRegularRaw, but redundant exit signals are also kept. AVOID this mode - it requires lots of memory and slows everything down.
  • backtestRegularRaw2Multi - for custom backtester users only, same as backtestRegularRawMulti, but redundant exit signals are also kept. AVOID this mode - it requires lots of memory and slows everything down.
  • backtestRotational - rotational trading system see this.
EXAMPLE // default, as in 4.90, regular, signal-based backtest, redundant signals are removed
SetBacktestMode( backtestRegular );

// signal-based backtest, redundant (raw) signals are NOT removed, only one position per symbol allowed
SetBacktestMode( backtestRegularRaw );

// signal-based backtest, redundant (raw) signals are NOT removed,
// MULTIPLE positions per symbol will be open if BUY/SHORT signal is 'true' for more than one bar and there are free funds
// Sell/Cover exit all open positions on given symbol, Scale-In/Out work on all open positions of given symbol at once.
SetBacktestMode( backtestRegularRawMulti );

// rotational trading mode - equivalent of EnableRotationalTrading() call
SetBacktestMode( backtestRotational );
SEE ALSO EnableRotationalTrading() function

References:

The SetBacktestMode function is used in the following formulas in AFL on-line library:

More information:

Updated on-line reference