Variation Indicator For MT5

Variation Indicator For MT5

The Variation Indicator For MT5 is a trend indicator that come in three variants.

The three variants of the Variation Indicator For MT5 comes as different MQL5 files which must be placed into the MQL5Indicator folder for the trader to be able to use them.

The variants are:

• Variation.mq5

• ColorVariation.mq5

• ColorJVariation.mq5

Each of the three indicators is plotted on a separate indicator chart.

The Variation.mq5 plots a pink colored oscillating line that oscillates about a 0 centerline. Depending on which side of the centerline the oscillating line is, a trader can be able to identify the trend in the market. If the oscillating line is above the centerline, it shows that there is a bullish trend. If the oscillating line is below the centerline, it shows that there is a bearish trend.

The ColorVariation.mq5 is an improved version of the Variation.mq5 and it plots an oscillating line whose color changes from green to red and vice versa depending on the market trend. This indicator makes it easier for the trader to open and close trades since it shows when the trend changes instead of waiting for the line to cross the centerline. When the color of the oscillating line turns green, it shows that there is a bullish trend. When the oscillating line turns red, it shows that there is a bearish trend.

The ColorJVariation.mq5 is an improved version of the ColorVariation.mq5 that uses the ?JJMA class of SmoothAlgorithms.mqh library to eliminate false signals and make the oscillating line smooth.

FREE Variation Indicator

Download the FREE Variation Indicator for MT5.

To receive my email 100% sure: 
Put my email on your whitelist!


Partially Automated Trading Besides Your Day Job

Alerts In Real-Time When Divergences Occur

My Recommended MT4/MT5 Broker


Installing the Variation Indicator For MT5

After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file colorjvariation.mq5 into the folder MQL5\Indicators of your MT5 installation. After that please restart MT5 and then you will be able to see the indicator in the list of indicators.

Parameters of the Variation Indicator For MT5

The Variation Indicator For MT5 has 5 parameters to configure.

input int Period_=12; //period of averaging
input ENUM_MA_METHOD MA_Method_=MODE_SMA; //method of averaging
input int JLength_=3; // depth of JMA smoothing
input int JPhase_=100; // parameter of the JMA smoothing,
input int Shift=0; // horizontal shift of the indicator in bars

Buffers of the Variation Indicator For MT5

The Variation Indicator For MT5 provides 2 buffers.


Main Parts Of The Code

int OnCalculate
 const int rates_total,// number of bars in history at the current tick
 const int prev_calculated,// amount of history in bars at the previous tick
 const int begin,// number of beginning of reliable counting of bars
 const double &price[]// price array for calculation of the indicator
//---- Checking if the number of bars is sufficient for the calculation
   if(rates_total lt min_rates_total+begin) return(0);

//---- Declaration of integer variables
   int first1,first2=0,bar;
//---- declaration of variables with a floating point  
   double ma1,ma2,ma3,jma3;
//---- Declaration of static variables
   static int start1,start2,start3,start4;

//---- Initialization of the indicator in the OnCalculate() block
   if(prev_calculated gt rates_total || prev_calculated lt =0)// checking for the first start of the indicator calculation
      first1=begin; // starting number for calculation of all bars
      //---- Initialization of variables of the start of data calculation
         start2 = start1 + Period_;
         start3 = start2 + Period_;
         start4 = start3 + Period_;
         first2 = start4 + 30 + 2;
         start2 = start1 + 30;
         start3 = start2 + 30;
         start4 = start3 + 30;
         first2 = start4 + 30 + 2;
      //--- increase the position of the data start by  begin  bars as a result of the calculation using data of another indicator
      if(begin gt 0) PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,first2);
      first1=prev_calculated-1; // starting index for calculation of new bars

//---- declaration of the Moving_Average class variables from the SmoothAlgorithms.mqh file
   static CMoving_Average MA1,MA2,MA3;
//---- declaration of the JJMA class variables from the SmoothAlgorithms.mqh file
   static CJJMA JMA;

//---- Main calculation loop of the indicator
   for(bar=first1; bar lt rates_total; bar++)
      //---- Three call of the function MASeries.  
      ma1 = MA1.MASeries(start1, prev_calculated, rates_total, Period_, MA_Method_, price[bar], bar, false);
      ma2 = MA2.MASeries(start2, prev_calculated, rates_total, Period_, MA_Method_, price[bar]-ma1, bar, false);
      ma3 = MA3.MASeries(start3, prev_calculated, rates_total, Period_, MA_Method_, price[bar]-ma2-ma1, bar, false);
      //---- One call of the JJMASeries function. 
      //The parameters Phase and Length don t change at every bar (Din = 0) 
//---- Main indicator line coloring loop
   for(bar=first2; bar lt rates_total; bar++)
      if(LineBuffer[bar] gt LineBuffer[bar-1]) ColorLineBuffer[bar]=1;
      if(LineBuffer[bar] lt LineBuffer[bar-1]) ColorLineBuffer[bar]=2;


About Me

I'm Mike Semlitsch the owner of My trading career started in 2007. Since 2013 I have helped thousands of traders to take their trading to the next level. Many of them are now constantly profitable traders. 

The following performance was achieved by me while trading live in front of hundreds of my clients:

Connect With Me:  

This FREE Indicator Can Transform
Your Trading!

FREE Indicator + Telegram Group

Request the Ultimate Double Top/Bottom Indicator which is used by 10,000+ traders.

Results From 5 Months!
This service starts soon! Be the first who get's notified when it begins!