Send time split orders

 

Hi,

I need to send time splited orders when I have a signal.

Let me explain, by placing an exemple.

When some defined conditions are meet, I want to place a buy order, then 20 seconds later places another buy order and 20 seconds later place a third buy order.

if (bla bla bla == true)

{

OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);

wait for 20 seconds - what should I place here to do this as I want ????

OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);

wait for 20 seconds again - what should I place here to do this as I want ????

OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);

}

 

The stupid answer

//---- wait for 10 seconds
   Sleep(10000);

Meaning I think my answer is stupid!!!

 
  1. Sleep(), RefreshRates(), next send. You must ALWAYS refresh between any two server calls and after sleep.
  2. To OP, why?
 
WHRoeder:
  1. Sleep(), RefreshRates(), next send. You must ALWAYS refresh between any two server calls and after sleep.
  2. To OP, why?

I already tryed to sleep it.
but when I sleep it, and then refreshrates the settings that have origined the first order, may not be true in a meanwhile.

 
cashmaker:

I already tryed to sleep it.
but when I sleep it, and then refreshrates the settings that have origined the first order, may not be true in a meanwhile.


Thats why it was the stupid anwer!

Count the number of open orders or keep track of orders placed with a static var.

if (ordercount <3 ) check the time of the last order against TimeCurrent()

if( (TimeCurrent()-lastordertime) > 20 ) {

check conditons still apply and place order.

}

 
Ickyrus:


Thats why it was the stupid anwer!

Count the number of open orders or keep track of orders placed with a static var.

if (ordercount <3 ) check the time of the last order against TimeCurrent()

if( (TimeCurrent()-lastordertime) > 20 ) {

check conditons still apply and place order.

}


Ok.

I'll try it.

Thanks