is it possible to call iMA in EA with another iMA??

 
Is it possible on one MA to apply another MA? Ex.:
double var=iMA(NULL, 0, 3, 0, MODE_SMA, PRICE_CLOSE, 0)
One MA is "var", now on this MA to apply another MA? Ex.:
double var1=iMA(NULL, 0, var, 0, MODE_SMA, PRICE_CLOSE, 0)
,

what I need is MA Period also, is any way to call this second MA on this way, or should be programmed as indicator ?
 
use iMAOnArray function. Before fill some array with iMA values
 
Thank You stringo,

I did something similar to this as indicator and it is working, but in script it is not working...

int i,limit,counted_bars=IndicatorCounted();
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
double MainBuffer[], double SignalBuffer[], double Buffer1[], double Buffer2[], sm, smp, fm, fmp;
// double Buffer1[10],Buffer2[10]; int limit=ArraySize(Buffer1); ArraySetAsSeries(Buffer1,true);
for(i=0; i<limit; i++) Buffer1[i]=iMA(NULL,0,Slowing1,0,MODE_LWMA,PRICE_MEDIAN, i);
for(i=0; i<limit; i++) Buffer2[i]=iMA(NULL,0,Slowing1,0,MODE_LWMA,PRICE_WEIGHTED, i);
for(i=0; i<limit; i++) MainBuffer[i]=iMAOnArray(Buffer1,Bars,Slowing, 0,MODE_LWMA,i);
for(i=0; i<limit; i++) SignalBuffer[i]=iMAOnArray(Buffer2,Bars,Slowing, 0,MODE_LWMA,i);

sm=iMAOnArray(SignalBuffer,0,1,0,MODE_LWMA,0); smp=iMAOnArray(SignalBuffer,0,1, 0,MODE_LWMA,1);
fm=iMAOnArray(MainBuffer,0,1,0,MODE_LWMA,0); fmp=iMAOnArray(MainBuffer,0,1,0,MODE_LWMA, 1);
I have also tried the combination in slashes, with array series , but I could not work it out, I don't know why...?
 
To rewritte, this line I've added in code was mistake

double MainBuffer[], double SignalBuffer[], double Buffer1[], double Buffer2[], sm, smp, fm, fmp;
the real one was

double MainBuffer[], SignalBuffer[], Buffer1[], Buffer2[], sm, smp, fm, fmp;
If you can help?
 
You need to resize your buffers (MainBuffer,SignalBuffer,Buffer1,Buffer2) before using because they have zero size and don't resized automatically
ArrayResize(MainBuffer,Bars);
Reason: