You have to add a buffer : macd_buffer.
Right now It is like you have an array( macd_buffer )which is not initialized(allocated)
Thank you very much!
It works now!
All I had to do is change the number of buffers to 5 and add the line
SetIndexBuffer(4, macd_buffer, INDICATOR_CALCULATIONS);
Cheers
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hi all,
I am trying to create a simple indicator, basically a MACD on the RSI.
Calculating the RSI and the two moving averages is no problem, works fine.
Subtracting the two moving averages also works fine. (When I change the script to plot the resulting array of the subtraction, it plots ok.)
So far, so good, but then I need to apply another smoothing to the resulting value, and that's where iMAOnArray only returns 0.
The weird part is, it works when you do iMAOnArray on the first or the second moving average individually, but it doesn't work on (FirstMovingAverage - SecondMovingAverage) ??!! WTH?
What's going on?
Here is the code:
Thank you very much in advance.
Cheers