ProBacktest/probacktest · proorder

BREAKEVEN

BREAKEVEN in ProOrder and ProBacktest moves a stop loss or take profit to the entry price. Used to lock in no-loss outcomes on winning trades or to cap losses on losing trades.

Syntax

probuilder
SET STOP BREAKEVEN
probuilder
SET TARGET BREAKEVEN

Variants

VariantPurposeWhen to use
SET STOP BREAKEVENMoves the stop loss to the entry price. Locks in a no-loss outcome on a winning position.Trade has moved favorably and downside risk should be removed.
SET TARGET BREAKEVENMoves the take profit to the entry price. Caps losses by exiting flat if price recovers.Trade has moved against you and the goal is to escape at break-even.

How it works

On the bar where the instruction executes, ProOrder updates the active order on the broker. From that point forward the position behaves as if the stop or target had been placed at the entry price from the start. If price then crosses the new level, the position closes as normal.

The instruction only affects the position that is currently open. It has no effect when called with no open position. It also overwrites any previous stop or target on the same side, so calling it twice in a row leaves the second call as the active value.

Examples

Example 1, Stop to breakeven on a long position (ProOrder)

probuilder
IF longonmarket THEN
  IF high - tradeprice >= 10 * pointsize THEN
    SET STOP BREAKEVEN
  ENDIF
ENDIF

Once the long has run 10 points from entry, the stop moves up to the entry price. This is the canonical example from the official reference.

Example 2, Target to breakeven to escape a losing long (ProOrder)

probuilder
IF longonmarket THEN
  IF tradeprice - low >= 10 * pointsize THEN
    SET TARGET BREAKEVEN
  ENDIF
ENDIF

If the long has moved 10 points against you, the take profit becomes the entry price, so the strategy exits flat as soon as price recovers.

Example 3, Promote to breakeven after one R of profit (ProOrder)

probuilder
// Risk per trade is 1.5 ATR. Promote stop to BE after 1.5 ATR of profit.
atr      = AverageTrueRange[14](close)
stopDist = 1.5 * atr

IF NOT onmarket THEN
  // ... entry conditions go here ...
  BUY 1 CONTRACT AT MARKET
  SET STOP LOSS stopDist
ENDIF

IF longonmarket AND (close - tradeprice) >= stopDist THEN
  SET STOP BREAKEVEN
ENDIF

An R-multiple approach to trade management. The stop becomes breakeven once the trade has earned one full R of profit. Reusable across instruments because everything is sized in ATR units.

Common errors and gotchas

  • Called outside an open position. SET STOP BREAKEVEN requires onmarket = TRUE. Always wrap in IF longonmarket THEN ... ENDIF or IF shortonmarket THEN ... ENDIF. Without the guard, the strategy raises a runtime error.
  • Bracket misuse with $TRAILING and %TRAILING. BREAKEVEN and the trailing-stop instructions overwrite the same internal stop slot. Only the most recent SET call wins. Alternating between them per bar leads to unintended behavior. Pick one promotion strategy per trade.
  • Slippage at the breakeven price. In live ProOrder, stops triggered exactly at the entry price often execute a fraction below in fast markets, producing a tiny realized loss. Backtests assume perfect fills and overstate this technique's effectiveness.
  • Backtest looks great, live disappoints. Aggressive breakeven promotion is the single most common pattern that looks brilliant in ProBacktest and underperforms live, because it cuts winners short before mean-reversion to the trend resumes. Always compare with and without on the same data.
  • SET STOP LOSS, initial stop placement.
  • SET TARGET PROFIT, initial take-profit placement.
  • $TRAILING, trailing stop in points.
  • %TRAILING, trailing stop in percent.
  • TRADEPRICE, the entry price of the current position.
  • LONGONMARKET, true while a long position is open.
  • SHORTONMARKET, true while a short position is open.
  • ONMARKET, true while any position is open.