Problem with iMaOnArray function

 
My problem is when I attach my indicator to a chart it does not display I have to complie it and then when I change an input parameter it does not display I have to compile it again before the indicator displays.

now when I remove the iMaOnArray Functions it displays all the time.

Here is my init code
int init()
{
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_SECTION,0,1,Trend_Color);
   SetIndexBuffer(0,Trend);
   SetIndexBuffer(1, TrendBuff); // Temp Array
   return(0);
}



and here is where I call the iMaOnArray

Trend[i] = iMAOnArray(TrendBuff,0,Trend_Smooth,0,MODE_SMA,i);



Any Ideas?

Thanks
EK

 
Could you, please, show the entire code of your indicator?
 
Thank you for responding to my question, but I am un-willing to shope my code base so if I cant find a solution then I will try to code around the problem

Thank You
EK
 
Ok.
Show please 2-3 lines of code about TrendBuff array filling

For example see our MACD custom indicator
//---- macd counted in the 1-st buffer
   for(int i=0; i<limit; i++)
      MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd buffer
   for(i=0; i<limit; i++)
      SignalBuffer[i]=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i);
 
Thank you Slawa
Reason: