ma_hl_sw





//+------------------------------------------------------------------+
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
//2009fxtsd
#property copyright ""
#property link      ""

#property indicator_separate_window
#property indicator_buffers    4
#property indicator_color1     Blue
#property indicator_color2     Red

#property indicator_color3     Blue
#property indicator_color4     Red

#property indicator_width1     1

#property indicator_minimum    1
#property indicator_maximum    9

//

extern int maperiod1      = 5;
extern int maperiod2      = 34;

extern int mamethod        = 1;
extern int maprice         = 0;

extern double  barlevel     = 2.5;


double buffer1[];
double buffer2[];
double buffer3[];
double buffer4[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

int init()
{
      IndicatorBuffers(4); 

   
   SetIndexBuffer(0,buffer1);
   SetIndexBuffer(1,buffer2);

   SetIndexBuffer(2,buffer3);
   SetIndexBuffer(3,buffer4);

    SetIndexStyle(2,DRAW_ARROW);
    SetIndexArrow(2,108);
    SetIndexEmptyValue(2,EMPTY_VALUE);

    SetIndexStyle(3,DRAW_ARROW);
    SetIndexArrow(3,108);
    SetIndexEmptyValue(3,EMPTY_VALUE);


   IndicatorShortName("ma hl " +maperiod1+","+maperiod2);  
//   SetIndexLabel(0,"Sto");



   return(0);
}
int deinit()
{
   return(0);
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+



int start()
{
   int counted_bars=IndicatorCounted();
   int limit,i;
   
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
           limit=Bars-counted_bars;


   for(i=limit; i>=0; i--)
   {

     double ma1h = iMA(NULL, 0, maperiod1, 0,mamethod, 2, i); 
     double ma1l = iMA(NULL, 0, maperiod1, 0,mamethod, 3, i); 

 
     double ma2h = iMA(NULL, 0, maperiod2, 0,mamethod, 2, i); 
     double ma2l = iMA(NULL, 0, maperiod2, 0,mamethod, 3, i); 
   
   

      buffer1[i] =EMPTY_VALUE;   buffer2[i] =EMPTY_VALUE;
      buffer3[i] =EMPTY_VALUE;   buffer4[i] =EMPTY_VALUE;


   if (ma1h>ma2h && ma1l>ma2l)
      { buffer1[i] =barlevel; if (buffer1[i+1]==EMPTY_VALUE) buffer3[i] =barlevel;
         }

   if (ma1l<ma2l && ma1h<ma2h)
      { buffer2[i] =barlevel; if (buffer2[i+1]==EMPTY_VALUE)  buffer4[i] =barlevel;
         }

  }
   
   return(0);
}






Sample





Analysis



Market Information Used:



Indicator Curves created:


Implements a curve of type DRAW_ARROW

Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: