Moving Average - page 156

 

Creating an EMA Crossover Forward Simulation (Culmination): Interactive Synthetic Candles

Creating an EMA Crossover Forward Simulation (Culmination): Interactive Synthetic Candles

In the first article, we built the core components of a Forward Simulation Engine for MetaTrader 5. We started with a basic EMA crossover detector. Then we added an anchor mechanism, an EMA-slope projection loop, a pip-based invalidation rule, and a chart-object rendering system. The result was a self-contained indicator capable of projecting a fixed number of synthetic OHLC candles beyond a confirmed crossover. These candles were drawn with visible bodies and wicks, labeled clearly on the chart, and automatically removed when invalidated or replaced by a new signal. This initial version established the foundation of the system, including signal detection, state management, object handling, and a repeatable candle-generation process. It also demonstrated that forward-looking visualization can be integrated into a traditional EMA indicator in a practical and useful way.

This article expands that foundation in three key areas. First, the projection engine now derives candle body and wick sizes from the average characteristics of recent market candles on the active symbol and timeframe. EMA slope remains a momentum factor, but candle dimensions now reflect the actual volatility of the instrument. As a result, projections naturally adapt to markets ranging from volatile XAUUSD on M15 to more stable EURUSD on H1. Second, the visual presentation has been enhanced with configurable spacing between candles, a sine-wave body-size envelope, proportional wick sizing, and controlled counter-trend candle injection. These additions create more realistic price sequences while preserving the overall directional bias.

Creating an EMA Crossover Forward Simulation Indicator in MQL5
Creating an EMA Crossover Forward Simulation Indicator in MQL5
  • 2026.05.13
  • www.mql5.com
A custom forward simulation engine detects fast/slow EMA crossovers and immediately projects synthetic candles ahead of the signal bar. It generates bodies and wicks using controlled logic, draws them with chart objects, and refreshes on every new signal or anchor change. You get a clear forward-looking view to test timing, visualize scenarios, and manage invalidation on the chart.