Skip to content
All library documents

DiffMA: Separate Moving Averages for Bullish and Bearish Candles

Article MQL5 code base

Summary

DiffMA is an indicator that calculates separate average applied prices for bullish and bearish candlesticks within a specified lookback period. For each direction, it sums the one-period simple moving average of the selected applied price across candles of that type, then divides by the count of matching candles. The two resulting series, UP and DN, represent averages conditioned on candle direction rather than a conventional moving average over every bar.

The indicator has two configurable inputs: the candle-range period and the applied price. The description explains the calculation but does not specify how to interpret crossings, provide a trading rule, or present performance evidence. It also does not discuss what happens if the lookback contains no bullish or no bearish candles, so implementation details may matter in such cases. The page credits a Russian-language source and notes that its description was translated.

Key ideas

  • DiffMA calculates separate averages for bullish and bearish candles in the lookback window.
  • Each directional average is the sum of selected one-period applied prices divided by that candle type’s count.
  • The user can configure the lookback period and applied price.
  • The description supplies no signal rules, performance evidence, or handling for a zero candle count.

Tags

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