Looks like I cannot attach excels. Here are the EMA calculations anyway
O | P | Q |
---|---|---|
EMA_Period=2/(2+1) | ||
Data | EMA calc | |
9 | =9 | |
8 | =8*EMA_Period+9*(1-EMA_Period) | |
7 | =7*EMA_Period+8*(1-EMA_Period) | |
6 | =6*EMA_Period+7*(1-EMA_Period) | |
5 | =5*EMA_Period+6*(1-EMA_Period) | |
4 | =4*EMA_Period+5*(1-EMA_Period) | |
3 | =3*EMA_Period+4*(1-EMA_Period) | |
2 | =2*EMA_Period+3*(1-EMA_Period) | |
1 | =1*EMA_Period+2*(1-EMA_Period) | |
0 | =0*EMA_Period+1*(1-EMA_Period) | |
Hi all,
Was trying to get my head around the iMAonArray function. I noticed that if you use a simple array then the iMAonArray function reads from lower to upper bound of the array variable whereas if the array is an indicator buffer array then the iMAOnArray function reads from upper to lower bound of the array. It took me some time to realise that I cannot use a custom indicator in an EA.
For example here is my EA code to check the simple array version
The output is like below
The excel calculation is attached in the file FOREX.2013.DEC.03.1. Please see calculation in column Q.
The difference between the two arrays is because the buffer array is SetAsSeries(). You can use the values from a custom indicator in an EA by calling iCustom.
Briliant thanks for the info SDC.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- 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 all,
Was trying to get my head around the iMAonArray function. I noticed that if you use a simple array then the iMAonArray function reads from lower to upper bound of the array variable whereas if the array is an indicator buffer array then the iMAOnArray function reads from upper to lower bound of the array. It took me some time to realise that I cannot use a custom indicator in an EA.
For example here is my EA code to check the simple array version
The output is like below
The excel calculation is attached in the file FOREX.2013.DEC.03.1. Please see calculation in column Q.