Variable Index Dynamic Average VIDYA Indicator For MT5

Variable Index Dynamic Average VIDYA Indicator For MT5

The Variable Index Dynamic Average VIDYA Indicator For MT5 was developed by Tushan Chande and is an improved version of the Exponentional Moving Avearge indicator. The Vidya indicator has a dynamic period calculation. This means that instead of having a fixed period the indicator uses different periods according to the actual volatility in the market. This can make it more robust in the ever changing conditions of the financial markets.

FREE Variable Index Dynamic Average (VIDYA) Indicator

Download the FREE Variable Index Dynamic Average (VIDYA) 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 Variable Index Dynamic Average VIDYA 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 vidya.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 Variable Index Dynamic Average VIDYA Indicator For MT5

The Variable Index Dynamic Average VIDYA Indicator For MT5 has 3 parameters to configure.

input int                InpPeriodCMO=9;              // Period CMO
input int                InpPeriodEMA=12;             // Period EMA
input int                InpShift=0;                  // Indicator s shift

Buffers of the Variable Index Dynamic Average VIDYA Indicator For MT5

The Variable Index Dynamic Average VIDYA Indicator For MT5 provides 1 buffers.

SetIndexBuffer(0,VIDYA_Buffer,INDICATOR_DATA);

Main Parts Of The Code

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
//--- check for data
   if(rates_total lt InpPeriodEMA+InpPeriodCMO-1)
      return(0);
//---
   int limit;
   if(prev_calculated lt InpPeriodEMA+InpPeriodCMO-1)
     {
      limit=InpPeriodEMA+InpPeriodCMO-1;
      for(int i=0;i lt limit;i++)
         VIDYA_Buffer[i]=price[i];
     }
   else limit=prev_calculated-1;
//--- main cycle
   for(int i=limit;i lt rates_total && !IsStopped();i++)
     {
      //--- calculate CMO and get absolute value
      double mulCMO=fabs(CalculateCMO(i,InpPeriodCMO,price));
      //--- calculate VIDYA
      VIDYA_Buffer[i]=price[i]*ExtF*mulCMO+VIDYA_Buffer[i-1]*(1-ExtF*mulCMO);
     }
//--- OnCalculate done. Return new prev_calculated.
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| Chande Momentum Oscillator                                       |
//+------------------------------------------------------------------+
double CalculateCMO(int Position,const int PeriodCMO,const double &price[])
  {
   double resCMO=0.0;
   double UpSum=0.0,DownSum=0.0;
   if(Position gt =PeriodCMO && ArrayRange(price,0) gt Position)
     {
      for(int i=0;i lt PeriodCMO;i++)
        {
         double diff=price[Position-i]-price[Position-i-1];
         if(diff gt 0.0)
            UpSum+=diff;
         else
            DownSum+=(-diff);
        }
      if(UpSum+DownSum!=0.0)
         resCMO=(UpSum-DownSum)/(UpSum+DownSum);
     }
   return(resCMO);
  }
//+------------------------------------------------------------------+

 

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!