Regularised EMA
An ordinary EMA only ever looks at how far the line is from the current price. Chris Satchwell's Regularised EMA (REMA) adds a second term that also looks at the line's own recent curvature - specifically the change in its own slope from one step to the next - and damps that curvature down. The recursion is: R[i] = ( R[i-1]*(1+2L) + a*(P[i]-R[i-1]) - L*R[i-2] ) / (1+L) where a is the usual EMA smoothing constant 2/(period+1) and L is the regularisation weight. Setting L to zero removes the extra term entirely and the formula collapses back to a plain EMA - so the plain EMA is really just this indicator's own L=0 special case, which is why it is plotted as a dotted reference line rather than treated as a separate calculation. Raising L trades a little responsiveness for a visibly smoother, less whippy line: a plain EMA can still show small kinks during a choppy stretch even though it is a low-pass filter, because it is only fighting distance from price, not curvature. Penalising the second derivative directly removes more of that kink without widening the averaging period the way a longer plain EMA would, which is the actual point of the regularisation term rather than a side effect of extra smoothing. Notes and limitations - Recursive, like any EMA-family filter: the first two bars of history have no prior R[i-1]/R[i-2] to reference, so they are seeded with plain price and a single plain-EMA step respectively rather than the full two-term formula. This affects only the very first two bars of the whole available history, never the live edge of the chart. - Does not repaint - each closed bar's value is fixed once computed and does not change as new bars arrive. - A negative InpLambda is rejected at load time; there is no published meaning for a negative regularisation weight.
Indicator · MT4 · v1.0 · Free
About Regularised EMA
Regularised EMA is an indicator for MetaTrader 4. It has 3 settings, such as Period, Lambda and Applied price. MQL source code included.
Files in the download: RegularisedEma.mq4, RegularisedEma.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Period | 14 | EMA period |
| Lambda | 0.5 | Regularisation weight (0 = plain EMA) |
| Applied price | PRICE_CLOSE | Applied price |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Moving Average · MT4 Indicator · MQL4 Source Code