Discussing the article: "Automating Trading Strategies in MQL5 (Part 41): Candle Range Theory (CRT) – Accumulation, Manipulation, Distribution (AMD)"

 

Check out the new article: Automating Trading Strategies in MQL5 (Part 41): Candle Range Theory (CRT) – Accumulation, Manipulation, Distribution (AMD).

In this article, we develop a Candle Range Theory (CRT) trading system in MQL5 that identifies accumulation ranges on a specified timeframe, detects breaches with manipulation depth filtering, and confirms reversals for entry trades in the distribution phase. The system supports dynamic or static stop-loss and take-profit calculations based on risk-reward ratios, optional trailing stops, and limits on positions per direction for controlled risk management.

The Candle Range Theory (CRT) is a price action strategy that focuses on identifying key phases within a candle's range to capture high-probability reversal trades. It breaks down market movements into three core phases: accumulation, where price consolidates within a defined range often signaling institutional buildup; manipulation, where price briefly breaches the range extremes to trap traders and shake out weak positions; and distribution, where the true directional move unfolds after a confirmed reversal back into the range. This approach leverages the idea that significant breaches are often false moves designed to create liquidity, followed by a strong counter-move in the opposite direction.

In a positive (bullish) range setup, we look for an upward-closing candle range, anticipate a downward breach as manipulation to raid stops below the low, and enter a buy trade upon reversal back above the low with confirmation, expecting an upward distribution. Conversely, in a negative (bearish) range setup, we identify a downward-closing candle range, watch for an upward breach as manipulation above the high, and initiate a sell trade on reversal back below the high, aiming for downward distribution. By incorporating filters like minimum manipulation depth and bar-based reversal confirmation, we can avoid low-quality setups and focus on those with stronger conviction. 

CANDLE RANGE THEORY (CRT) SETUP

Our plan is to define accumulation ranges on a user-specified timeframe. We will detect breaches and validate manipulation depth against a percentage threshold if this option is enabled. We also confirm reversals through a set number of closing bars on a confirmation timeframe. Trades are executed with limits on positions per direction. We apply dynamic or static stop-loss and take-profit levels based on risk-reward ratios. After a profit threshold is reached, we can incorporate optional trailing stops. All phases are visualized with on-chart rectangles, levels, and labels for intuitive monitoring. In brief, here is a visual representation of our objectives.

Author: Allan Munene Mutiiria

 
Thanks, it looks interesting.
 
You did not explain how the beginning of each new accumulation phase is detected.
 
Christian Gomez #:
Thanks, it looks interesting.
Thanks
 
Stanislav Korotky #:
You did not explain how the beginning of each new accumulation phase is detected.

That's the candle ranges as visualized.

      double prevMax = iHigh(_Symbol, RangeTF, 1);                //--- Get prev high
      double prevMin = iLow(_Symbol, RangeTF, 1);                 //--- Get prev low
      double prevStart = iOpen(_Symbol, RangeTF, 1);              //--- Get prev open
      double prevEnd = iClose(_Symbol, RangeTF, 1);               //--- Get prev close
      rangeMax = prevMax;                                         //--- Set range max
 
Allan Munene Mutiiria #:

That's the candle ranges as visualized.

This does not answer the question - how do you find the beginning of the accumulation phase (each and every, because the phase occurs again and again on different sections of the chart). It is about time, not a range of prices. It is not about visualization as well.

 
Comments that do not relate to this topic, have been moved to "Off-topic posts".