Make this EA able to do several trades on different symbols

 
Hi, how do I make this EA able to make several trades but only on different symbols? I hope you understand how I mean?
Thanks in advance.

//+------------------------------------------------------------------+
//|                                                rsi-automated.mq4 |
//|                                  Copyright 2016, Mohammad Soubra |
//|                                        https://www.onesoubra.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, Mohammad Soubra"
#property link      "https://www.mql5.com/en/users/soubra2003"
#property version   "1.00"
#property strict

input int MagicNumber=1982;  //Magic Number
input double Lots=0.01;      //Fixed Lots
input double StopLoss=50;    //Fixed Stop Loss (in Points)
input double TakeProfit=150; //Fixed Take Profit (in Points)
input int TrailingStop=25;   //Trailing Stop (in Points)
input int Slippage=3;
//+------------------------------------------------------------------+
//|   expert OnTick function                                         |
//+------------------------------------------------------------------+
void OnTick()
  {
   double MyPoint=Point;
   if(Digits==3 || Digits==5) MyPoint=Point*10;

   double TheStopLoss=0;
   double TheTakeProfit=0;
   if(TotalOrdersCount()==0)
     {
      int result=0;
      if((iRSI(NULL,0,14,PRICE_CLOSE,0)<25)) // Here is the open buy condition
        {
         result=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"EXAMPLE OF RSI AUTOMATED",MagicNumber,0,Blue);
         if(result>0)
           {
            TheStopLoss=0;
            TheTakeProfit=0;
            if(TakeProfit>0) TheTakeProfit=Ask+TakeProfit*MyPoint;
            if(StopLoss>0) TheStopLoss=Ask-StopLoss*MyPoint;
            int MyOrderSelect=OrderSelect(result,SELECT_BY_TICKET);
            int MyOrderModify=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green);
           }
        }
      if((iRSI(NULL,0,14,PRICE_CLOSE,0)>75)) // Here is the open Sell condition
        {
         result=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,0,0,"EXAMPLE OF RSI AUTOMATED",MagicNumber,0,Red);
         if(result>0)
           {
            TheStopLoss=0;
            TheTakeProfit=0;
            if(TakeProfit>0) TheTakeProfit=Bid-TakeProfit*MyPoint;
            if(StopLoss>0) TheStopLoss=Bid+StopLoss*MyPoint;
            int MyOrderSelect=OrderSelect(result,SELECT_BY_TICKET);
            int MyOrderModify=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green);
           }
        }
     }

   for(int cnt=0;cnt<OrdersTotal();cnt++)
     {
      int MyOrderSelect=OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
      if(OrderType()<=OP_SELL && 
         OrderSymbol()==Symbol() && 
         OrderMagicNumber()==MagicNumber
         )
        {
         if(OrderType()==OP_BUY)
           {
            if((iRSI(NULL,0,14,PRICE_CLOSE,0)>50)) //here is the close buy condition
              {
               int MyOrderClose=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),Slippage,Red);
              }
            if(TrailingStop>0)
              {
               if(Bid-OrderOpenPrice()>MyPoint*TrailingStop)
                 {
                  if(OrderStopLoss()<Bid-MyPoint*TrailingStop)
                    {
                     int MyOrderModify=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*MyPoint,OrderTakeProfit(),0,Green);
                    }
                 }
              }
           }
         else
           {
            if((iRSI(NULL,0,14,PRICE_CLOSE,0)<50)) // here is the close sell condition
              {
               int MyOrderClose=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),Slippage,Red);
              }
            if(TrailingStop>0)
              {
               if((OrderOpenPrice()-Ask)>(MyPoint*TrailingStop))
                 {
                  if((OrderStopLoss()>(Ask+MyPoint*TrailingStop)) || (OrderStopLoss()==0))
                    {
                     int MyOrderModify=OrderModify(OrderTicket(),OrderOpenPrice(),Ask+MyPoint*TrailingStop,OrderTakeProfit(),0,Red);
                    }
                 }
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
//|   expert TotalOrdersCount function                               |
//+------------------------------------------------------------------+
int TotalOrdersCount()
  {
   int result=0;
   for(int i=0;i<OrdersTotal();i++)
     {
      int MyOrderSelect=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(OrderMagicNumber()==MagicNumber) result++;

     }
   return (result);
  }
//-------------------------------------------------------------------+
//Bye
 

Well you can post a job on Freelance for example.

Or you can contact the author Mohammad Soubra.

 
Marco vd Heijden:

Well you can post a job on Freelance for example.

Or you can contact the author Mohammad Soubra.

Looks very much like code created by an EA builder.

 
Keith Watford:

Looks very much like code created by an EA builder.

I know Mohammad this is most likely a freelance job he has done somewhere in the past.

 
Keith Watford:

Looks very much like code created by an EA builder.

Why ?
 
Alain Verleyen:
Why ?

The use of variable names "TheStopLoss" & "TheTakeProfit" is a big clue as well as the layout.

A simple search for TheStopLoss turns up loads of code by EA builders

eg.

https://www.mql5.com/en/forum/215576

Need help on this EA............. Please.
Need help on this EA............. Please.
  • 2017.09.13
  • www.mql5.com
It is an EMA20 based buy sell EA. But it opens positions frequently. I need to correct it. One position (per pair per time frame) only...
 
Keith Watford:

The use of variable names "TheStopLoss" & "TheTakeProfit" is a big clue as well as the layout.

A simple search for TheStopLoss turns up loads of code by EA builders

eg.

https://www.mql5.com/en/forum/215576

Thanks Keith.
 
It scared me a bit because my coding also looks like that and i want anything but to be compared to an EA Builder :)
 
Marco vd Heijden:
It scared me a bit because my coding also looks like that and i want anything but to be compared to an EA Builder :)

Don't worry Marco. There's a lot more that convinced me that it was not the work of an experienced coder.

Use of prefix "My".

Inputs were in  Points, but then converted to pips when used in calculations.

Checking RSI value every tick when only checking shift[1].

Counting up in a loop through orders when some may be closed by the loop.

In the event that a trade is closed in the loop, still continuing to check and maybe attempt to modify the TS on a closed trade.

Using ints when it should be a bool.

Not actually checking the return of OrderSelect() , OrderClose() and OrderModify().

I don't believe that you use code like that.

Probably somebody at some time has got hold of some code from Mohammad Soubra and modified it with blocks of code from an EA builder.

Reason: