can you see why I got this invalid price error when placing a pending sell order?

 

My EA tried to place a pending sell order, but it failed with the error "invalid price". Everything looks correct to me, normalised and entry price below the current price. The order values are below, as well as a screenshot showing the messages.

Order type: pending sell

Entry price: 1.19100

Stop loss: 1.19155

Take profit: 1.19040

The bid and ask price at the time were 1.19104, so was above the entry price.

Can anyone see why it would have failed with this message because I can't see anything wrong?

 
Ryan Luke Dansie: The bid and ask price at the time were 1.19104, so was above the entry price.
  1. They can't have been the same (no spread?); possible problem with that code.

  2. You can't move stops (or pending prices) closer to the market than the minimum: MODE_STOPLEVEL * _Point or SymbolInfoInteger(SYMBOL_TRADE_STOPS_LEVEL).
              Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial

    On some ECN type brokers the value might be zero (broker doesn't know.) Use a minimum of two (2) PIPs. You were tying to place it 0.4 PIPs.

  3. There is no need to create pending orders in code.
    1. The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker,) B) there's no round trip network delay (filled quicker.)
    2. Don't worry about it unless you're scalping M1 or trading news.
    3. Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
 
William Roeder:
  1. They can't have been the same.
  2. You can't move stops (or pending prices) closer to the market than the minimum: MODE_STOPLEVEL * _Point or SymbolInfoInteger(SYMBOL_TRADE_STOPS_LEVEL).
              Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial

    On some ECN type brokers the value might be zero (broker doesn't know.) Use a minimum of two (2) PIPs. You were tying to place it 0.4 PIPs.

1. its a commission only broker account so they are always the same.

2. Thank you very much for the info I will review it and check whether its the cause of my problem.

Reason: