synchronize





//+------------------------------------------------------------------+
//|                                                          |
//|                                                     |
//|                                             |
//+------------------------------------------------------------------+
#property copyright "Senlin Ge 20081013"
#property link      "http://new.qzone.qq.com/806935610"

#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Yellow
#property indicator_color4 0Xff66ff
#property indicator_color5 0Xffcc00
#property indicator_color6 0X00cc00
//#property indicator_color2 Red
double buffer1[];
double buffer2[];
double buffer3[];
double buffer4[];
double buffer5[];
double buffer6[];
double BufferCorrel[];
extern int   barsToProcess=10000;
extern string symbol1="GBPJPY";
extern string symbol2="EURJPY";
extern string symbol3="USDJPY";
int timeframe=0;
string short_name;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
    //---- name for DataWindow and indicator subwindow label

   short_name="Synchronize("+symbol1+" ,"+symbol2+" ,"+symbol3+")"+" E_MAIL:yyy999@people.com.cn";
   IndicatorShortName(short_name);
  
//---- indicators
  SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Lime);
  SetIndexBuffer(0,buffer1);
  SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,Red);
  SetIndexBuffer(1,buffer2);
  SetIndexStyle(2,DRAW_NONE,STYLE_SOLID,1,Yellow);
  SetIndexBuffer(2,buffer3);
  SetIndexStyle(3,DRAW_NONE,STYLE_SOLID,1,0Xff66ff);
  SetIndexBuffer(3,buffer4);
  SetIndexStyle(4,DRAW_NONE,STYLE_SOLID,1,0Xffcc00);
  SetIndexBuffer(4,buffer5);
  SetIndexStyle(5,DRAW_LINE,STYLE_SOLID,1,0Xccff00);
  SetIndexBuffer(5,buffer6);
  SetIndexStyle(6,DRAW_NONE,STYLE_SOLID,1,0X00cc00);
  SetIndexBuffer(6,BufferCorrel);
//----
   SetIndexLabel(2,symbol1);
   SetIndexLabel(3,symbol2);
   SetIndexLabel(4,symbol3);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted(),
//----
   limit;
   int i=0; 
   if(counted_bars>0)
      counted_bars--;
   
   limit=Bars-counted_bars;
   
   if(limit>barsToProcess)
      limit=barsToProcess;

   while (i<limit)
   {
   
   //double k=(Open[i]-Close[i+1])/Point;
 //  if (k>0)
  //  buffer1[i]= k;
 //  if (k<0)
 //   buffer2[i]= k;
    //----------------------------------------------------------------
       buffer3[i]=iClose(symbol1,timeframe,i)-iClose(symbol1,timeframe,i+1);
       buffer4[i]=iClose(symbol2,timeframe,i)-iClose(symbol2,timeframe,i+1);
       buffer5[i]=iClose(symbol3,timeframe,i)-iClose(symbol3,timeframe,i+1);
       i++;
    
   }    
   //-------------------------------------------------------------------------
   i=0;
   while (i<limit)
   {
      //----------------------------------------------------------------
         buffer1[i]=iMAOnArray(buffer3,0,9,0,MODE_LWMA,i);
         buffer2[i]=iMAOnArray(buffer4,0,9,0,MODE_LWMA,i);
         buffer6[i]=iMAOnArray(buffer5,0,9,0,MODE_LWMA,i);
         i++;
    
   }    
//----
//----
   return(0);
  }
//+------------------------------------------------------------------+
//--------------------------------------------------------------------------------------------------------------`





Sample





Analysis



Market Information Used:

Series array that contains close prices for each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE

Implements a curve of type DRAW_NONE

Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: