Staged Profit Targets and Stop Adjustments with Optional Trailing
Summary
This example demonstrates staged trade management after a position opens. Its sample entry is a crossover of 14- and 28-period simple moving averages. Profit thresholds and the initial stop are expressed as percentages of the average entry price and converted to instrument tick units. Once the first target is reached, the stop moves to breakeven; at the second target, it moves to the first target. Reaching the third target closes the trade in the standard mode.
An optional mode activates a trailing stop after the second target, using the third target as the trailing amount and the second target as its offset. The code tracks favorable price movement and advances the stop level accordingly. This is an implementation example, not evidence of a profitable entry strategy: the entry rule is explicitly a placeholder, and the excerpt gives no backtest results. Its behavior also depends on bar-based price observations, instrument tick size, and the chosen percentage thresholds.
Key ideas
- The example uses a moving-average crossover only as a sample entry condition.
- Stop and target distances are percentages of average entry price converted to ticks.
- After the first target, the stop moves to breakeven; after the second, it moves to the first target.
- The standard mode exits at the third target, while an option enables trailing after the second target.
- The example describes trade management mechanics but provides no evidence of profitability.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.