Indicators Used
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 Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---