Keltner Pullback Trend System
Keltner channels (an EMA middle line with ATR-multiple bands, Chester Keltner's original concept as popularised by Linda Bradford Raschke) are usually published as breakout systems - trade when price closes outside a band. This one deliberately does the opposite: it trades the pullback BACK toward the trend, using the channel bands as a mean-reversion trigger inside a trend the slow EMA filter has already confirmed, which is closer to how the channel is actually used by discretionary trend traders looking for a lower-risk entry than chasing the initial breakout. Native MQL4 has no built-in Keltner indicator, so the channel is computed directly from iMA (EMA) and iATR each bar - middle = EMA(N), bands = middle +/- (ATR(P) * multiplier). The entry itself needs two bars, not one: the pullback bar whose low (long side) or high (short side) touches or crosses the band, and the FOLLOWING bar closing back inside it. The close-back-inside bar is the actual trigger - a single wick into the band on its own is not enough, because that would fire mid-pullback before any bounce has actually been confirmed. Notes and limitations One position at a time on the chart's own symbol; exits rely entirely on the fixed stop/target sent with the order, there is no separate trailing-stop mechanism. The pullback confirmation needs two fully closed bars past the signal, so this is slower to react than a single-bar breakout trigger by design - that is the trade-off for waiting for the bounce rather than chasing the touch. A trending market that never pulls back cleanly to the band (a strong one-way run) will simply produce no signal at all - this system is not a breakout follower and will not chase price away from the channel.
Expert advisor · MT5 · v1.0 · Free
About Keltner Pullback Trend System
Keltner Pullback Trend System is an expert advisor (trading robot) for MetaTrader 5 based on Moving Average and ATR. It increases the lot size after a losing trade (martingale) and can size trades from your balance and risk percent. It has 13 settings, such as Keltner ma period, Keltner atr period and Band multiplier. MQL source code included.
Files in the download: KeltnerPullbackSystem.ex5, KeltnerPullbackSystem.mq5, KeltnerPullbackSystem.txt.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Keltner ma period | 20 | EMA period for the Keltner channel middle line |
| Keltner atr period | 10 | ATR period feeding the channel bands |
| Band multiplier | 2.0 | Band distance, multiples of ATR |
| Trend ma period | 100 | Slow EMA used purely as the trend filter (price above/below it) |
| Atr mult sl | 1.0 | Stop loss beyond the pullback extreme, multiples of ATR |
| Atr mult tp | 2.0 | Take profit distance, multiples of ATR |
| Use risk sizing | true | Size by percent risk to the stop instead of a fixed lot |
| Risk percent | 1.0 | Percent of equity risked per trade, when risk sizing is on |
| Fixed lots | 0.10 | Lot size when risk sizing is off, or as a sizing fallback |
| Magic number | 33201 | Magic number for orders opened by this EA |
| Slippage pips | 3 | Slippage tolerance, in pips |
| Max retries | 5 | Attempts per trade action before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Breakout · Moving Average · ATR · Channels & Envelopes · Trend · Martingale · Risk & Lot Size · MT5 Expert Advisor · MQL5 Source Code