• Overview
  • Reviews
  • Comments (1)
  • What's new

Delta EMA

Delta EMA is a momentum indicator based on the changes of closing price from one bar to the next. It displays a histogram of the exponential moving average of those changes, showing magnitude and direction of trend. Positive delta values are displayed as green bars, and negative delta values are displayed as red bars. The transition from negative to positive delta, or from positive to negative delta, indicates trend reversal. Transition bars that exceed a user specified value are displayed in bright green or bright red, alerting the trader to potential buy and sell signals. The screenshot shows a transition bar displayed as a buy signal because it exceeds the default threshold value on the H1 chart of the EUR/USD currency pair. The transitions back to negative delta show good exit points for the trade. The indicator is expressed in terms of percent change, averaged over the number of bars specified by the user, so settings that work for one currency pair can be applied to other pairs. 


  • Indicates strength of momentum
  • Shows trend reversals
  • Provides buy and sell signals


  • Audible alerts
  • Prints data to terminal
  • Adjustable parameters
  • Updates in real time
  • Accessible by external EA

Input variables

EMA periods:  The number of bars in the exponential moving average of delta. This number determines the alpha or smoothing factor of the moving average. The calculation of alpha is explained at the end of this description.

Alpha of EMA:  Here the user can specify the alpha of the EMA directly. If this value is zero, alpha is calculated from the "EMA periods" input variable. If it is greater than zero, it becomes the value of alpha and the value of "EMA periods" is ignored.
Signal threshold:  A transition bar becomes a signal bar if it exceeds this value in the positive or negative direction. In that case, it is displayed as a bright green or bright red bar, and an audible alert can be sounded.  

Sound alert:  When set to true, indicator sounds an audible alert when a transition bar exceeds the value of input variable "Signal threshold," becoming a signal bar. The alert is sounded the first time the current bar exceeds the threshold value, and it is sounded when the close of a bar exceeds the threshold value. 

Print deltas:  When set to true, the value of the EMA of delta at the open of every bar is printed to the terminal. 

The default values of "EMA periods" and "Signal threshold" work well on the H1 chart. Smaller values of "Signal threshold" work better on shorter timeframes, where changes from one bar to the next are less, and larger values work better on longer timeframes. Optimal values can be found by using the output of Delta EMA as input to an Expert Advisor and running the EA in Strategy Tester. The EMA of delta for the current bar not yet completed is updated at every incoming tick and is displayed in the upper-left corner of the indicator's window. This value, or the value at the close of any previous bar, can be accessed by an external Expert Advisor calling the iCustom() and CopyBuffer() functions. The link to iCustom() provides an example of how to do that. The number of the indicator buffer to access is 0. That buffer uses reverse indexing order, so the index for the value of the EMA of delta for the current bar is 0, the index for the value at the close of the preceding bar is 1, the index for bar before that is 2, and so on. Note that if more than one value is copied, the order of indexing can be preserved in the destination buffer by first calling ArraySetAsSeries() like this: ArraySetAsSeries(EA_Buffer, true).

Calculation of alpha

The alpha of an EMA is calculated by the formula

a = 2.0 / (n+1)

where n is the number of EMA periods. The value of n can be a whole or fractional number. When the previous value of the EMA, designated EMAp, is known, a new value for a new data point or datum is calculated by the formula

EMA = a*datum + (1-a)*EMAp

where the asterisk is the multiplication operator. 

The normal range of alpha is greater than zero, less than or equal to 1, or 0 < a <= 1. When the value of alpha is 1, the calculation of EMA does not take the previous value of the EMA into account, and the EMA becomes the current datum, which in this indicator is the difference between two successive bars, calculated as percent change or

100 * (Close[1] - Close[2]) / Close[2]


No reviews
Version 1.2 2018.09.12
The wording of statements printed to the terminal is improved.
Version 1.1 2018.09.11
Fixed problem with sound alerts.