Max Position Duration

The Max Position Duration feature closes a position when it reaches the configured maximum duration since entry.

What the feature is for

Use this feature to exit positions that stay open too long. A maximum duration limits how long a position may age, so trades cannot remain open indefinitely when the price moves neither to the Take Profit nor to the Stop Loss.

How the duration works

When enabled, the strategy closes the position once the configured duration has passed since the entry. The duration is measured in the selected unit: bars, minutes, hours, or days. The default is 10 bars.

  • Bars: the engine compares bar numbers; the entry bar counts as the first bar.
  • Minutes, Hours, Days: the engine compares the bar open time with the entry time.

The feature works independently from the price-based exits. Whichever condition is reached first — Stop Loss, Take Profit, Break-even, or the maximum duration — closes the position. The duration close runs on the forced-close path: it also fires outside the Exit Hours window and outside the trading session.

Value range

The duration value ranges from 1 to 100, in the selected unit. The default is 10 bars.

Form fields

  • Unit: the duration unit — Bars, Minutes, Hours, or Days.
  • Max position duration: the maximum duration of a position, in the selected unit.