volatility indicator

 

 Dear

 I had added a file of volatility indicator. please anyone add this file to our code base, to utilise thanking you

//+------------------------------------------------------------------+

//|                                                   Volatility.mq4 |
//|                                       Copyright © 2007, Eva Ruft |
//|                                                briz18@rambler.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, Eva Ruft"
#property link      "briz18@rambler.ru"

#property indicator_separate_window
#property indicator_buffers 1
//---- input parameters
extern int VolatilityPeriod=5;
//---- indicator buffers
double MainBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetLevelValue(0,50);
   SetLevelStyle(0,1,Black);
   SetLevelValue(1,100);
   SetLevelStyle(0,0,Black);
   SetLevelValue(2,200);
   SetLevelStyle(0,0,Black);
   SetLevelValue(3,300);
   SetLevelStyle(0,0,Black);
   SetLevelValue(4,400);
   SetLevelStyle(0,0,Black);
   SetIndexStyle(0,DRAW_LINE,0,2,SteelBlue);
   SetIndexBuffer(0, MainBuffer);
   SetIndexDrawBegin(0,VolatilityPeriod);
   IndicatorDigits(Digits+2);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("Volatility("+VolatilityPeriod+")");
   SetIndexLabel(0,"Volatility");
//---- initialization done
   return(0);
  }

//+------------------------------------------------------------------+
//|Volatility                                                        |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- Volatility counted
   for(int i=0; i<limit; i++)
      MainBuffer[i]=(iMA(NULL,0,VolatilityPeriod,0,MODE_SMA,PRICE_HIGH,i)-iMA(NULL,0,VolatilityPeriod,0,MODE_SMA,PRICE_LOW,i))*100;
//----
   return(0);
  }
//+------------------------------------------------------------------+

Files:
 
Please, properly insert code.
MQL5.community - User Memo
  • 2010.02.25
  • MetaQuotes Software Corp.
  • www.mql5.com
You have just registered and most likely you have questions such as, "How do I insert a picture to my a message?" "How do I format my MQL5 source code?" "Where are my personal messages kept?" You may have many other questions. In this article, we have prepared some hands-on tips that will help you get accustomed in MQL5.community and take full advantage of its available features.
 

It isn't MQL5 indicator. It is MQL4.

You better publish them on MQL4 site.

 
This indicator is already published https://www.mql5.com/en/code/8049.