ma_3MA_separation_P





//http://www.kroufr.ru/forum/index.php/topic,7500.0.html#msg47579
//separation [quote =alexav link=topic=7500.msg47579#msg47579 date=1219499958]

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red

#property indicator_levelcolor MediumSlateBlue
#property indicator_levelstyle STYLE_DOT
#property indicator_level1 8
#property indicator_level2 -8
//#property indicator_minimum -20
//#property indicator_maximum 20

//---- buffers
extern int MAPeriod1=5;
extern int Mode1=1;
extern int Price1=0;

extern int MAPeriod2=11;
extern int Mode2=1;
extern int Price2=0;

extern int MAPeriod3=24;
extern int Mode3=1;
extern int Price3=0;

double IND1[];
double IND2[];

extern string note_MA_Mode  = "SMA0 EMA1 SMMA2 LWMA3";
extern string note_MA_Price = "0C 1O 2H 3L 4Md 5Tp 6WghC: Md(HL/2)4,Tp(HLC/3)5,Wgh(HLCC/4)6";

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorShortName("MA("+MAPeriod1+","+MAPeriod2+" / "+MAPeriod3+") Separation Points:");
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,IND1);
   
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,IND2);

   SetIndexLabel(0,"MA("+MAPeriod1+","+MAPeriod3+")SeP");
   SetIndexLabel(1,"MA("+MAPeriod2+","+MAPeriod3+")SeP:");
  
   //----

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



     for(int i=0; i<limit; i++)
       {
        IND1[i]=(iMA(NULL,0,MAPeriod1,0,Mode1,Price1,i)-iMA(NULL,0,MAPeriod3,0,Mode3,Price3,i))*1/Point;
        IND2[i]=(iMA(NULL,0,MAPeriod2,0,Mode2,Price2,i)-iMA(NULL,0,MAPeriod3,0,Mode3,Price3,i))*1/Point;

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



Sample





Analysis



Market Information Used:



Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: