RAQ

Moving Average of Any Indicator

Q:


I want to setup a Signal at the cross of two Moving averages, which are applied to a indicator’s data, like it is possible to do in mt4. I don’t want to apply the MA to price data (close, open, hight, low, …). I want to set the MA up with applied to first indicators data or previous…Is this with your EA software possible?


A:


Yes, these are both possible.  




VTS offers a CROSS_UP and CROSS_DOWN operator that you can applied to any function or set of values.


 



 


 




As you may know, MQL has a function to find the average of any set of values (or Array), named iMAOnArray.  The function itself is a bit complicated to use: first you collect the values of an indicator across a range of bars, then you save those values in an Array and call the iMAOnArray function on the array to find the average.


 


In VTS it’s very easy. After you drag and drop an indicator onto the pad, click on the “Power” Tab when configuring the indicator and check the “Get average value” check box.  That’s it.  (Note: This functionality requires the Power Plug-In: http://www.iexpertadvisor.com/mt4-power-plug-in-ea-builder/)


 


 


The below image finds the average value of the ATR indicator over the last 12 bars.  For those interested in the MQL, VTS generates this MQL code:


  double ar4109[12];
  for( int ii7248=0;ii7248<12;ii7248++)
        ar4109[ii7248]=iATR(  Symbol(), 0, 15, ii7248 );
  ArraySetAsSeries(ar4109, true );
  _iATR1 = iMAOnArray(ar4109,12, 1,  0, MODE_SMA, 1);