# Multiply orders

105

Have you any ideas? I'd like to open few orders in the same time. Conditions x>0.

Case 1. Problem is sometime ea opens only one position, or two, or all (I don't know why). But if open one position (in 95%) it is last Ticket.

Case 2. Ea open all positions but in diffrent time (I saw if appeared tick each instrument).

Case 3. If I use solution from Case 2. and OrderSend() with another conditions y<0, ea start mix strategy. Example 2 position with conditions x>0 and next with conditions y<0

```Case 1.

if (OrdersTotal()==0 && x>0)
{
RefreshRates();
Ticket=OrderSend(........);
Ticket=OrderSend(........);
Ticket=OrderSend(........);
Ticket=OrderSend(........);
Ticket=OrderSend(........);
}

Case 2.

if (OrdersTotal()==0 && x>0)
{
RefreshRates();
Ticket=OrderSend(.......);
}
if (OrdersTotal()==1 && x>0)
{
RefreshRates();
Ticket=OrderSend(.......);
}
if (OrdersTotal()==2 && x>0)
{
RefreshRates();
Ticket=OrderSend(.......);
}
.
.
.etc

Case 3.

if (OrdersTotal()==0 && x>0)
{
RefreshRates();
Ticket=OrderSend(.......);
}
if (OrdersTotal()==1 && x>0)
{
RefreshRates();
Ticket=OrderSend(.......);
}
.
.
.
.

if (OrdersTotal()==0 && y<0)
{
RefreshRates();
Ticket=OrderSend(.......);
}
if (OrdersTotal()==1 && y<0)
{
RefreshRates();
Ticket=OrderSend(.......);
}
.
.
.
```
Moderator
18021

kot_filemon:

Have you any ideas? I'd like to open few orders in the same time. Conditions x>0.

Case 1. Problem is sometime ea opens only one position, or two, or all (I don't know why).

Why don't you know why ? don't you want to know ? why aren't you testing the return value from the OrderSend() and reporting the error if it failed ?

Read and implement this: What are Function return values ? How do I use them ?

15727

kot_filemon: Case 1. Problem is sometime ea opens only one position, or two, or all (I don't know why). But if open one position (in 95%) it is last Ticket.
```if (OrdersTotal()==0 && x>0){
RefreshRates();
Ticket=OrderSend(........);
Ticket=OrderSend(........);```
1. Find out why What are Function return values ? How do I use them ? - MQL4 forum
2. What do you think that RefreshRates is doing? Nothing! you need that between EACH server calls
3. OrdersTotal()==0 makes your EA incompatible with every other, including itself on other pairs and manual trading order accounting - MQL4 forum