EMA4hon





//+----------------------------------------------------------+
//|                                              EMA4hon.mq4 |
//|                                                 Makimoto |
//|                                                          |
//+----------------------------------------------------------+
#property copyright " Makimoto"
#property link      ""
//++++++++++++++++++++++++++++++++++++++++++++++++++

#property indicator_chart_window
#property indicator_buffers 6

#property indicator_color1 White      //EMA-1
#property indicator_color2 Turquoise  //EMA-2
#property indicator_color3 Yellow     //EMA-3
#property indicator_color4 Red        //EMA-4
#property indicator_color5 DodgerBlue        //
#property indicator_color6 Red      //


//üíÌÝè
#property indicator_style11 STYLE_SOLID
#property indicator_style12 STYLE_SOLID
#property indicator_style13 STYLE_SOLID
#property indicator_style14 STYLE_SOLID

//üÌA¾³
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 2
#property indicator_width6 2

//++++++++++++++++++++++++++++++++++++++++++++++++++

//wWobt@ÌÝè
double BufEMA_1[];     //EMA_1
double BufEMA_2[];     //EMA_2
double BufEMA_3[];     //EMA_3
double BufEMA_4[];     //EMA_4
double Bufbuyarrow[] ;   //¢îó233
double Bufsellarrow[] ;  //èîó234

//++++++++++++++++++++++++++++++++++++++++++++++++++
//p[^[ÌÝè
extern int MaMetod  = 1;  //MODE_EMA 1

extern int EMA_1 = 5;
extern int EMA_2 = 8;
extern int EMA_3 = 13;
extern int EMA_4 = 21;

//+(SignalSlide * Point);
extern int ARROW_onoff = 0 ;
extern int SignalSlide = 10; 
extern int Alert_onoff = 0 ;
extern int honsuu = 4 ; 

//++++++++++++++++++++++++++++++++++++++++++++++++++
int init()
{
   SetIndexBuffer(0,BufEMA_1); 
   SetIndexBuffer(1,BufEMA_2); 
   SetIndexBuffer(2,BufEMA_3); 
   SetIndexBuffer(3,BufEMA_4); 
   SetIndexBuffer(4,Bufbuyarrow); 
   SetIndexBuffer(5,Bufsellarrow); 

   SetIndexStyle(0,DRAW_LINE, STYLE_SOLID, 2, White);
   SetIndexStyle(1,DRAW_LINE, STYLE_SOLID, 2, Turquoise);
   SetIndexStyle(2,DRAW_LINE, STYLE_SOLID, 2, Yellow);
   SetIndexStyle(3,DRAW_LINE, STYLE_SOLID, 2, Red);

   SetIndexStyle(4, DRAW_ARROW, STYLE_SOLID, 2, DodgerBlue);
   SetIndexArrow(4,233);

   SetIndexStyle(5, DRAW_ARROW, STYLE_SOLID, 2, Red);
   SetIndexArrow(5,234);

//+-------------------------------------------
   SetIndexDrawBegin(0, 500 );
   SetIndexDrawBegin(1, 500 );
   SetIndexDrawBegin(2, 500 );
   SetIndexDrawBegin(3, 500 );
   SetIndexDrawBegin(4, 500 );
   SetIndexDrawBegin(5, 500 );

   return(0);
}
//++++++++++++++++++++++++++++++++++++++++++++++++++
int start()
{
	int counted_bar = IndicatorCounted(); 
	int limit = Bars-counted_bar;



   for(int i=limit-1; i>=0; i--)
   {
//+------------------+
if( honsuu == 4 )
{
//EMA4hon
  //EMA_1
	BufEMA_1[i] = iMA(NULL,0,EMA_1, 0,MaMetod,PRICE_CLOSE,i); 
  //EMA_2
	BufEMA_2[i] = iMA(NULL,0,EMA_2, 0,MaMetod,PRICE_CLOSE,i); 
  //EMA_3
	BufEMA_3[i] = iMA(NULL,0,EMA_3, 0,MaMetod,PRICE_CLOSE,i); 
  //EMA_4
	BufEMA_4[i] = iMA(NULL,0,EMA_4, 0,MaMetod,PRICE_CLOSE,i); 


//+--------------------------------------------------------+

      Bufbuyarrow[i] = EMPTY_VALUE;

	    if( (BufEMA_1[i+2] < BufEMA_4[i+2]) &&
          (BufEMA_1[i+1] > BufEMA_4[i+1]) )

      {//  if001
      if(ARROW_onoff == 1)
      Bufbuyarrow[i] = BufEMA_4[i] - (SignalSlide * Point) ;


           if((Alert_onoff == 1) &&  ( Volume[i] < 2 ) )
           {
           Alert(Symbol(),"EMA_4honBuy ", Symbol(), " at ", Ask);
           }
      }//  if001END


//+-------------------------------------------+
      Bufsellarrow[i] = EMPTY_VALUE;
	    if( (BufEMA_1[i+2] > BufEMA_4[i+2]) &&
          (BufEMA_1[i+1] < BufEMA_4[i+1]) )
      { //  if003
      if(ARROW_onoff == 1)
      Bufsellarrow[i] = BufEMA_4[i] + (SignalSlide * Point) ;

          if((Alert_onoff == 1) &&  ( Volume[i] < 2 ) )
          {
          Alert(Symbol(),"EMA_4honSell ", Symbol(), " at ", Bid);
          }
      }   //  if003END

}//if( honsuu == 4 )END
//+------------------+


//+------------------+
if( honsuu == 3 )
{
//EMA3hon
  //EMA_1
	BufEMA_1[i] = iMA(NULL,0,EMA_1, 0,MaMetod,PRICE_CLOSE,i); 
  //EMA_2
	BufEMA_2[i] = iMA(NULL,0,EMA_2, 0,MaMetod,PRICE_CLOSE,i); 
  //EMA_3
	BufEMA_3[i] = iMA(NULL,0,EMA_3, 0,MaMetod,PRICE_CLOSE,i); 
  //EMA_4
	//BufEMA_4[i] = iMA(NULL,0,EMA_4, 0,MaMetod,PRICE_CLOSE,i); 


//+--------------------------------------------------------+
      Bufbuyarrow[i] = EMPTY_VALUE;
	    if( (BufEMA_1[i+2] < BufEMA_3[i+2]) &&
          (BufEMA_1[i+1] > BufEMA_3[i+1]) )

      {//  if001
      if(ARROW_onoff == 1)
      Bufbuyarrow[i] = BufEMA_3[i] - (SignalSlide * Point) ;

           if((Alert_onoff == 1) &&  ( Volume[i] < 2 ) )
           {
           Alert(Symbol(),"EMA_3honBuy ", Symbol(), " at ", Ask);
           }
      }//  if001END


//+-------------------------------------------+
      Bufsellarrow[i] = EMPTY_VALUE;
	    if( (BufEMA_1[i+2] > BufEMA_3[i+2]) &&
          (BufEMA_1[i+1] < BufEMA_3[i+1]) )
      { //  if003
      if(ARROW_onoff == 1)
      Bufsellarrow[i] = BufEMA_3[i] + (SignalSlide * Point) ;

          if((Alert_onoff == 1) &&  ( Volume[i] < 2 ) )
          {
          Alert(Symbol(),"EMA_3honSell ", Symbol(), " at ", Bid);
          }
      }   //  if003END



}

 
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+


//+-------------------------------------------+
   }  //   for(int i=limit-1; i>=0; i--)END
//+-------------------------------------------+


//+-------------------------------------------+
   return(0);
}  //int start()END
//+------------------------------------------------------------------+


//++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++








Sample





Analysis



Market Information Used:

Series array that contains tick volumes of each bar


Indicator Curves created:


Implements a curve of type DRAW_LINE
Implements a curve of type DRAW_ARROW

Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen