1. ## Running 2 EA's in 1 metatrader

Hello,

I'm trying to run 2 similar EA's in 2 separate EURUSD 1M charts, but they only pass 1 order at a time. I realized that to do this, I need to use the magic number.

But now I have another problem. I have code similar to this:

if OrdersTotal() > 0 //i am in a trade
{
do my calculation and OrderClose
}

if OrdersTotal() == 0 //i am out of a trade
{
then open a new trade OrderSend
}

My problem is that the OrdersTotal function, returns all open orders...therefore both charts. I need to know if an order is open only in the current chart.

Is there any way on doing this?
Thanks

2. Originally Posted by italiangoose
Hello,

I'm trying to run 2 similar EA's in 2 separate EURUSD 1M charts, but they only pass 1 order at a time. I realized that to do this, I need to use the magic number.

But now I have another problem. I have code similar to this:

if OrdersTotal() > 0 //i am in a trade
{
do my calculation and OrderClose
}

if OrdersTotal() == 0 //i am out of a trade
{
then open a new trade OrderSend
}

My problem is that the OrdersTotal function, returns all open orders...therefore both charts. I need to know if an order is open only in the current chart.

Is there any way on doing this?
Thanks
You have to combine the OrderTotal function with the Magic number, like

for(int i=0;i<CountOrders(Magic);i++)

3. You need code like this:

//+------------------------------------------------------------------+
//| (C) mizaindo |
//+------------------------------------------------------------------+
int myOrdersTotal() {
int i;
int count=0;

for(i=0; i<OrdersTotal(); i++)
{
if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=myMagicNo) continue;
count++;
}

return (count);
}