how to code "previous indicator's data" into your indicator

 

 i wanted to make my indicator shows the parameter tab   "apply to" option with the drop-down menu offering various ENUM_MA_METHOD including the previous or first indicator's data similar to attached. 


i've searched in the forum and still not finding the sample code that will enable me to do the above for my indicator. and indicators come with mt4 don't include 

the source code that i can use as an example to do so. can someone please give me some sample code for me to solve my problem? 

 
Did you use the correct form on OnCalculate? Event Handling Functions - Functions - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
int OnCalculate (const int rates_total,      // size of the price[] array
                 const int prev_calculated,  // bars handled on a previous call
                 const int begin,            // where the significant data start from
                 const double& price[]       // array to calculate
   );
 

That's not available in MQL4 is it?

 
I don't believe that form is available on MT4/MQL4. I believe it is only available on MT5/MQL5.
 

No no i Will use it. But please did you have an example to follow ?

 
Inehamos gueye #: No no i Will use it. But please did you have an example to follow ?

Both I and Keith have called attention to the fact that, that form of the OnCalculate() event handler, is not available on MQL4, only MQL5.

On MT4, you cannot use the "apply to" ability with custom indicators. You will have to make a separate indicator to do that internally by combining the indicator's calculations.

 
Fernando Carreiro #:

Both I and Keith have called attention to the fact that, that form of the OnCalculate() event handler, is not available on MQL4, only MQL5.

Effectively i Will follow it. Thanks guys

 
Inehamos gueye #:

Effectively i Will follow it. Thanks guys

Look up iMAOnArray in the documentation.