Two orders being opened at same time

Have you found a good programmer? Make a targeted order!
73
2016.10.24 13:42
Hi, im solving small problem.

I have code like if(OrdersTotal()==0): orderSend(Symbol()... OP_BUYSTOP....)
Sometimes it happens that 2 positions are opened in same time. How is that even posible? Is it because new tick comes immediatelly after first one? I mean like OrderSend is just being send somewehere and in new tick OrdersTotal is yet equal 0?

Thank you
1447
2016.10.24 16:48

Foed,

You need to show your code to know exactly what happened ... There are many cases one can consider ...

Like, if the 2 orders are different or the same ?

In case if they are different, the biggest probability is that you need to direct the program flow after each OrderSend( )

to the beginning of the start( ) function using return(0); ... This is only a guess.

14
2016.10.24 17:51
Osama Shaban:

Foed,

You need to show your code to know exactly what happened ... There are many cases one can consider ...

Like, if the 2 orders are different or the same ?

In case if they are different, the biggest probability is that you need to direct the program flow after each OrderSend( )

to the beginning of the start( ) function using return(0); ... This is only a guess.

My code is

if((OrdersTotal()==0)

{

int tiket=-1;

}

where in_price and in_volume are doubles.

Yes, it opens two ABSOLUTELLY SAME orders :/

Not always, but during stronger moves on instrument.
Moderator
30707
2016.10.25 08:35
frantisek-fanda:

My code is

if((OrdersTotal()==0)

{

int tiket=-1;