ProBacktest/probacktest · proorder

NOCASHUPDATE

NOCASHUPDATE is a DEFPARAM setting in ProBacktest that keeps initial capital constant during a backtest, removing compounding effects from strategy results.

Syntax

probuilder
DEFPARAM NOCASHUPDATE = true

Parameters

NameTypeDefaultDescription
NOCASHUPDATEbooleanfalseWhen true, the initial capital is not adjusted by realized gains and losses during the backtest. When false, capital updates with every closed trade.

How it works

By default a backtest maintains a running capital figure: each closed trade adds its profit or subtracts its loss, and the updated amount constrains what the strategy can afford next. Over a long simulation this creates a compounding effect. A profitable strategy accumulates capital that supports larger or more frequent positions, and a losing one can run out of cash and stop trading.

Setting NOCASHUPDATE to true freezes the capital at its initial value for the whole simulation. Trades still generate profits and losses, and the equity curve still records them, but the available cash used by the engine never moves. Every trade is taken against the same capital base, first trade and last trade alike.

The setting isolates the raw quality of the trading logic from the path of the account. Two signal sets can be compared on equal footing, without early losses in one run starving it of capital or early wins inflating it. It also prevents a technically sound strategy from halting mid-backtest because a drawdown temporarily exhausted the simulated cash.

The instruction is a DEFPARAM, so it must appear at the top of the code before any executable statement.

Examples

Example 1, Fixed-capital backtest (ProBacktest)

probuilder
DEFPARAM NOCASHUPDATE = true
// capital stays at its initial value for the entire simulation

IF NOT OnMarket AND close crosses over Average[50](close) THEN
  BUY 1 CONTRACT AT MARKET
  SET STOP PLOSS 40
ENDIF

IF LongOnMarket AND close crosses under Average[50](close) THEN
  SELL AT MARKET
ENDIF

A simple trend-following system evaluated on a constant capital base. The reported profit reflects the signals alone, not the compounding of earlier results.

Example 2, Surviving a deep drawdown (ProBacktest)

probuilder
DEFPARAM NOCASHUPDATE = true

// mean-reversion entries continue even after a losing streak,
// because losses never reduce the available cash
IF NOT OnMarket AND RSI[14](close) < 25 THEN
  BUY 2 CONTRACTS AT MARKET
  SET STOP PLOSS 60
  SET TARGET PPROFIT 80
ENDIF

With the default setting, a long losing streak could deplete the simulated capital and silently stop the backtest early. Holding the cash constant keeps every signal in the sample.

Example 3, Comparing raw performance across markets (ProOrder)

probuilder
DEFPARAM NOCASHUPDATE = true
DEFPARAM CumulateOrders = false

long = ExponentialAverage[20](close) crosses over ExponentialAverage[50](close)

IF NOT OnMarket AND long THEN
  BUY 1 CONTRACT AT MARKET
  SET STOP PLOSS 50
ENDIF

Running the same fixed-size system on several instruments with constant capital makes per-market results directly comparable, since no market's equity path feeds back into its position taking.

Common errors and gotchas

  • The default is false. Omitting the statement means capital updates trade by trade. A strategy that seems to stop trading partway through a backtest may simply have exhausted its simulated cash under the default behavior.
  • Equity metrics still move. The setting freezes the cash available to the engine, not the profit statistics. Gains and losses still appear in the equity curve and in STRATEGYPROFIT, only the capital base stops reacting to them.
  • DEFPARAM placement. Like every DEFPARAM, the statement must precede the first executable line of the code, otherwise compilation fails.
  • No effect on live money. In a live ProOrder account the real cash balance always reflects actual results. The parameter shapes the backtest simulation, it is not a live risk control.
  • DEFPARAM, declares strategy-level execution parameters.
  • CASH, position sizing based on a cash amount.
  • STRATEGYPROFIT, running profit of the strategy in currency.
  • CumulateOrders, allows several orders to accumulate into one position.
  • PRELOADBARS, number of historical bars loaded before the backtest starts.
  • FLATBEFORE, blocks position taking before a set time.
  • FLATAFTER, forces the strategy flat after a set time.
  • MAXORDER, maximum size allowed for a single order.