Traditional MACD with Momentum indicator and alarms

Traditional MACD with Momentum indicator and alarms

Traditional MACD indicator with a Momentum indicator and alarms. Allows customization of most of the parameters without having to dive into code.

a traditional MACD indicator where:

  • MACD line = FastEMA – SlowEMA
  • Signal = 9-day EMA of MACD
  • Histogram = MACD – Signal

The Momentum line is calculated by comparing two MACD values with 10 bars in between. Then Momentum is passed into a Moving Average to make it smoother.

Since MACD 0-crossovers and Momentum reversals can be important signals for traders, I’ve incorporated two alarms, one for each of the signals mentioned.

Note: These ‘alarms’ actually are being printed on the Experts tab, if you want alerts, just uncomment the respective lines in the code (instead of Print() function use Alert()).

 

  • BarsToProcess — Self-explanatory. Note: This affects the ability of the graph to render different time frames, at 1000 you can go up to 1D!
  • AppliedPrice — Price used to calculate MACD.
  • PeriodFastEMA — Period used to calculate fast moving average.
  • PeriodSlowEMA — Period used to calculate the slow moving average.
  • PeriodSignal — Period analyzed to calculate the signal line.
  • SignalMA — Moving average method used to calculate the signal line.
  • DeltaMomentum — Distance between the two points analyzed to calculate the Momentum.
  • PeriodMomentum — Period analyzed to compute the moving average of the Momentum (Momentum smoothing).
  • MomentumMA — Moving average method used to calculate the smoothed Momentum.
  • AlarmZeroCrossover — Enables/Disables the alarm for MACD 0-crossovers.
  • AlarmMomentumReverse — Enables/Disables the alarm for Momentum reversals.
Register to download