Variance Indicator For MT5

Variance Indicator For MT5

The Variance Indicator For MT5 measures the overall difference of the data set in comparison with the mean. When the data set is closely associated it becomes very critical to analyze the variables following the dispersed data.

This indicator focuses on the square root of the variance and solves the issue with an extreme level of precision. The naïve users of this indicator might not know how the variance data work. It works more like the ATR value calculator. This means the signal line will slowly gain bullish momentum when the market volatility becomes high.

On the contrary, it will go in parallel to the base of the window as long as the volatility of the market is low. Though it’s a very critical tool to use, after learning its use properly you can easily anticipate the sudden big change in the price. The smart users often relate the reading of this indicator with the key news as it improves your success rate to a great extent. But this should be used only to protect your capital from wild swings or catch the large moves. To improve your execution accuracy, you should focus on other variables.

FREE Variance Indicator

Download the FREE Variance 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 Variance 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 Variance (Welford).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 Variance Indicator For MT5

The Variance Indicator For MT5 has 1 parameters to configure.

input int inpVarPeriod = 14; // Variance period

Buffers of the Variance Indicator For MT5

The Variance Indicator For MT5 provides 1 buffers.

SetIndexBuffer(0,val ,INDICATOR_DATA);

Main Parts Of The Code

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
{                
   int i= prev_calculated-1; if (i lt 0) i=0; for (; i lt rates_total && !_StopFlag; i++) 
   { 
      val[i] = iVariance.calculate(close[i],i,rates_total); 
   }
   return(i);
}

//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//

class CVariance
{
   private :
         int    m_period;
         struct sVarStruct
         {
            double value;
         };
         sVarStruct m_array[];
         int        m_arraySize;
   public :
      CVariance() : m_period(1), m_arraySize(-1) { return; }
     ~CVariance()                                { return; }
     
     //
     //---
     //
     
     void init(int period)
         {
            m_period = (period gt 1) ? period : 1;
         }
      double calculate(double value, int i, int bars)
         {
            if (m_arraySize lt bars) { m_arraySize = ArrayResize(m_array,bars+500); if (m_arraySize lt bars) return(0); }
            
            //
            //
            //
            
            m_array[i].value = value;
            double _m=0,_s=0,_oldm=0;
            for (int k=0; k lt m_period && i gt =k; k++)
            {
               _oldm = _m;
               _m    = _m+(m_array[i-k].value-_m)/(1.0+k);
               _s    = _s+(m_array[i-k].value-_m)*(m_array[i-k].value-_oldm);
            }
            return(_s/(m_period-1));
         }   
};
CVariance iVariance;

 

About Me

I'm Mike Semlitsch the owner of PerfectTrendSystem.com. 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!