Author: mladen
HVR test
Indicators Used
Standard Deviation indicator
0 Views
0 Downloads
0 Favorites
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);
}

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---