Sell stop under the Bid but getting invalid price

Sidnei Vladisauskis  

Hello everyone,

I'm adapting an EA from B3 (Brazilian stock market) to the Forex and I know that the price information is a bit different.

But I don't know why I try send a sell stop under the bid and get the error invalid price.

I tried sent the price with and without spread and I got the same result.

2021.01.19 19:46:54.672 2018.01.10 02:00:00   Ask: 1.19291 | Bid: 1.19275 | Last: 1.19275
2021.01.19 19:46:54.672 2018.01.10 02:00:00   === Spread: 16 | spred converted: 0.00016 | enterPrice: 1.19253
2021.01.19 19:46:54.672 2018.01.10 02:00:00   failed sell stop 0.01 EURUSD at 1.19243 [Invalid price]

The enter price is calculated 10 PIPs under the last candle low price and discounted the spread and yet I catch the error, I have 32 PIPs of difference.

What I'm doing wrong?

Thanks for help

William Roeder  
Sidnei Vladisauskis: What I'm doing wrong?

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button).
     How To Ask Questions The Smart Way. 2004
          Be precise and informative about your problem

We can't see your broken code.

Fix your broken code.

With the information you've provided — we can only guess. And you haven't provided any useful information for that.

Sidnei Vladisauskis  
William Roeder:

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code (using Code button).
     How To Ask Questions The Smart Way. 2004
          Be precise and informative about your problem

We can't see your broken code.

Fix your broken code.

With the information you've provided — we can only guess. And you haven't provided any useful information for that.

If you are a smart guy you'll realize that is not about the broken code, even because the order is sending, the problem is about why the sell stop order that I sent above bid price is receiving invalid price, is it not correct? Is there something else that I need consider?

Other clue that show you without a cristal ball is that I said is adoption from an EA that running well in B3 market.

And using same EA in the same scenario in other point of market the sell stop and buy stop working well, I want to know why in this specific case the order is failing, because for me if the price is under the bid price in sell stop is correct point to send a new order.

And everything that I found in the forum said just send a price under de bid price that's correct, but it's not.

Well  maybe you are a super smart guy that know about everything, but without any sympathy.

Regards

Keith Watford  
Sidnei Vladisauskis:

You could try Normalizing the entry price to _Digits.

Sidnei Vladisauskis  
Keith Watford:

You could try Normalizing the entry price to _Digits.

I'm doing that using (int)SymbolInfoInteger(_Symbol, SYMBOL_DIGITS), but still return number with 5 digits, the correct is 4 digits so?

Keith Watford  
Sidnei Vladisauskis:

I'm doing that using (int)SymbolInfoInteger(_Symbol, SYMBOL_DIGITS), but still return number with 5 digits, the correct is 4 digits so?

EURUSD is usually 5 digits.

Show your code or nobody can help.

Keith Watford  
Sidnei Vladisauskis:

is not about the broken code, even because the order is sending, the problem is about why the sell stop order that I sent above bid price is receiving invalid price, is it not correct?

Sell stop MUST be below bid price.

William Roeder  
Keith Watford: You could try Normalizing the entry price to _Digits.

Prices must be normalized to TickSize, not point — code fails on metals. (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 programming forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 programming forum

Sidnei Vladisauskis  
Keith Watford:

Sell stop MUST be below bid price.

Sorry, I wrote wrong, the price is below bid price, because that I'm confused

In My original post I printed the prices at the moment.

Ask: 1.19291 | Bid: 1.19275 | Last: 1.19275
=== Spread: 16 | spred converted: 0.00016 | enterPrice: 1.19253
failed sell stop 0.01 EURUSD at 1.19243 [Invalid price]

Look, the bid is 1.19275 and the order was sent at 1.19243 - 32 pips below the bid price, in my mind I believe that is correct, right?

I'm not understanding why I'm getting invalid prices if the price is correct.

Keith Watford  
William Roeder:

Prices must be normalized to TickSize, not point — code fails on metals. (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 programming forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 programming forum

Yes, I know that. But I am not going to post that price should be normalized to Ticksize as the next question will be "What do you mean?". "How do I do that"? as it is too complicated for novice coders.

Reason: