Moving average from Indicator handle

 

Hey, 

I'm currently working on an EA, for that I need a Moving Average from a certain Indicator value. For that I used the iMA function, but now I am facing a problem that I have not yet bee able to solve. The indicator returns two values in the data window and the specific indicator window which I both want to have a Moving Average value from. If I use the handle from the indicator inside the iMA function I only get the first value, which is what I exspected, because when using CopyBuffer for example I have to give a certain index so the Copy Bufffer ,,knows" which Data, either one or two, to pick. How can I do that with the iMA function, or is there any other way I will get my Moving Average from BOTH indicator values, which I have not yet found. I'm new to working with buffers and handles so please be gentle when there is general misunderstanding, I tried very hard for several hours to solve this. 

            int cnt = CopyBuffer(handle_iCustomIndicator, IndexIndicator, 0, 3, BufferIndicator); // example where I have to give the Index from Data window 

            // create an Array 
            double myMovingAverageArray2[];
            
            // define the properties of the Moving Average 1 
            int movingAverageDefinition2 = iMA (_Symbol,_Period,3,0,MODE_SMA,handle_iCustomIndicator); 
            
            // Defined MA1, one line, current candle, 3 candles, store result 
            CopyBuffer(movingAverageDefinition2,0,0,3,myMovingAverageArray2);
Reason: