I am wanting to take a 10 EMA and apply it to the Average True Range with a period of 1 (not to be confused with ATR of period 10). Assuming the ATR indicator is the only additional window attached, how can I code the value of the 10 EMA of the ATR (in the ATR indicator window) utilizing the "First Indicator's Data"? (the "applied price" only goes up to Weighted Close value 6)
- Indicators: Bobokus Fibonacci
- (MQL4) How to code First indicator's data?
- Sell at top and Buy at bottom Rsi indicator
Others may interject, but if I've understood you correctly, you will have to fill an array with the results of your ATR1 (presumably on every new bar) and then use iMAOnAray()to get the average of the values. Code is indicative only but hopefully explains better what I mean.
double my_array[10]; if (New_Bar) { my_array[0]=iATR(NULL,0,1,1); my_avg=iMAOnArray(my_array,0,10,0,MODE_EMA,0); for(i=10;i>=1;i--) { my_array[i]=my_array[i-1]; //clear space for next value } }
hth
V

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register