Hence the day length time 24 * 60 * 60.
Or number of seconds until midnight if you need it to last for the current day only (not less than 660 though).
The expiration time is set in seconds and cannot be less than 11 minutes (that may depend on broker's server setup or hardcoded in the terminal, I don't know exactly).
Hence the day length time 24 * 60 * 60.
Or number of seconds until midnight if you need it to last for the current day only (not less than 660 though).
Thank you. Do you have a code sequence that will calculate remaining time in same day when OrderSend() OP_BUYLIMIT is placed?
Wackena
datetime et = ((24 - Hour()) * 60 - Minute()) * 60 - Seconds(); if (et < 660) et = 0; // or = 660. OrderSend() returns ERR_INVALID_PARAMETERS if et < 660.
datetime et = ((24 - Hour()) * 60 - Minute()) * 60 - Seconds(); if (et < 660) et = 0; // or = 660. OrderSend() returns ERR_INVALID_PARAMETERS if et < 660.
Irtron,
Thanks,
Wackena
hi, I have the same problem, I want to set pendings with expiration for the next hour . as you say, I should set the expiration 3600 . but when I write my ordersend like this:
int sellticket=OrderSend(Symbol(),OP_SELLSTOP,0.1,Bid-15*Point,5,Bid-5*Point,Bid-30*Point,NULL,0,3600,Red);
it gives me "OrderSend error 3" .
TimeMinute(TimeCurrent()+10 ...........????
No. TimeMinute() returns the minute of the input time (0,1,2...59). Expiration should be in standard unix time (in seconds passed since 1 Jan 1970). Roger's comment is correct.
Expiration should be in standard unix time (in seconds passed since 1 Jan 1970). Roger's comment is correct.
...And some brokers have minimum expiry periods. For example, I seem to remember that IBFX appear to have a complex rule where expiry cannot be earlier than the start of the tenth minute from now - i.e. a minimum of anything from 541 to 600 seconds away.
I have tries this in my code and it did not work. I get OrderSend() Error 147. Using fxcm mt4(the old one; they made a new one recently). Here is a piece of my code:
if(TCheck()==True && Total_H==0){
OrderSend(Symbol(),OP_SELLSTOP,V, LOW, 2, LOW+StopLoss*10*Point, LOW-TakeProfit*10*Point, NULL, 0, TimeCurrent()+84600, Yellow);
OrderSend(Symbol(),OP_BUYSTOP, V, HIGH, 2,HIGH-StopLoss*10*Point, HIGH+TakeProfit*10*Point, NULL, 0, TimeCurrent()+84600, Yellow);
}

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
In this example, the expiration time is 0. I need example of pending order "Good for the Day Only".
Thanks,
Wackena