Keltner Channel Breakouts with OCO Entries and Trailing Exits
Summary
This strategy builds Keltner-style bands from a simple moving average of closing prices and a simple moving average of true range. On five-minute bars, when flat, it places linked stop orders above and below the bands so that a move beyond either boundary can establish a position. Once a position opens, the code cancels the entry order on the opposite side. It tracks the high or low reached during the trade and places a trailing exit order offset by a configured percentage.
The implementation also shows bar construction, indicator warm-up, order cancellation, and trade callbacks. It provides no backtest, market, or profitability evidence, and it does not explain how the channel parameters were selected. The trailing offset is percentage-based rather than tied to current volatility, and live results would depend on order handling, fees, slippage, and the instrument’s trading characteristics. The code describes a rule set, not a validated trading system.
Key ideas
- The channel uses a moving average of closes and a moving average of true range.
- When flat, the strategy places buy and short stop orders at opposite channel boundaries.
- After an entry fills, it cancels the opposing entry order.
- Open positions use a percentage offset from the best observed trade price for trailing exits.
- The document gives no empirical results or parameter-selection rationale.
Tags
From a private course collection; the original is not published.