iCustom calculate from another iCustom value

 

I will enquire about use iCustom, for example at this case :

iCustom(Symbol(),Period(),"T3 -trix",A_t3_period,num_bars,is_A_open_price,B_t3_period_ac,diferential,hot,0,shift+0);

How to modificate the iCustom(Symbol(),..... to calculate from the iMA value or another iCustom value, not calculate from curent symbol (current price tick). Thank's for your help !.

 
Yes it's ugly, and it's not the real iMA, but this works for calculating a SMA.
         double value = iCustom(NULL,0,"T3-trix",0,pos), val;
         for(int i=1; i<MAPeriod; i++)
         {
            val = iCustom(NULL,0,"T3-trix",0,pos+i);
            value = (value * i + val)/(i+1);
         }
 
ThomasB:
Yes it's ugly, and it's not the real iMA, but this works for calculating a SMA.
         double value = iCustom(NULL,0,"T3-trix",0,pos), val;
         for(int i=1; i<MAPeriod; i++)
         {
            val = iCustom(NULL,0,"T3-trix",0,pos+i);
            value = (value * i + val)/(i+1);
         }

OK, Thank's very much, I'll try it !
Reason: