Documentation

Applications

Last updated on 11. 9. 2020 by Tomas Vanek

The strategy tried to place stop/limit order at incorrect price

If you are running or backtesting strategie from StrategyQuant X in Metatrader 5, you might can see this info message in your logs:

020.08.26 00:00:01.102 Strategy 1.4.130 (MYMU20,H1) 2020.08.25 22:00 No pending orders of that type
2020.08.26 00:00:01.118 Strategy 1.4.130 (MYMU20,H1) —VERBOSE— 2020.08.25 22:00 Based on its logic, the strategy tried to place stop/limit order at incorrect price. Market price: 28220.00000000, min. price allowed: 28220.00000000, stop/limit order price: 27966.00000000

Is this an error? No. Here is explanation:

It means the entry conditions of the strategy were met and normally the strategy would open a new order. But in this case the calculated order price was out of the market and the order was skipped because of that.

Was this article helpful? The article was useful The article was not useful

19 Comments
Oldest
Newest Most Voted
MOHAMMAD
6. 11. 2021 8:36 am

Hi. Thanks…but please let us know how to solve this problem? Thanks…

tomas262
Admin
Reply to  MOHAMMAD
8. 11. 2021 3:38 pm

As mentioned in the article, this is not a problem or error per se. Only information about why an order could not be placed

MOHAMMAD
Reply to  tomas262
9. 11. 2021 12:29 pm

Hi. Thanks…but unfortunately this is the problem because the user cannot run the back test in metatrader or etc. Is not? please let us know how to solve this problem in order to implement the back test. Thanks…

tomas262
Admin
Reply to  MOHAMMAD
9. 11. 2021 1:22 pm

Even if you see this “warning” the EA should trade normally. If there are no trade please send us an email with the strategy to support.com and we can check it
Please always send not only EA code but also the Strategyquant file (.sqx extension)

Last edited 2 years ago by tomas262
Kenneth Baggett
Kenneth Baggett
1. 12. 2022 8:25 pm

Hi, I have the same message. Based on the answers provided, I understand its not an error.

My question is this. Was the trade also skipped during strategy creation and backtests from SQ?

I am trying to figure out if my backtest results may differ from actual trading because of the skipped trades?

I guess, MonteCarlo would apply the same testing environment so no worries except for expectations on # of trades…

tomas262
Admin
Reply to  Kenneth Baggett
5. 12. 2022 5:10 pm

Yes, the trades are also skipped in SQX to match MetaTrader. In SQX you just won’t see the message you see in MT4

Derick Munoz
Derick Munoz
29. 5. 2023 10:26 pm

hi,

Could the ea operate without any problem even if that message continues to appear?


tomas262
Admin
Reply to  Derick Munoz
30. 5. 2023 8:44 pm

Yes, it is only an information message

Luis Felipe Salazar Jaramillo
Luis Felipe Salazar Jaramillo
21. 2. 2024 11:26 pm

Hey, that’s a real error.. as the price is calculated wrongly on MT5 and hence, no placing the order because is below the limit allowed. The strategy is successful on SQW but not when back testing on MT5.. Any solution found???

Thanks.

tomas262
Admin
Reply to  Luis Felipe Salazar Jaramillo
12. 11. 2025 8:08 pm

In SQX such order will be rejected as well but only if the backtesting precision is high enough (tick data ideally)

Daniel
7. 6. 2024 7:23 am

Can somebody please explain WHY “ the calculated order price was out of the market“? Can this be prevented? I have several portfolio EA’s (Different strategies for multiple symbols) that throw this notice everytime a trade should be placed. Some insight would be nice.

Daniel
Reply to  Daniel
2. 11. 2025 2:14 pm

I inserted the mql code into AI and found out why, When the EA tries to place an order, the order price is checked to see if the broker would allow the order price. When it doesn’t, for example it tries to place a stop order with a price within 1 pip of the market price and the minimal distance to market price is 1 pip, then you will see this notification, since the broker would not accept this order. This is what they call “out of the market”. It is not an error because all the calculations and functions… Read more »

Last edited 7 months ago by Daniel
Mestre B
12. 7. 2024 8:23 pm

there should be an option to filter out strats that rely on perfect price. In my last construction I only got starts that would generate 0 trades in MT5 back tester cause all orders would only create this “non-error”

Hien Bui
Hien Bui
15. 4. 2025 5:10 am

I guess that the Backtest logic of SQX is mathematical logic, which means that the pending order has a price different from the market price, regardless of the logic of the Stop order or the Limit order, while the logic of placing a pending order in MT5 must comply with the logic of the Stop/Limit order (for example, the Buy Stop price must be greater than the current price). Therefore, when implementing the actual transaction, the EA of SQX on MT5 has a logical conflict, leading to the suggested price of the pending order being invalid with the Stop/Limit. First… Read more »

Mtrade888
10. 11. 2025 3:12 pm

Have someone found a solution for this – or even better how to avoid sqx to develop a strategy that lead to this error when trading or backtesting on MT5?

tomas262
Admin
Reply to  Mtrade888
12. 11. 2025 8:14 pm

Use high precision backtest in SQX. That mean real tick data exported from brokers’ platforms. Only then orders would be rejected the same way in SQX as they are being rejected in MT

William Silva
William Silva
1. 12. 2025 6:19 pm

I don’t know why SQX support team always try to say that an error is not an error, I have a many ticket that they simply say this is not an error or it is the way it is. This is an error for sure, in the backtest there are a lot of more trades than in real live account, the so backtest data is not accurate as it suppose to be.

I changed preferredFillingType = ORDER_FILLING_FOK to ORDER_FILLING_BOC and it increased number of trades.

JESUS DIAZ
JESUS DIAZ
23. 2. 2026 4:51 am

Hola chicos, también viví esto y me frustre mucho… pero, para ser honestos y curarnos en salud, cuando creen estrategias, en minima distancia no coloque 1 (eso dice el activo del GBPJPY de mi broker), sino 2, es decir, un pip más de lo que indica el activo del broker que tenga, de esta forma no les saldrá ese mensaje de error… de esa forma lo corregí. sin embargo, las estrategias que ya crearon con minima distancia 1 o que les sale ese mensaje en mt5 no tienen arreglo.. por lo que les sugiero que mejor la desechen y creen… Read more »

Harry Papatheocharous
11. 4. 2026 9:25 am

To make this “issue” happen less frequently, i have set the strategy parameter “UseSQPipSize” to True instead of False (check MT5 Strategy Inputs towards the end). Now the equity curve in the MT5 backtest (with Every Tick based on Real Ticks) matches the equity of SQ almost exactly. MUST DO Prerequisites: You need to Create a Broker Profile for your Broker, and specify the correct Broker Timezone You need to export from MT5 the Broker Sessions and Instruments (with correct commisions per LOT) You need to import the Sessions and Instruments of your Broker into the Broker profile you created… Read more »