xpVolume
Price Data Components
Series array that contains tick volumes of each bar
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
xpVolume
//Version: 1
//Time: November 30, 2006
//+------------------------------------------------------------------+
//|                              xpVolume                            | 
//|                                                     xpVolume.mq4 |
//|                                         Developed by Coders Guru |
//|                                            http://www.xpworx.com |
//+------------------------------------------------------------------+

#property link      "http://www.xpworx.com"


#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
#property indicator_maximum  1
#property indicator_minimum -1


 
extern   int      MA_Period_1               = 6;
extern   int      MA_Period_2               = 24;
extern   int      MA_Type_1                 = MODE_SMA;
extern   int      MA_Type_2                 = MODE_SMA;

double UpBuffer[];
double Vol[];

int init()
{
   IndicatorBuffers(2); 

   SetIndexStyle(0,DRAW_HISTOGRAM, STYLE_SOLID,2);
   SetIndexBuffer(0,UpBuffer);
   SetIndexBuffer(1,Vol);
   return(0);
}

int deinit()
{
   return(0);
}



void start()
{
   int limit;
   double ma_1,ma_2;
   
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   limit=Bars-counted_bars-1;
   

   for(int shift=0; shift<limit; shift++)
       Vol[shift] = iVolume(NULL,0,shift);

   for(shift=0; shift<limit; shift++)
   {       
      ma_1 = iMAOnArray(Vol,0,MA_Period_1,0,MA_Type_1,shift);
      ma_2 = iMAOnArray(Vol,0,MA_Period_2,0,MA_Type_2,shift);
       
       if(ma_1-ma_2>=10)
       { 
         UpBuffer[shift] = 1 ;
       }
       else
       { 
         UpBuffer[shift] = -1 ;
       }
   }                   

   

   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 ---