//+------------------------------------------------------------------+
//|                                                 RapidFire.mq4    |
//|                               Copyright © 2006, Taylor Stockwell |
//|                                               stockwet@yahoo.com |
//|                                                                  |
//+------------------------------------------------------------------+
//|                                              5th Dec 2012        |
//|                                                                  |
//|                                       Code fixes by RaptorUK     |
//|                                                                  |
//|   Fixed copy paste errors,  if(S1_Buy==1) etc.                   |
//|   Replaced NULLs with correct values                             |
//|   Added error cheecking and reporting                            |
//|                                                                  |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Taylor Stockwell"
#property link      "stockwet@yahoo.com"

#property show_inputs
extern string Symbol_1 = "EURUSD";
extern bool S1_Buy = true;
extern double S1_Lots = 1.0;
extern string Symbol_2 = "GBPUSD";
extern bool S2_Buy = true;
extern double S2_Lots = 1.0;
extern string Symbol_3 = "USDCHF";
extern bool S3_Buy = true;
extern double S3_Lots = 1.0;
extern string Symbol_4 = "USDJPY";
extern bool S4_Buy = true;
extern double S4_Lots = 1.0;
extern string Symbol_5 = "USDCAD";
extern bool S5_Buy = true;
extern double S5_Lots = 1.0;
extern string Symbol_6 = "AUDUSD";
extern bool S6_Buy = true;
extern double S6_Lots = 1.0;
extern string Symbol_7 = "EURGBP";
extern bool S7_Buy = true;
extern double S7_Lots = 1.0;

int magic=9502;
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {

   if(S1_Lots > 0)
      {
      if(S1_Buy)
         {
         if(OrderSend(Symbol_1,OP_BUY, S1_Lots, MarketInfo(Symbol_1,MODE_ASK), 2, 0.0, 0.0, "RapidFire", magic, 0, LimeGreen) < 0)
            Print("OrderSend(", Symbol_1, " ,OP_BUY failed, error# ", GetLastError());
         }
      else
         {
         if(OrderSend(Symbol_1,OP_SELL, S1_Lots, MarketInfo(Symbol_1,MODE_BID), 2, 0.0, 0.0, "RapidFire", magic, 0, FireBrick) < 0)
               Print("OrderSend(", Symbol_1, ", OP_SELL failed, error# ", GetLastError());
         }
      }

   if(S2_Lots > 0)
      {
      if(S2_Buy)
         {
         if(OrderSend(Symbol_2,OP_BUY, S2_Lots, MarketInfo(Symbol_2,MODE_ASK), 2, 0.0, 0.0, "RapidFire", magic, 0, LimeGreen) < 0)
            Print("OrderSend(", Symbol_2, ", OP_BUY failed, error# ", GetLastError());   
         }
      else
         {
         if(OrderSend(Symbol_2,OP_SELL, S2_Lots, MarketInfo(Symbol_2,MODE_BID), 2, 0.0, 0.0, "RapidFire", magic, 0, FireBrick) < 0)
            Print("OrderSend(", Symbol_2, ", OP_SELL failed, error# ", GetLastError());
         }
      }

   if(S3_Lots > 0)
      {
      if(S3_Buy)
         {
         if(OrderSend(Symbol_3,OP_BUY, S3_Lots, MarketInfo(Symbol_3,MODE_ASK), 2, 0.0, 0.0, "RapidFire", magic, 0, LimeGreen) < 0)
            Print("OrderSend(", Symbol_3, ", OP_BUY failed, error# ", GetLastError());   
         }
      else
         {
         if(OrderSend(Symbol_3,OP_SELL, S3_Lots, MarketInfo(Symbol_3,MODE_BID), 2, 0.0, 0.0, "RapidFire", magic, 0, FireBrick) < 0)
            Print("OrderSend(", Symbol_3, ", OP_SELL failed, error# ", GetLastError());
         }
      }

   if(S4_Lots > 0)
      {
      if(S4_Buy)
         {
         if(OrderSend(Symbol_4,OP_BUY, S4_Lots, MarketInfo(Symbol_4,MODE_ASK), 2, 0.0, 0.0, "RapidFire", magic, 0, LimeGreen) < 0)
            Print("OrderSend(", Symbol_4, ", OP_BUY failed, error# ", GetLastError());   
         }
      else
         {
         if(OrderSend(Symbol_4,OP_SELL, S4_Lots, MarketInfo(Symbol_4,MODE_BID), 2, 0.0, 0.0, "RapidFire", magic, 0, FireBrick) < 0)
            Print("OrderSend(", Symbol_4,", OP_SELL failed, error# ", GetLastError());   
         }
      }

   if(S5_Lots > 0)
      {
      if(S5_Buy)
         {
         if(OrderSend(Symbol_5,OP_BUY, S5_Lots, MarketInfo(Symbol_5,MODE_ASK), 2, 0.0, 0.0, "RapidFire", magic, 0, LimeGreen) < 0)
            Print("OrderSend(", Symbol_5, ", OP_BUY failed, error# ", GetLastError());   
         }
      else
         {
         if(OrderSend(Symbol_5,OP_SELL, S5_Lots, MarketInfo(Symbol_5,MODE_BID), 2, 0.0, 0.0, "RapidFire", magic, 0, FireBrick) < 0)
            Print("OrderSend(", Symbol_5, ", OP_SELL failed, error# ", GetLastError());  
         }
      }

   if(S6_Lots > 0)
      {
      if(S6_Buy)
         {
         if(OrderSend(Symbol_6,OP_BUY, S6_Lots, MarketInfo(Symbol_6,MODE_ASK), 2, 0.0, 0.0, "RapidFire", magic, 0, LimeGreen) < 0)
            Print("OrderSend(", Symbol_6, ", OP_BUY failed, error# ", GetLastError());   
         }
      else
         {
         if(OrderSend(Symbol_6,OP_SELL, S6_Lots, MarketInfo(Symbol_6,MODE_BID), 2, 0.0, 0.0, "RapidFire", magic, 0, FireBrick) < 0)
            Print("OrderSend(", Symbol_6, ", OP_SELL failed, error# ", GetLastError());   
         }
      }

   if(S7_Lots > 0)
      {
      if(S7_Buy)
         {
         if(OrderSend(Symbol_7,OP_BUY, S7_Lots, MarketInfo(Symbol_7,MODE_ASK), 2, 0.0, 0.0, "RapidFire", magic, 0, LimeGreen) < 0)
            Print("OrderSend(", Symbol_7, ", OP_BUY failed, error# ", GetLastError());
         }
      else
         {
         if(OrderSend(Symbol_7,OP_SELL, S7_Lots, MarketInfo(Symbol_7,MODE_BID), 2, 0.0, 0.0, "RapidFire", magic, 0, FireBrick) < 0)
            Print("OrderSend(", Symbol_7, ", OP_SELL failed, error# ", GetLastError());   
         }
      }

   return(0);
  }
//+------------------------------------------------------------------+