![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
It says that for a Buy Limit order the check would be Ask-OpenPrice >= SYMBOL_TRADE_FREEZE_LEVEL, which would mean that if we place the Buy Limit order at Ask - SYMBOL_TRADE_FREEZE_LEVEL then there should be no [Invalid price] error, right? Well, the Automatic validation still shows errors such as:
2020.02.03 01:05:00 failed buy limit 0.2 XAUUSD at 1588.80 sl: 1588.00 tp: 1590.00 [Invalid price]
In fact, I'm placing the buy limit order at MathMax(20, SymbolInfoInteger(_Symbol, SYMBOL_TRADE_FREEZE_LEVEL)) points below the Ask price.
Changing 20 to 40 fixes the error, but it isn't a solution.
I've also tried placing the order at MathMax(20, SymbolInfoInteger(_Symbol, SYMBOL_TRADE_FREEZE_LEVEL)) points below the Bid price (instead of Ask price) (even though "Ask" should be enough), and it still causes an [Invalid price] error.
And, I also tried placing the order at MathMax(20, SymbolInfoInteger(_Symbol, SYMBOL_TRADE_FREEZE_LEVEL)) + 1 points below the Ask price, to make sure the gap is bigger than SYMBOL_TRADE_FREEZE_LEVEL points (even though the article says the gap can be SYMBOL_TRADE_FREEZE_LEVEL points). Yet again, it still causes an [Invalid price] error.
Attached is the code I used to "test" the Automatic validation tester.
Any ideas what I'm doing wrong?