Skip to content
All library documents

Building a Non-Repainting Kagi Chart in MQL5

Article MQL5 articles

Summary

The article explains how to construct a Kagi chart in an MQL5 Expert Advisor. Unlike time-based candlesticks, Kagi lines extend with price movement and reverse only after crossing a chosen threshold. The implementation supports either a fixed price-step threshold or a percentage of price, and draws line segments over the main chart using graphical objects. It also builds the chart from historical bars and updates it as new bars arrive.

Kagi shoulders and waists mark swing highs and lows. Breaking a prior shoulder changes the line from thin Yin to thick Yang, while breaking a waist changes it back, providing conventional bullish and bearish signals. The article presents a working visualization and implementation framework, but this installment focuses on chart construction rather than automated entries, exits, or performance testing; those are deferred to a later part. Reversal settings affect the swings displayed, and the described signals should not be treated as evidence of a profitable strategy.

Key ideas

  • A Kagi chart changes direction only after price crosses a selected reversal threshold.
  • The threshold can be defined as a fixed price amount or as a percentage of price.
  • Shoulder and waist breaks change the Kagi line between thin Yin and thick Yang states.
  • The article implements historical and live chart drawing in an MQL5 Expert Advisor.
  • This installment builds a visualization tool and does not provide strategy performance evidence.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.