Jump to content

⤴️-Paid Ad- Check advertising disclaimer here. Add your banner here.🔥

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


⤴️-Paid Ad- Check advertising disclaimer here. Add your banner here.🔥

×
×
  • Create New...