jonnnny23 Posted February 12, 2011 Report Share Posted February 12, 2011 Should be simple question. I am trying to place a Ordersend() that will expire in 5 minutes (360 seconds) if the bid price is not met. Here is my code: OrderSend(Symbol(), OP_BUY, l_lots_0, buy_ask, Slippage, 0.0, 0.0, EA_Comment, MagicNumber, TimeCurrent()+360, Blue) The correct format is: int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE) Is my code" TimeCurrent()+360 " is the wrong datetime format? Thanks! Quote Link to comment Share on other sites More sharing options...
stovedude Posted February 12, 2011 Report Share Posted February 12, 2011 Your calculation is correct. However, you cannot set an expiration for OP_BUY or OP_SELL, because these are direct market orders. You will have to use pending orders: OP_BUYSTOP (if price is below that level), OP_BUYLIMIT (if price is above that level), OP_SELLSTOP (if price is above that level), or OP_SELLLIMIT (if price is below that level). Also, you cannot set pending orders closer to the current price than the stop level ( MarketInfo(Symbol(),MODE_STOPLEVEL) ). Hope that helps. Quote Link to comment Share on other sites More sharing options...
⭐ luxinterior Posted February 12, 2011 Report Share Posted February 12, 2011 I am trying to place a Ordersend() that will expire in 5 minutes (360 seconds) if the bid price is not met. Your calculation is correct... Not quite...5 minutes is 300 seconds not 360 :D L Quote Link to comment Share on other sites More sharing options...
stovedude Posted February 13, 2011 Report Share Posted February 13, 2011 That's true. I guess that one slipped by my eye... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.