how to open a pending order at 23:58h ?
i have tested w/ following but did not work:
int expire = CurTime() + 48 * 3606;
If you mean expires in 48 hours - there's only 3600 seconds per hour.int OpenTradeTime = 2358; int ct = Hour() * 100 + Minute(); int MinutesToWaitForTick = 1; int EndTradeTime = OpenTradeTime + MinutesToWaitForTick; if(((DayOfWeek()==5) && (ct >= OpenTradeTime && ct < EndTradeTime) && (OrdersTotal() == 0)))
If your broker is using GMT time, that will never work - as the market is CLOSED on Friday at 2200z http://www.forexmarkethours.com/- The * 100 is confusing. I would code it:
#define HR2400 86400 // 24*3600 #define HR2358 86280 // 23*3600 + 58*60 datetime now = TimeCurrent(), tod = now % HR2400; // Time of day if(((DayOfWeek()==5) && (tod >= HR2358...
or alternatelydatetime now = TimeCurrent(), OpenTradeTime = StrToTime("23:58"); if(((DayOfWeek()==5) && (now >= OpenTradeTime...
ticket=OrderSend(Symbol(),OP_BUYSTOP,Lot,MyAsk,SlipPage,MyBid+(Distance-SL)*Point,MyAsk+(Distance+TP)
On a buy stops are relative to Bid (TP) Bid+(Distance-SL) makes no sense. Maybe Bid-(Distance+SL)*point- Always test return codes and print errors so you find out WHY.
int ticket = OrderSend(...) if (ticket < 0) Alert("OrderSend failed: ", GetLastError());
- EA's must adjust TP, SL, AND slippage for 4/5 digit brokers
//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits % 2 == 1){ // DE30=1/JPY=3/EURUSD=5 https://www.mql5.com/en/forum/135345 pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl //---- These are adjusted for 5 digit brokers.
- On ECN brokers you must open first and THEN set stops
int ticket = OrderSend(...) if (ticket < 0) Alert("OrderSend failed: ", GetLastError()); else if (!OrderSelect(ticket, SELECT_BY_POS)) Alert("OrderSelect failed: ", GetLastError()); else if (!OrderModify(OrderTicket()...) Alert("OrderModify failed: ", GetLastError());
total=OrdersTotal();
This makes the EA incompatible with every other including itself on other charts and manual trading. Always filterint nOrders=0; for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() // and my pair. ){ nOrders++; } if (nOrders == 0 && ...
how to open a pending order at 23:58h ?
i have tested w/ following but did not work:
this kind of trades, its the best you contact directly to your broker, quote "weekend fill", and you should be able to know whether they're accepting. Markets can "move" erratically, substantially on Asian Monday opening bell side, esp after undisclosed meetings happening over the weekend. We just got to know about it much, much later while the rest of the world still sleeping.
There are business circumstances which are not possible, to the best of interest for both sides. same for the rest of strategy in this category of weekend OTC measures.
And you may like to know, that I know personally traders (professionals or otherwise) have flouted their money badly on this...if they do make money, its just gambler's luck. All the best!
thanks guys, very usefull information!
for this part I need another solution so that I can set expire time as extern ...
int expire = CurTime() + 48 * 3606;
expire time should be +48h + expire hour and minute as extern parameter
In the first place, does your broker accept expiry time on all their stop orders? Do you ever know, that brokers, except for some/few I know out there, who not accept expiry time?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
how to open a pending order at 23:58h ?
i have tested w/ following but did not work: