ExVlBars_v2





//+------------------------------------------------------------------+
//|                                                 ExVolBars_v2.mq4 |
//|                           Copyright © 2006, Alex Sidd (Executer) |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Alex Sidd (Executer)"
#property link      "mailto:work_st@mail.ru"
//----
#property indicator_separate_window
#property indicator_buffers 3
#property  indicator_color1  Black
#property  indicator_color2  Blue
#property  indicator_color3  Red
//---- input parameters
extern int ExPeriod = 6;
extern int Normalize = 3;
//---- buffers
double VolBuffer[];
double PosBuffer[];
double NegBuffer[];
double pos;
//+------------------------------------------------------------------+
//| initialization function                                          |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
   IndicatorBuffers(3);
   SetIndexStyle(0, DRAW_NONE);
   SetIndexBuffer(0, VolBuffer);
   SetIndexStyle(1, DRAW_HISTOGRAM);
   SetIndexBuffer(1, PosBuffer);
   SetIndexStyle(2, DRAW_HISTOGRAM);
   SetIndexBuffer(2, NegBuffer);
   SetIndexDrawBegin(0, ExPeriod);
   SetIndexDrawBegin(1, ExPeriod);
   SetIndexDrawBegin(2, ExPeriod);
//----
   SetIndexLabel(1, NULL);
   SetIndexLabel(2, NULL);
//----   
   short_name="ExVolBars(" + ExPeriod + ")";
   IndicatorShortName(short_name);
   SetIndexLabel(0, short_name);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Executer Vol Indicator                                           |
//+------------------------------------------------------------------+
int start()
  {
   int    i, counted_bars = IndicatorCounted();
   double negative = 0, positive = 0;
//----
   if(Bars <= ExPeriod) 
       return(0);
   if(counted_bars < 1)
       for(i = 1; i <= ExPeriod; i++) 
           VolBuffer[Bars-i] = 0.0;
//----
   i = Bars - ExPeriod - 1;
   if(counted_bars >= ExPeriod) 
       i = Bars -counted_bars - 1;
   while(i >= 0)
     {
       negative = 0;
       positive = 0;
       if(i < Bars - ExPeriod - 1)
         {
           int k = i + ExPeriod;
           while(k >= i)
             {
               if(Open[k] < Close[k]) 
                   positive += (Close[k] - Open[k]);
               if(Open[k] > Close[k]) 
                   negative += (Open[k] - Close[k]);
               if(Open[k] == Close[k]) 
                   {
                     negative += 0;
                     positive += 0;
                   }
               k--;
             }
         }
       double poss = 0;
       if(Normalize < 1) 
           Normalize = 1;
       if(Normalize > 1000) 
           Normalize = 1000;
       for(int j = 1; j != Normalize; j++)
         {
           poss += VolBuffer[i+j];     
         }
       pos = (poss + ((positive - negative)*3000)) / Normalize;
       if(VolBuffer[i+1] < pos) 
           PosBuffer[i] = pos;
       if(VolBuffer[i+1] > pos) 
           NegBuffer[i]=pos;
       VolBuffer[i]=pos;
       i--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

Series array that contains close prices for each bar
Series array that contains open prices of each bar


Indicator Curves created:

Implements a curve of type DRAW_NONE

Implements a curve of type DRAW_HISTOGRAM

Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: