Implementing a KDJ Crossover Strategy in C++
Summary
This tutorial describes a simple KDJ strategy and how to structure its implementation in C++ on the FMZ platform. It introduces the indicator’s RSV, K, D, and J components, then uses the relationship between K and D to generate long or short entry signals. Position exits use a change in the direction of D. The article outlines a loop-based program structure, retrieving K-line records, calculating the indicator, checking position state, and sending orders through a trading class library.
The tutorial also discusses using the prior completed bar’s indicator values and arranging close logic before open logic to manage reversals. It presents a walk-through rather than a performance study: no backtest results, transaction costs, or risk-adjusted evidence are supplied. The source excerpt contains apparent formatting or indexing errors, and the described signals are simplified; users would need to check the implementation and test the rules against their own instruments and execution conditions.
Key ideas
- The KDJ indicator derives RSV from recent price extremes and smooths it into K and D values, with J calculated from those values.
- The example uses K above D as a long signal and K below D as a short signal.
- It closes positions when D changes direction, according to the tutorial’s stated rules.
- The proposed program separates the main loop from data retrieval, indicator calculations, and order logic.
- The article offers implementation guidance but no evidence that the strategy is profitable.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.