Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.
What Is This Strategy?
The Kagi Line Reversal strategy is a trend-reversal trading system built around the Kagi chart — a classic Japanese charting method that, like Renko, Point-and-Figure, or Three-Line-Break, filters out both time and minor price noise. Instead of plotting one candle per fixed time interval, a Kagi line simply keeps extending in its current direction as price makes fresh extremes, and it only reverses when price retraces by a defined threshold called the reversal amount. In this implementation the reversal amount is scaled by the Average True Range (ATR) — a common measure of recent volatility — so the chart automatically adapts to each instrument rather than relying on a fixed pip distance.
What makes the Kagi chart distinctive is the concept of line thickness. Each reversal leaves behind a turning point: an up-line that reverses down stamps a shoulder (a local peak), while a down-line that reverses up stamps a waist (a local trough). The line then changes thickness — from thin (called yin) to thick (called yang) — whenever price breaks one of these prior turning points. The strategy treats that thickness flip as its trading signal, giving it a clean, rules-based way to define when a trend has genuinely resumed rather than merely wobbled.
This strategy is best understood as a learning tool for traders who want to study alternative charting logic and stop-and-reverse system design. It is designed for markets that produce sustained directional swings, and it may appeal to anyone curious about how noise-filtering charts translate into automated MetaTrader 5 entries. It is not a shortcut to results — it is a structured example of how a volatility-adaptive reversal engine can be built and tested.
How It Works
The strategy processes one signal per freshly closed bar. On each completed bar it recalculates ATR, derives the reversal amount, advances the internal Kagi line, and checks whether the line's thickness has flipped. Here is the logic in plain English:
- Building the Kagi line: The line extends in its current direction every time price prints a new extreme (a higher high while rising, or a lower low while falling).
- Detecting a reversal: When price retraces against the line by at least the reversal amount (
ReversalMult × ATR), the line flips direction. A downward flip stamps the previous peak as a shoulder; an upward flip stamps the previous trough as a waist. - Buy signal (fresh yang): When the rising line pushes above the prior shoulder, thickness turns from thin to thick — the strategy signals that demand has overcome the last supply shelf, and it opens a long position.
- Sell signal (fresh yin): When the falling line drops below the prior waist, thickness turns from thick to thin — the strategy signals that supply has broken the last demand shelf, and it opens a short position.
- Stop-and-reverse behavior: Because yang and yin strictly alternate, the system behaves as a stop-and-reverse engine. A fresh yang closes any open short before opening a long, and a fresh yin closes any open long before opening a short. It never holds opposing positions at once.
- Stop-loss logic: Each entry places a protective stop at a fixed ATR distance from the fill price (
StopAtrMult × ATR). For a long, the stop sits below entry; for a short, above. - Take-profit logic: Each entry also places a target at an ATR distance from the fill (
TpAtrMult × ATR) — above entry for longs, below for shorts. With the defaults, the target distance is wider than the stop distance, reflecting a trend-following intent to let winners run further than losers.
Because the entire chart is driven by ATR, the reversal threshold and the risk distances all breathe together with volatility: quiet markets produce tighter swings and tighter stops, while volatile markets widen everything proportionally.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| ReversalMult | 1.0 | 0.3 | 4.0 | The Kagi reversal amount as a multiple of ATR. Larger values require bigger retracements to flip the line, producing fewer but larger swings. |
| AtrPeriod | 14 | 5 | 50 | The ATR lookback in bars. It sizes both the reversal amount and the stop/target distances. |
| StopAtrMult | 2.5 | 0.5 | 6.0 | Protective stop-loss distance, expressed in ATR multiples, measured from the entry price. |
| TpAtrMult | 4.0 | 0.5 | 10.0 | Take-profit distance, expressed in ATR multiples, measured from the entry price. |
| Lots | 0.10 | 0.01 | 1.0 | The fixed trade volume in lots for each new position. |

Recommended Chart Settings
The Kagi Line Reversal EA is symbol-agnostic because its reversal threshold is ATR-scaled, but it is most naturally studied on major forex pairs such as EUR/USD or GBP/USD, where liquidity is deep and ATR behaves smoothly. A good starting point for research is the H1 (1-hour) or H4 (4-hour) timeframe, where directional swings are large enough for the shoulder/waist thickness rule to generate meaningful signals without excessive churn.
Higher timeframes tend to produce fewer, cleaner reversals; lower timeframes produce more signals but also more noise-driven flips. Remember that Kagi behavior — and therefore performance — will vary considerably across different instruments, sessions, and market conditions. Always test any configuration on your own broker's data before drawing conclusions.
How to Install on MetaTrader 5
- Download the .ex5 file from the link below
- Copy it to your MT5
MQL5\Expertsfolder - Restart MetaTrader 5 or refresh the Navigator panel
- Drag the EA onto a chart matching the recommended symbol and timeframe
- Configure the input parameters and enable Algo Trading
What to Consider Before Using This EA
The Kagi approach has genuine strengths as a study subject. By discarding time and filtering out sub-threshold noise, it can help you focus on structurally significant turning points rather than every small wiggle. The shoulder/waist thickness rule gives an objective, unambiguous definition of trend continuation, and the ATR scaling means the same code adapts across volatility regimes without manual re-tuning. As a stop-and-reverse engine, it also keeps position management simple: the system is always either flat or aligned with the latest confirmed swing.
That said, this style of system has well-known limitations. Like all trend-reversal and breakout logic, it tends to perform best when markets trend and can struggle badly in choppy, range-bound conditions, where price repeatedly crosses shoulders and waists to produce a string of losing whipsaws. Because signals fire only on confirmed thickness flips, entries are inherently lagging — the strategy sacrifices early entry in exchange for confirmation, which may mean giving back part of a move before a signal appears. The fixed lot size does not scale risk to account equity, and the ATR-based stops, while adaptive, do not guarantee execution at the intended price during gaps or fast markets. None of these traits make the strategy good or bad on their own; they simply define the conditions under which it may indicate useful signals versus underperform.
Risk Management Tips
Sound risk management matters more than any single strategy. Consider the following general principles as you study this EA:
- Risk a small fraction per trade. Many educational sources suggest risking no more than 1–2% of account equity on any single position. Size your lots so that the ATR-based stop distance corresponds to that fraction, rather than leaving the default lot size unexamined.
- Start on a demo account. Run the EA on a demo or paper account first to understand its behavior, signal frequency, and drawdown characteristics before considering any live capital.
- Understand drawdown. Even a well-designed trend system will endure losing streaks during ranging markets. Know the maximum drawdown you are willing to tolerate and how it maps to your account size.
- Use appropriate leverage. Lower leverage reduces the impact of adverse moves and gives your strategy room to survive normal volatility.
- Review, don't set-and-forget. Periodically re-examine the parameters and the market regime. What worked in a trending period may need reassessment when conditions change.
Risk Warning
Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.
Downloads
- Expert Advisor: KagiLineReversal.ex5 (47 downloads)
- Source Code: KagiLineReversal.mq5 (48 downloads)
- Documentation: KagiLineReversal.pdf (51 downloads)