Smoothing indicator
I have tried and failed several times using iMA and iMAOnArray
Hi,
I have an indicator on a 1min GBPUSD chart and it is created by looping through the bars getting the EURUSD closing price, The indicator works fine but I want to smooth this indicator how do I do it? (example please as I have tried and failed several times using iMA and iMAOnArray)
P.S. Sorry I know this is probably a stupid easy question but I hve spent ages trying to sort it so please help :)
Steve
Have a look at this code used to create a MACD as an example how to use iMAOnArray(), notice it uses two loops, one to prepare the data in an array and the second to use it in iMAOnArray() to smooth the signal line
Also notice SetIndexDrawBegin() used for the signal line
int init() { //---- drawing settings SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexStyle(1,DRAW_LINE); SetIndexDrawBegin(1,SignalSMA); //---- indicator buffers mapping SetIndexBuffer(0,MacdBuffer); SetIndexBuffer(1,SignalBuffer); //---- initialization done return(0); } int start() { int limit; int counted_bars=IndicatorCounted(); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- 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); //---- done return(0);

Hi,
I have an indicator on a 1min GBPUSD chart and it is created by looping through the bars getting the EURUSD closing price, The indicator works fine but I want to smooth this indicator how do I do it? (example please as I have tried and failed several times using iMA and iMAOnArray)
P.S. Sorry I know this is probably a stupid easy question but I hve spent ages trying to sort it so please help :)
Steve