Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
You may find this function useful:
double calc_ema(double &in[], double &out[], int period, int index) { double alpha=2.0/(1+period); out[index]=out[index+1]*(1-alpha)+inp[index]*alpha; return out[index]; }
Forum on trading, automated trading systems and testing trading strategies
Moving Average of custom indicator
Fernando Carreiro, 2023.10.03 15:48
The following paper is also of great value for implementing EMAs — Incremental calculation of weighted mean and variance (Tony Finch) [2009, Cambridge University]Forum on trading, automated trading systems and testing trading strategies
Moving Average of custom indicator
Fernando Carreiro, 2023.10.03 01:39
There are many example indicators in the CodeBase, many of which incorporate moving averages. Study them and apply the code to your own requirements.
Here are some examples of my own which incorporate EMA's.
Exponential Commodity Channel Index
Fernando Carreiro, 2023.04.16 04:58
Commodity Channel Index using exponential moving averages.Wilder's Average True Range (ATR)
Fernando Carreiro, 2023.01.22 13:25
An implementation of the original Average True Range indicator by John Welles Wilder Jr. as described in his book—New Concepts in Technical Trading Systems [1978].Wilder's Relative Strength Index
Fernando Carreiro, 2023.01.22 18:12
An implementation of the Relative Strength Index indicator by John Welles Wilder Jr. as described in his book—New Concepts in Technical Trading Systems [1978].
Exponential Range Average & Deviation Offset
Fernando Carreiro, 2022.06.25 16:02
An exponential moving average of the true range and the offset of its average deviation
Fernando Carreiro, 2023.01.01 16:40
Based on the original “Time Segmented Volume (TSV)” developed by Worden Brothers, Inc.Dōteki Heikin Ashi (Dynamic Average Foot/Bar)
Fernando Carreiro, 2018.10.15 17:33
A dynamic version of the standard Heikin Ashi indicator (code compatible with both MQL4 or MQL5).
many options, like what has been discussed...although I will say that once you start using buffers set as time series, the functions for MA need to be constructed differently, and that's where it starts getting confusing...but in this case buffers are not set as series so it will be straightforward
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi there,
I'm just curious as to how to proceed with calculating the EMA for a LinearRegression calculation.
So I have adopted a LinearRegression from mladen (credits to the owner).
And this seems to be working, what i wish to do next is to calculate the EMA of the resulting LinearRegression. Below is the formula:
Add note: I am aware of iMA but I am not sure how to add calculating LinRegCalc, since the only option are PRICE_...
so i thought of perhaps adding a manual calculation for EMA, just like iLinr below
Appreciate any help with regards to this. Thanks in advance. :)