Articles by: David Williams

EA with indicator OSMA


Q:


I am trying to build an EA with indicator OSMA 12,26,9 with level 0 as pictured below (blue indicator),


I cannot see anywhere in the indicator configure where the level input is and also in the logic configure


Where I can tell it to be above or below level 0.


A:


This can be done in 3 stesp. Note: the levels that you see on the chart are not really needed by the EA, we are simple going to chech if the value of the OSMA is greater than zero.


1. Drag and drop the iOsMA indicator from the Toolbox (Functions->Indicators->iOsMA). (You can do this on any drawing, I am using the OpenBuyTrade drawing)



 2. Click the (+) button to configure the OSMA withh12,26,9



 3. Configure the Logic element by clicking the (+) button. Set the condition as _iOsMA1 GREATER_THAN 0.0


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);


 


 



 

RAQ