Activity_indic_1





//+------------------------------------------------------------------+
//|                                             Activity_indic_1.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Aqua
#property indicator_color4 Orange
#property indicator_color5 Brown
#property indicator_color6 SeaGreen
#property indicator_color7 Gray
//---- input parameters
extern int       ma_p1  = 8;
//extern int       Flt_Per= 3;
extern int       Candle_back = 2;
//extern int       Hystory= 120;
//---- buffers
double ExtMapBuffer1[]; // ht
double ExtMapBuffer2[]; // bl
double ExtMapBuffer3[]; // co
double ExtMapBuffer4[]; // hc
double ExtMapBuffer5[]; // lc
double ExtMapBuffer6[]; // ho
double ExtMapBuffer7[]; // lo
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,EMPTY,2);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE,EMPTY,2);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE,EMPTY,2);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_LINE,EMPTY,2);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(4,DRAW_LINE,EMPTY,2);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexStyle(5,DRAW_LINE,EMPTY,2);
   SetIndexBuffer(5,ExtMapBuffer6);
   SetIndexStyle(6,DRAW_LINE,EMPTY,2);
   SetIndexBuffer(6,ExtMapBuffer7);
//----

for ( int i = Bars - 1 ; i >= 0 ; i -- )
   {
       ExtMapBuffer1[i] = 0 ; // ht
       ExtMapBuffer2[i] = 0 ; // bl
       ExtMapBuffer3[i] = 0 ; // co
       ExtMapBuffer4[i] = 0 ; // hc
       ExtMapBuffer5[i] = 0 ; // lc
       ExtMapBuffer6[i] = 0 ; // ho
       ExtMapBuffer7[i] = 0 ; // lo
      
   }
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    i,j,k,limit,counted_bars=IndicatorCounted();
//----
   
   if ( ma_p1 < 1 ) ma_p1 = 1 ;

   if ( Candle_back < 1 ) Candle_back = 1 ;
   
   if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if (counted_bars>0) counted_bars--;

   limit = Bars - counted_bars;
   
   for ( i = limit ; i >= 0 ; i -- )
   {
       /*
       if ( Open[i+j] > Close[i+j] ) ExtMapBuffer1[i] = ( ExtMapBuffer1[i+1] * ma_p1 - (High[i+ma_p1] - Open[i+ma_p1])*Volume[i+ma_p1] + (High[i] - Open[i])*Volume[i] ) / ma_p1 ; // ht
       else  ExtMapBuffer1[i] = ( ExtMapBuffer1[i+1] * ma_p1 - (High[i+ma_p1] - Close[i+ma_p1])*Volume[i+ma_p1] + (High[i] - Close[i])*Volume[i] ) / ma_p1 ; // ht

       if ( Open[i+ma_p1] < Close[i+ma_p1] ) ExtMapBuffer2[i] = ( ExtMapBuffer2[i+1] * ma_p1 - (High[i+ma_p1] - Open[i+ma_p1])*Volume[i+ma_p1] + (High[i] - Open[i])*Volume[i] ) / ma_p1 ; // ht
       else  ExtMapBuffer2[i] = ( ExtMapBuffer2[i+1] * ma_p1 - (High[i+ma_p1] - Close[i+ma_p1])*Volume[i+ma_p1] + (High[i] - Close[i])*Volume[i] ) / ma_p1 ; // ht
       */
       int volvi = 0 ;
       int volvo = 0 ;
       for ( j = 0 ; j < Candle_back ; j ++ ) volvi += Volume[i+j] ;
       for ( j = 0 ; j < Candle_back ; j ++ ) volvo += Volume[i+ma_p1+j] ;
       
       ExtMapBuffer1[i] = 0 ; // ht
       ExtMapBuffer2[i] = 0 ; // bl
       ExtMapBuffer3[i] = ( ExtMapBuffer3[i+1] * ma_p1 - (Close[i+ma_p1] - Open[i+Candle_back+ma_p1])*volvo + (Close[i] - Open[i+Candle_back])*volvi ) / ma_p1 ; // co
       ExtMapBuffer4[i] = ( ExtMapBuffer4[i+1] * ma_p1 - (High[i+ma_p1] - Close[i+Candle_back+ma_p1])*volvo + (High[i] - Close[i+Candle_back])*volvi ) / ma_p1 ; // hc
       ExtMapBuffer5[i] = ( ExtMapBuffer5[i+1] * ma_p1 - (Low[i+ma_p1] - Close[i+Candle_back+ma_p1])*volvo + (Low[i] - Close[i+Candle_back])*volvi ) / ma_p1 ;  // lc
       ExtMapBuffer6[i] = 0 ; // ho
       ExtMapBuffer7[i] = 0 ; // lo
      
/*
   if ( i < limit - Flt_Per )
      for ( j = Flt_Per-1 ; j >= 0 ; j -- )
         {
         ExtMapBuffer1[i] += ExtMapBuffer1[i+j] / Flt_Per ;
         ExtMapBuffer2[i] += ExtMapBuffer2[i+j] / Flt_Per ;
         ExtMapBuffer3[i] += ExtMapBuffer3[i+j] / Flt_Per ;
         ExtMapBuffer4[i] += ExtMapBuffer4[i+j] / Flt_Per ;
         ExtMapBuffer5[i] += ExtMapBuffer5[i+j] / Flt_Per ;
         ExtMapBuffer6[i] += ExtMapBuffer6[i+j] / Flt_Per ;
         ExtMapBuffer7[i] += ExtMapBuffer7[i+j] / Flt_Per ;
         }
*/

   }


//----
   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

Series array that contains close prices for each bar
Series array that contains the highest prices of each bar
Series array that contains open prices of each bar
Series array that contains tick volumes of each bar
Series array that contains the lowest prices of each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: