Speed up multi orders at the same time/symbol

 

Hi,

how can I speed up multi order to get most orders in a short period?

I wrote the function below to open 10 positions:

  int i = 0;
  while(i < 10) {
    int ticket = 0, lastError = 0, n = 0;
    while(true) {
      ticket    = OrderSend(Symbol(), OP_BUY, 0.1, Ask, 30, 0, 0, "", 300, 0, Blue);
      lastError = GetLastError();

      if (lastError == 0) {break;}
      else {
        RefreshRates();

        n++;
        if(n>15) {
          break;
        }
      }
    }

    i++;
  }


But between the first to the last order are mostly at least 4-5 seconds or above. :-X

Why can't MetaTrader fill all orders at the same time?


Is there a better way to open 10 or more positions at the same time?


Regards

Burkhard

 
BurkhardWille:

Hi,

how can I speed up multi order to get most orders in a short period?

I wrote the function below to open 10 positions:


But between the first to the last order are mostly at least 4-5 seconds or above. :-X

Why can't MetaTrader fill all orders at the same time?


Is there a better way to open 10 or more positions at the same time?


Regards

Burkhard

Impossible to open 2 trades at exactly the same time
if it fails how do you know why it fails ??

I can't see you print that info ....

So what are the errors when it fails ???

 
what about to open 1 X 1.0 instead of 10 X 0.1 ?
 
deVries:

Impossible to open 2 trades at exactly the same time
if it fails how do you know why it fails ??

I can't see you print that info ....

So what are the errors when it fails ???


sure, not at the same time, but perhaps as close together as possible.

In the picture above, you can see, that 2 to 3 orders can handle in one second.

"Errors" I can show me with print [Print(lastError) or Print(n)] in the else-block, where the RefreshRates-funtion is. There are not realy errors, with RefreshRates I can handle this, but it takes to long time, I think.


qjol:
what about to open 1 X 1.0 instead of 10 X 0.1 ?

See, if I trade 1 x 200 Lots (20.000.000) with only one trade, the spread of 0.3 Pips (EURUSD) is extended to 0.7 or higher, so if I split my order to maybe 20 x 10 Lots I can keep my 0.3 spread...






 
BurkhardWille:

sure, not at the same time, but perhaps as close together as possible.

In the picture above, you can see, that 2 to 3 orders can handle in one second.

"Errors" I can show me with print [Print(lastError) or Print(n)] in the else-block, where the RefreshRates-funtion is. There are not realy errors, with RefreshRates I can handle this, but it takes to long time, I think.

If you want speed up then don't ignore the result you get with GetLastError()....

handle according the kind of error you get see

How to handle trading errors - mql4

 
deVries:

If you want speed up then don't ignore the result you get with GetLastError()....

handle according the kind of error you get see

How to handle trading errors - mql4


ok, thanks.
Reason: