//+------------------------------------------------------------------+
//|                                         MultiPairSinyal_v1_0.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
extern int Jendela = 0;
extern int Sisi = 0;
extern string BuySeLL_Settings1 = "--------------------------";
extern int TF1 = 60;
extern int TF2 = 30;
extern int TF3 = 15;
extern string BuySeLL_Settings2 = "--------------------------";
extern int MAFastPeriod = 2; 
extern int MAFastMethod = 3; 
extern int MAFastApply_To = 0;
extern int MAFastShift = 0;
extern string BuySeLL_Settings3 = "--------------------------";
extern int MASlowPeriod = 4; 
extern int MASlowMethod = 3;
extern int MASlowApply_To = 1;
extern int MASlowShift = 0;
extern string BuySeLL_Settings4 = "--------------------------";
extern color Cross_Buy  = Blue;
extern color Cross_Sell = Red;
extern string TextColor_Settings = "--------------------------";
extern color EU_Color = Lime;
extern color UJ_Color = Aqua;
extern color GU_Color = Gainsboro;
extern color EJ_Color = Lime;
extern color GJ_Color = Aqua;
//--------------------------------------------------------------------
string CrossUp  = "p"; // pakai font "Wingdings 3"
string CrossDn  = "q"; // pakai font "Wingdings 3"
//+------------------------------------------------------------------+
double vA, vB;
string BSstatus, BSstatus1, BSstatus2, BSstatus3, Panah;
color  BS_color;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   for(int i = ObjectsTotal() - 1; i >= 0; i--)
     {
       string label = ObjectName(i);
       if(StringSubstr(label, 0, 3) != "MPS")
           continue;
       ObjectDelete(label);   
     } 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   Write("MPS_01", Jendela, Sisi, 10, 14, "EURUSD", 9, "Arial", EU_Color);
   vA = iMA("EURUSD", TF3, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("EURUSD", TF3, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus3="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus3="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_02", Jendela, Sisi, 70, 16, Panah, 11, "Wingdings 3", BS_color);
   
   vA = iMA("EURUSD", TF2, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("EURUSD", TF2, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus2="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus2="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_03", Jendela, Sisi, 90, 16, Panah, 11, "Wingdings 3", BS_color);
   
   vA = iMA("EURUSD", TF1, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("EURUSD", TF1, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus1="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus1="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_04", Jendela, Sisi, 110, 16, Panah, 11, "Wingdings 3", BS_color);
   
   if (BSstatus1=="BUY" && BSstatus2=="BUY" && BSstatus3=="BUY") 
       {Write("MPS_05", Jendela, Sisi, 130, 14, "EURUSD = Open BUY", 9, "Arial", EU_Color);}
   else if (BSstatus1=="SELL" && BSstatus2=="SELL" && BSstatus3=="SELL") 
       {Write("MPS_05", Jendela, Sisi, 130, 14, "EURUSD = Open SELL", 9, "Arial", EU_Color);}
   else {Write("MPS_05", Jendela, Sisi, 130, 14, "EURUSD = NO TRADE, Please Wait !!!", 9, "Arial", EU_Color);}
//-------------------------------------------------------------------------------------   
   Write("MPS_06", Jendela, Sisi, 10, 28, "USDJPY", 9, "Arial", UJ_Color);
   vA = iMA("USDJPY", TF3, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("USDJPY", TF3, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus3="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus3="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_07", Jendela, Sisi, 70, 30, Panah, 11, "Wingdings 3", BS_color);
   
   vA = iMA("USDJPY", TF2, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("USDJPY", TF2, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus2="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus2="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_08", Jendela, Sisi, 90, 30, Panah, 11, "Wingdings 3", BS_color);
   
   vA = iMA("USDJPY", TF1, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("USDJPY", TF1, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus1="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus1="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_09", Jendela, Sisi, 110, 30, Panah, 11, "Wingdings 3", BS_color);
   
   if (BSstatus1=="BUY" && BSstatus2=="BUY" && BSstatus3=="BUY") 
       {Write("MPS_10", Jendela, Sisi, 130, 28, "USDJPY = Open BUY", 9, "Arial", UJ_Color);}
   else if (BSstatus1=="SELL" && BSstatus2=="SELL" && BSstatus3=="SELL") 
       {Write("MPS_10", Jendela, Sisi, 130, 28, "USDJPY = Open SELL", 9, "Arial", UJ_Color);}
   else {Write("MPS_10", Jendela, Sisi, 130, 28, "USDJPY = NO TRADE, Please Wait !!!", 9, "Arial", UJ_Color);}
//-------------------------------------------------------------------------------------
   Write("MPS_11", Jendela, Sisi, 10, 42, "GBPUSD", 9, "Arial", GU_Color);
   vA = iMA("GBPUSD", TF3, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("GBPUSD", TF3, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus3="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus3="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_12", Jendela, Sisi, 70, 44, Panah, 11, "Wingdings 3", BS_color);
   
   vA = iMA("GBPUSD", TF2, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("GBPUSD", TF2, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus2="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus2="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_13", Jendela, Sisi, 90, 44, Panah, 11, "Wingdings 3", BS_color);
   
   vA = iMA("GBPUSD", TF1, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("GBPUSD", TF1, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus1="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus1="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_14", Jendela, Sisi, 110, 44, Panah, 11, "Wingdings 3", BS_color);
   
   if (BSstatus1=="BUY" && BSstatus2=="BUY" && BSstatus3=="BUY") 
       {Write("MPS_15", Jendela, Sisi, 130, 42, "GBPUSD = Open BUY", 9, "Arial", GU_Color);}
   else if (BSstatus1=="SELL" && BSstatus2=="SELL" && BSstatus3=="SELL") 
       {Write("MPS_15", Jendela, Sisi, 130, 42, "GBPUSD = Open SELL", 9, "Arial", GU_Color);}
   else {Write("MPS_15", Jendela, Sisi, 130, 42, "GBPUSD = NO TRADE, Please Wait !!!", 9, "Arial", GU_Color);}
//-------------------------------------------------------------------------------------
   Write("MPS_16", Jendela, Sisi, 10, 56, "EURJPY", 9, "Arial", EJ_Color);
   vA = iMA("EURJPY", TF3, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("EURJPY", TF3, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus3="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus3="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_17", Jendela, Sisi, 70, 58, Panah, 11, "Wingdings 3", BS_color);
   
   vA = iMA("EURJPY", TF2, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("EURJPY", TF2, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus2="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus2="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_18", Jendela, Sisi, 90, 58, Panah, 11, "Wingdings 3", BS_color);
   
   vA = iMA("EURJPY", TF1, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("EURJPY", TF1, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus1="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus1="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_19", Jendela, Sisi, 110, 58, Panah, 11, "Wingdings 3", BS_color);
   
   if (BSstatus1=="BUY" && BSstatus2=="BUY" && BSstatus3=="BUY") 
       {Write("MPS_20", Jendela, Sisi, 130, 56, "EURJPY = Open BUY", 9, "Arial", EJ_Color);}
   else if (BSstatus1=="SELL" && BSstatus2=="SELL" && BSstatus3=="SELL") 
       {Write("MPS_20", Jendela, Sisi, 130, 56, "EURJPY = Open SELL", 9, "Arial", EJ_Color);}
   else {Write("MPS_20", Jendela, Sisi, 130, 56, "EURJPY = NO TRADE, Please Wait !!!", 9, "Arial", EJ_Color);}
//-------------------------------------------------------------------------------------
   Write("MPS_21", Jendela, Sisi, 10, 70, "GBPJPY", 9, "Arial", GJ_Color);
   vA = iMA("GBPJPY", TF3, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("GBPJPY", TF3, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus3="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus3="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_22", Jendela, Sisi, 70, 72, Panah, 11, "Wingdings 3", BS_color);
   
   vA = iMA("GBPJPY", TF2, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("GBPJPY", TF2, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus2="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus2="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_23", Jendela, Sisi, 90, 72, Panah, 11, "Wingdings 3", BS_color);
   
   vA = iMA("GBPJPY", TF1, MAFastPeriod, MAFastShift, MAFastMethod, MAFastApply_To, 0);
   vB = iMA("GBPJPY", TF1, MASlowPeriod, MASlowShift, MASlowMethod, MASlowApply_To, 0);
   if (vA>vB)
       { BSstatus1="BUY"; Panah=CrossUp; BS_color=Cross_Buy;}
   else { BSstatus1="SELL"; Panah=CrossDn; BS_color=Cross_Sell;}
   Write("MPS_24", Jendela, Sisi, 110, 72, Panah, 11, "Wingdings 3", BS_color);
   
   if (BSstatus1=="BUY" && BSstatus2=="BUY" && BSstatus3=="BUY") 
       {Write("MPS_25", Jendela, Sisi, 130, 70, "GBPJPY = Open BUY", 9, "Arial", GJ_Color);}
   else if (BSstatus1=="SELL" && BSstatus2=="SELL" && BSstatus3=="SELL") 
       {Write("MPS_25", Jendela, Sisi, 130, 70, "GBPJPY = Open SELL", 9, "Arial", GJ_Color);}
   else {Write("MPS_25", Jendela, Sisi, 130, 70, "GBPJPY = NO TRADE, Please Wait !!!", 9, "Arial", GJ_Color);}
//----
   return(0);
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
// Write Procedure
void Write(string LBL, int window, double side, int pos_x, int pos_y, string text, int fontsize, string fontname, color Tcolor=CLR_NONE)
     {
       ObjectCreate(LBL, OBJ_LABEL, window, 0, 0);
       ObjectSet(LBL, OBJPROP_CORNER, side);
       ObjectSet(LBL, OBJPROP_XDISTANCE, pos_x);
       ObjectSet(LBL, OBJPROP_YDISTANCE, pos_y);
       ObjectSetText(LBL,text, fontsize, fontname, Tcolor);
     }
     