Jump to content

Recommended Posts

Posted

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!

Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...