HVR test





//+------------------------------------------------------------------+
//|                            Historical Volatility ratio indicator |
//|                                                          HVR.mq4 |
//|                                                           mladen |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link      ""

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
#property indicator_minimum 0

//
//
//
//
//

extern int ShortPeriod   =   6;
extern int LongPeriod    = 100;
extern int AverageMethod =   0;

//
//
//
//
//

double   HvrValue[];
double   LogValue[];


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

int init()
{
   IndicatorBuffers(2);
   SetIndexBuffer(0,HvrValue);
   SetIndexBuffer(1,LogValue);
   
   //
   //
   //
   //
   //
   
   IndicatorShortName("HVR ("+ShortPeriod+","+LongPeriod+")");
   return(0);
}
int deinit()
{
   return(0);
}


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

int start()
{
   double dev;
   double Short;
   double Long;
   int    counted_bars=IndicatorCounted();
   int    limit,i,k;


   if(counted_bars < 0) return(-1);
   limit = Bars-counted_bars;

   //
   //
   //
   //
   //
   
         
   for (i = limit; i>=0; i--) {
                        Short=iStdDev(NULL,0, 60,0, MODE_EMA, PRICE_CLOSE,i);
                        Long=iStdDev(NULL,0, 100,0, MODE_EMA, PRICE_CLOSE,i);
                         HvrValue[i]=Short/Long;
                  LogValue[i]=HvrValue[i];

   }
   return(0);
}





Sample





Analysis



Market Information Used:



Indicator Curves created:



Indicators Used:

Standard Deviation indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: