# Make this EA able to do several trades on different symbols

66

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

```//+------------------------------------------------------------------+
//|                                                rsi-automated.mq4 |
//|                                        https://www.onesoubra.com |
//+------------------------------------------------------------------+
#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
{
if(result>0)
{
TheStopLoss=0;
TheTakeProfit=0;
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++)
{
if(OrderType()<=OP_SELL &&
OrderSymbol()==Symbol() &&
OrderMagicNumber()==MagicNumber
)
{
{
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)
{
{
{
}
}
}
}
}
}
}
//+------------------------------------------------------------------+
//|   expert TotalOrdersCount function                               |
//+------------------------------------------------------------------+
int TotalOrdersCount()
{
int result=0;
for(int i=0;i<OrdersTotal();i++)
{
if(OrderMagicNumber()==MagicNumber) result++;

}
return (result);
}
//-------------------------------------------------------------------+
//Bye
```
Moderator
12714

Well you can post a job on Freelance for example.

Or you can contact the author Mohammad Soubra.

Moderator
20419

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.

Moderator
12714

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.

38685

Keith Watford:

Looks very much like code created by an EA builder.

Why ?
Moderator
20419

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.
• 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...
38685

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.
Moderator
12714

It scared me a bit because my coding also looks like that and i want anything but to be compared to an EA Builder :)
Moderator
20419

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.