Geo_Impulse

Author: Copyright � 2011, Geokom
Price Data Components
Series array that contains open time of each barSeries array that contains close prices for each barSeries array that contains open prices of each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Geo_Impulse
//+------------------------------------------------------------------+
//|                                                 Geo_Impulse.mq4  |
//|                                         Copyright © 2007, Geokom |
//|                                             geokom2004@yandex.ru |
//+------------------------------------------------------------------+
//                      
//                      
// Geo_Impulse.mq4 -  Èíäèêàòîð äëÿ îòîáðàæåíèÿ çíà÷èìîãî áàðà
// Åñëè áàð îáíîâëÿåò High / Low è ñîîòâåòñòâóåò íàïðàâëåíèþ 
// 
//

#property copyright "Copyright © 2011, Geokom"
#property link      "geokom2004@yandex.ru"

#property indicator_separate_window
#property indicator_buffers 2

#property indicator_color1 Lime // 
#property indicator_width1 2
#property indicator_color2 Red // 
#property indicator_width2 2
/*
#property indicator_color3 Yellow // 
#property indicator_width3 2
#property indicator_color4 Red // 
#property indicator_width4 3

#property indicator_color5 Lime // 
#property indicator_width5 3
#property indicator_color6 Red // 
#property indicator_width6 3

#property indicator_color7 Lime // 
#property indicator_width7 2
#property indicator_color8 Red // 
#property indicator_width8 2
*/
#property indicator_maximum 1
#property indicator_minimum -1


extern   int     ObjectCorner=1;
extern   int     X_ObjectPosition = 30;
extern   int     Y_ObjectPosition = 20;


/*
extern int       MA_Period1=3;//ïåðèîäû ñðåäíèõ - áûñòðàÿ
extern int       MA_Period2=3;//ìåäëåííàÿ
extern int       MA_Mode1=3;// 0 = SMA, 1 = EMA, 2 = SMMA, 3 = LWMA
extern int       MA_Price1=0;// 0 = Close, 1 = Open, 2 = High, 3 = Low, 4 = HL/2, 5 = HLC/3, 6 = HLCC/4
extern int       MA_Mode2=3;// 0 = SMA, 1 = EMA, 2 = SMMA, 3 = LWMA
extern int       MA_Price2=1;// 0 = Close, 1 = Open, 2 = High, 3 = Low, 4 = HL/2, 5 = HLC/3, 6 = HLCC/4
extern int       MA_Shift1=0;
extern int       MA_Shift2=0;
extern int       fl=0;//

extern string    iName = "";//JMoving Avereges
extern int           MA_period_1 = 3; // ãëóáèíà  ïåðâîãî ñãëàæèâàíèÿ 
extern int           MA_method_1 = 0;  // ìåòîä óñðåäíåíèÿ
extern int           MA_period_2 = 4; // ãëóáèíà  ïåðâîãî ñãëàæèâàíèÿ 
extern int           MA_method_2 = 0;  // ìåòîä óñðåäíåíèÿ
extern int Input_Price_Customs_1 = 0;
extern int Input_Price_Customs_2 = 1;
*/

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
/*
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];
*/
double C,O,H,L,M3,N3,M4,N4;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexBuffer(1,ExtMapBuffer2);
/*  
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexBuffer(2,ExtMapBuffer3);
   
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,ExtMapBuffer4);
   
   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexStyle(5,DRAW_LINE);
   SetIndexBuffer(5,ExtMapBuffer6);
   
   SetIndexStyle(6,DRAW_LINE);
   SetIndexBuffer(6,ExtMapBuffer7);
   SetIndexStyle(7,DRAW_LINE);
   SetIndexBuffer(7,ExtMapBuffer8);
*/

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| âîçâðàùàåò ñèãíàë åñëè ñäâèíóò îáúåêò                            |

bool  isMovedObject(string ObjName,bool Draw,int ObjCod,int ObjectSize,int dX,int dY,color InitObjColor)
  {

   if((!Draw)) // Åñëè êîä = 0 - óäàëÿåì îáúåêò

     {
      if(ObjectFind(ObjName)==0)
        {ObjectDelete(ObjName);}
      return(False);
     }

   bool X = False;
   bool Y = False;

   if(ObjectFind(ObjName)==-1)

     {
      ObjectCreate(ObjName,OBJ_LABEL,0,0,0);
      ObjectSetText(ObjName,CharToStr(ObjCod),ObjectSize,"Wingdings",InitObjColor);
      ObjectSet(ObjName,OBJPROP_CORNER,ObjectCorner);
      ObjectSet(ObjName,OBJPROP_XDISTANCE,X_ObjectPosition+dX);
      ObjectSet(ObjName,OBJPROP_YDISTANCE,Y_ObjectPosition+dY);
     }

   if(ObjectFind(ObjName)==0)

     {
      ObjectSet(ObjName,OBJPROP_CORNER,1);
      ObjectSetText(ObjName,CharToStr(ObjCod),ObjectSize,"Wingdings",InitObjColor);

      if(ObjectGet(ObjName,OBJPROP_XDISTANCE) != X_ObjectPosition+dX) {ObjectSet(ObjName,OBJPROP_XDISTANCE,X_ObjectPosition+dX);   }
      if(ObjectGet(ObjName,OBJPROP_YDISTANCE) != Y_ObjectPosition+dY) {ObjectSet(ObjName,OBJPROP_YDISTANCE,Y_ObjectPosition+dY);   }


     }

   return(False);

  }
//| âîçâðàùàåò ñèãíàë åñëè ñäâèíóò îáúåêò                            |
//+------------------------------------------------------------------+  


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   if(counted_bars==0) limit-=1+2;

   for(int i=0; i<limit; i++)
     {
/* âû÷èñëåíèÿ */
      C =  Close[i];
      O =  Open[i];
      H =  High[i];
      L =  Low[i];

      ExtMapBuffer1[i] = 0;
      ExtMapBuffer2[i] = 0;

      if(TimeDayOfWeek(iTime(NULL,PERIOD_D1,i+1))!=0)
        {
/*    
    if (C>O && H>High[i+1] && L >= Low[i+1]){ ExtMapBuffer1[i] = 1;ExtMapBuffer2[i] = 0;}
    if (C<O && L<Low[i+1] && H <=High[i+1] ){ ExtMapBuffer2[i] = -1;ExtMapBuffer1[i] = 0;}
*/
         if(C>O && H>High[i+1] ){ ExtMapBuffer1[i] = 1;ExtMapBuffer2[i] = 0;}
         if(C<O && L<Low[i+1]  ){ ExtMapBuffer2[i] = -1;ExtMapBuffer1[i] = 0;}
        }

      if(TimeDayOfWeek(iTime(NULL,PERIOD_D1,i+1))==0)
        {
/*    
    if (C>O && H>MathMax( High[i+1], High[i+2] ) && L >= MathMin ( Low[i+1],Low[i+2] ) ){ ExtMapBuffer1[i] = 1;ExtMapBuffer2[i] = 0;}
    if (C<O && L<MathMin ( Low[i+1],Low[i+2] ) && H<= MathMax( High[i+1], High[i+2] )  ){ ExtMapBuffer2[i] = -1;ExtMapBuffer1[i] = 0;}
*/
         if(C>O && H>MathMax( High[i+1], High[i+2] ) ){ ExtMapBuffer1[i] = 1;ExtMapBuffer2[i] = 0;}
         if(C<O && L<MathMin ( Low[i+1],Low[i+2] )   ){ ExtMapBuffer2[i] = -1;ExtMapBuffer1[i] = 0;}


        }
     }

   ArrayResize(ExtMapBuffer3,5);
   ArrayResize(ExtMapBuffer4,5);

   for(int j=4;j>=0;j--)
     {
      double    C =  iClose(NULL, PERIOD_D1,j);
      double    O =  iOpen(NULL, PERIOD_D1,j);
      double    H =  iHigh(NULL, PERIOD_D1,j);
      double    L =  iLow(NULL, PERIOD_D1,j);

      ExtMapBuffer3[j] = 0;
      ExtMapBuffer4[j] = 0;
      //                  color TodayColor = LightGray;
      color TodayColor=Gray;

      if(TimeDayOfWeek(iTime(NULL,PERIOD_D1,j+1))!=0)
        {
         if(C>O && H>iHigh(NULL,PERIOD_D1,j+1))
           {
            ExtMapBuffer3[j]=1;ExtMapBuffer4[j]=0;  TodayColor=Blue;
           }
         if(C<O && L<iLow(NULL,PERIOD_D1,j+1))
           {
            ExtMapBuffer4[j]=-1;ExtMapBuffer3[j]=0; TodayColor=Red;
           }
        }

      if(TimeDayOfWeek(iTime(NULL,PERIOD_D1,j+1))==0)
        {
         if(C>O && H>MathMax(iHigh(NULL,PERIOD_D1,j+1),iHigh(NULL,PERIOD_D1,j+2)))
           {
            ExtMapBuffer3[j]=1;ExtMapBuffer4[j]=0; TodayColor=Blue;
           }
         if(C<O && L<MathMin(iLow(NULL,PERIOD_D1,j+1),iLow(NULL,PERIOD_D1,j+2)))
           {
            ExtMapBuffer4[j]=-1;ExtMapBuffer3[j]=0;TodayColor=Red;
           }
        }

      isMovedObject("Day"+j,True,171,12,100+j*10,-15,TodayColor);
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments