did anyone know the solution?
![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
Can some one kindly help to comment on the following code?
I got problem for the following code, the last thousands caculation is not corrected, and I had tried to use array initialize funtion and even a for() operation to initialize . but it did not work at all. it looks that the iMAonArray had problem somewhere. but I have no idea where is the problem located.
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Silver
#property indicator_color2 Red
#property indicator_width1 2
extern int FastEMA=36;
extern int SlowEMA=144;
extern int SignalSMA=24;
double MacdBuffer[];
double SignalBuffer[];
int init()
{
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexDrawBegin(0,SlowEMA);
SetIndexStyle(1,DRAW_LINE);
SetIndexDrawBegin(1,SignalSMA+SlowEMA);
SetIndexBuffer(0,MacdBuffer);
SetIndexBuffer(1,SignalBuffer);
IndicatorShortName("MACD Debugging("+FastEMA+","+SlowEMA+","+SignalSMA+")");
SetIndexLabel(0,"MACD");
SetIndexLabel(1,"Signal");
}
int start()
{
int limit,i=0;
int counted_bars=IndicatorCounted();
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(i=0; i<limit; i++)
MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_SMMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_SMMA,PRICE_CLOSE,i);
for(i=0; i<limit-SignalSMA; i++)
SignalBuffer[i]=iMAOnArray(MacdBuffer,0,SignalSMA,0,MODE_SMMA,i);
}