Price Data Components
Miscellaneous
0
Views
0
Downloads
0
Favorites
VSA_Histogram
//+------------------------------------------------------------------+
//| VSA HISTOGRAM.mq4 |
//| Copyright (c) 2009, FOREXflash. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright (c) 2009, FOREXflash Software"
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Orange
extern int TimeFrame=0;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
datetime timeh = 0,timel = 0, timeo = 0, timec = 0, once = 0;
double Mult = 1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
if ( Digits == 5 || Digits == 3 )
Mult = 10;
switch(TimeFrame)
{
case 1 : string TimeFrameStr="Period_M1"; break;
case 5 : TimeFrameStr="Period_M5"; break;
case 15 : TimeFrameStr="Period_M15"; break;
case 30 : TimeFrameStr="Period_M30"; break;
case 60 : TimeFrameStr="Period_H1"; break;
case 240 : TimeFrameStr="Period_H4"; break;
case 1440 : TimeFrameStr="Period_D1"; break;
case 10080 : TimeFrameStr="Period_W1"; break;
case 43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr=" MTF";
}
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_HISTOGRAM, STYLE_SOLID, 3);
SetIndexDrawBegin(0,3);
SetIndexLabel(0,TimeFrameStr+" H\L:");
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(1,DRAW_HISTOGRAM, STYLE_SOLID, 3);
SetIndexDrawBegin(1,3);
SetIndexLabel(1,TimeFrameStr+" H\C:");
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(2,DRAW_HISTOGRAM, STYLE_SOLID, 3);
SetIndexDrawBegin(2,3);
SetIndexLabel(2,TimeFrameStr+" SPREAD:");
IndicatorShortName("VSA HISTOGRAM"+TimeFrameStr);
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
Comment("");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,shift,limit,y=0,counted_bars=IndicatorCounted();
string on;
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit=Bars-counted_bars+TimeFrame/Period();
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
ExtMapBuffer1[i] = EMPTY_VALUE; ExtMapBuffer2[i] = EMPTY_VALUE; ExtMapBuffer3[i] = EMPTY_VALUE;
ExtMapBuffer1[i] = iHigh(NULL,TimeFrame,y)-iLow(NULL,TimeFrame,y);
{
}
ExtMapBuffer2[i] = iHigh(NULL,TimeFrame,y)-iClose(NULL,TimeFrame,y);
{
}
ExtMapBuffer3[i] = (iHigh(NULL,TimeFrame,y)-iLow(NULL,TimeFrame,y))-(iHigh(NULL,TimeFrame,y)-iClose(NULL,TimeFrame,y));
{
}
}
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
---