EA for multiple markets at one time

 
I was looking for information on how to write a timer correctly on the net.
And I found this EA based on RSI on more markets at a time.

I was intrigued by the "do it anywhere else"

Unfortunately, EA can not test anything.

Can EA be written on more markets?

Thank you.



//+------------------------------------------------------------------+
//|                                RSI na AUD_EUR_JPY_GBP_EURJPY.mq4 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//---- input parameters
extern int        RSI_High=80;
extern int        RSI_Low=20;
extern int        User_Lots=1;
extern int        EA_MAGIC_NUM=1;
extern double     StopLoss=100.0;
extern double     TakeProfit=20.0;


//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+

void start()
{
while (true)
   {
   if (DecideToOpenTrade("AUDUSD"))
      {
       if(iRSI("AUDUSD",0,13,PRICE_CLOSE,0)>RSI_High)
         {
         OrderSend("AUDUSD",OP_BUY,User_Lots,Ask,0,0,Ask+TakeProfit*Point,NULL,0,0,Green);
         }
       if(iRSI("AUDUSD",0,13,PRICE_CLOSE,0)<RSI_Low)
         {
         OrderSend("AUDUSD",OP_SELL,User_Lots,Bid,0,0,Bid-TakeProfit*Point,NULL,0,0,Green);
         }
      }
   if (DecideToOpenTrade("EURUSD"))
      {
       if(iRSI("EURUSD",0,13,PRICE_CLOSE,0)>RSI_High)
         {
         OrderSend("EURUSD",OP_BUY,User_Lots,Ask,0,0,Ask+TakeProfit*Point,NULL,0,0,Green);
         }
       if(iRSI("EURUSD",0,13,PRICE_CLOSE,0)<RSI_Low)
         {
         OrderSend("EURUSD",OP_SELL,User_Lots,Bid,0,0,Bid-TakeProfit*Point,NULL,0,0,Green);
         }
      }
   if (DecideToOpenTrade("USDCHF"))
      {
       if(iRSI("USDCHF",0,13,PRICE_CLOSE,0)>RSI_High)
         {
         OrderSend("USDCHF",OP_BUY,User_Lots,Ask,0,0,Ask+TakeProfit*Point,NULL,0,0,Green);
         }
       if(iRSI("USDCHF",0,13,PRICE_CLOSE,0)<RSI_Low)
         {
         OrderSend("USDCHF",OP_SELL,User_Lots,Bid,0,0,Bid-TakeProfit*Point,NULL,0,0,Green);
         }
      }
   if (DecideToOpenTrade("USDJPY"))
      {
       if(iRSI("USDJPY",0,13,PRICE_CLOSE,0)>RSI_High)
         {
         OrderSend("USDJPY",OP_BUY,User_Lots,Ask,0,0,Ask+TakeProfit*Point,NULL,0,0,Green);
         }
       if(iRSI("USDJPY",0,13,PRICE_CLOSE,0)<RSI_Low)
         {
         OrderSend("USDJPY",OP_SELL,User_Lots,Bid,0,0,Bid-TakeProfit*Point,NULL,0,0,Green);
         }
      }
   if (DecideToOpenTrade("GBPUSD"))
      {
       if(iRSI("GBPUSD",0,13,PRICE_CLOSE,0)>RSI_High)
         {
         OrderSend("GBPUSD",OP_BUY,User_Lots,Ask,0,0,Ask+TakeProfit*Point,NULL,0,0,Green);
         }
       if(iRSI("GBPUSD",0,13,PRICE_CLOSE,0)<RSI_Low)
         {
         OrderSend("GBPUSD",OP_SELL,User_Lots,Bid,0,0,Bid-TakeProfit*Point,NULL,0,0,Green);
         }
      }
   if (DecideToOpenTrade("EURJPY"))
      {
       if(iRSI("EURJPY",0,13,PRICE_CLOSE,0)>RSI_High)
         {
         OrderSend("EURJPY",OP_BUY,User_Lots,Ask,0,0,Ask+TakeProfit*Point,NULL,0,0,Green);
         }
       if(iRSI("EURJPY",0,13,PRICE_CLOSE,0)<RSI_Low)
         {
         OrderSend("EURJPY",OP_SELL,User_Lots,Bid,0,0,Bid-TakeProfit*Point,NULL,0,0,Green);
         }
          }

}
}
//----
//Trade Checking Logic
//----
bool DecideToOpenTrade(string SymbolToUse)
{
   int total = OrdersTotal();
   if (total > 0)
   {
      for(int cnt=0;cnt<total;cnt++)
      {
         if(OrderSelect(cnt,SELECT_BY_POS))
         {
            if(OrderSymbol()==SymbolToUse && OrderMagicNumber() == EA_MAGIC_NUM)
            {
               return(false);
            }
         }
       }
    }
    return(true);
 }


 
Stanislav Milka:
I was looking for information on how to write a timer correctly on the net.
And I found this EA based on RSI on more markets at a time.

I was intrigued by the "do it anywhere else"

Unfortunately, EA can not test anything.

Can EA be written on more markets?

Thank you.




Your Code Is Doing What You Asking!
Reason: