Please search 🔍 before you post. Your question has already been discussed multiple times on the forum.
The price may be invalid in terms that it may be too close to current market price or violate the symbol's contract specifications.
The checks a trading robot must pass before publication in the Market
MetaQuotes, 2016.08.01 09:30
Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
And the following ...
Please search 🔍 before you post. Your question has already been discussed multiple times on the forum.
The price may be invalid in terms that it may be too close to current market price or violate the symbol's contract specifications.
And the following ...
Thanks for responding Fernando. I have searched the forums extensively and I have read the article and implemented the majority of the checks hence why I posted here. I have yet to find information in that article that would relate to the issue I am experiencing with [Invalid price]. Taking the information provided by the logs (which I cannot reproduce on the exact symbol and timeframe in my Strategy Tester) I see nothing invalid about the price, I have gone as far as adding this simple code to prevent my BuyStop and SellStop from potentially failing:
if (buyStopPrice < SymbolInfoDouble(_Symbol, SYMBOL_ASK)) return; if (sellStopPrice > SymbolInfoDouble(_Symbol, SYMBOL_BID)) return;
So since I have spent several days troubleshooting I figured I would post here in case someone has experienced the same symptom and am hopeful that if I can find my solution it can be captured here for someone else to use in the future.
Thanks for responding Fernando. I have searched the forums extensively and I have read the article and implemented the majority of the checks hence why I posted here. I have yet to find information in that article that would relate to the issue I am experiencing with "[Invalid price]. Taking the information provided by the logs (which I cannot reproduce on the exact symbol and timeframe in my Strategy Tester) I see nothing invalid about the price, I have gone as far as adding this simple code to prevent my BuyStop and SellStop from potentially failing:
So since I have spent several days troubleshooting I figured I would post here in case someone has experienced the same symptom and am hopeful that if I can find my solution it can be captured here for someone else to use in the future.
You are ignoring the Stops Level and Freeze Level. The following is from the MQL4 documentation but it is still valid for MQL5 ...
Requirements and Limitations in Making Trades - Appendixes - MQL4 TutorialStopLevel Minimum Distance Limitation.
A trade operation will not be performed if any of the following conditions is disrupted.
Order Type
Open Price StopLoss (SL) TakeProfit (TP) BuyModification is prohibited Bid-SL ≥ StopLevel TP-Bid ≥ StopLevel SellModification is prohibited SL-Ask ≥ StopLevel Ask-TP ≥ StopLevel BuyLimitAsk-OpenPrice ≥ StopLevel OpenPrice-SL ≥ StopLevel TP-OpenPrice ≥ StopLevel SellLimitOpenPrice-Bid ≥ StopLevel SL-OpenPrice ≥StopLevel OpenPrice-TP ≥ StopLevel BuyStopOpenPrice-Ask ≥ StopLevel OpenPrice-SL ≥ StopLevel TP-OpenPrice ≥ StopLevel SellStopBid-OpenPrice ≥ StopLevel SL-OpenPrice ≥ StopLevel OpenPrice-TP ≥ StopLevel
FreezeLevel Limitation (Freezing Distance).
Market orders can not be closed if the StopLoss and TakeProfit values violate the FreezLevel parameter requirements.
StopLoss or TakeProfit orders can not be modified if StopLoss or TakeProfit values violate the StopLevel parameter requirements.
Pending orders can not be deleted or modified if the declared open price violates the FreezeLevel parameter requirements.
Order Type
Open Price StopLoss (SL) TakeProfit (TP) BuyModification is prohibited Bid-SL > FreezeLevel TP-Bid > FreezeLevel SellModification is prohibited SL-Ask > FreezeLevel Ask-TP > FreezeLevel BuyLimitAsk-OpenPrice > FreezeLevel Regulated by the StopLevel parameter Regulated by the StopLevel parameter SellLimitOpenPrice-Bid > FreezeLevel Regulated by the StopLevel parameter Regulated by the StopLevel parameter BuyStopOpenPrice-Ask > FreezeLevel Regulated by the StopLevel parameter Regulated by the StopLevel parameter SellStopBid-OpenPrice > FreezeLevel Regulated by the StopLevel parameter Regulated by the StopLevel parameter
- book.mql4.com
You are ignoring the Stops Level and Freeze Level. The following is from the MQL4 documentation but it is still valid for MQL5 ...
Requirements and Limitations in Making Trades - Appendixes - MQL4 TutorialStopLevel Minimum Distance Limitation.
A trade operation will not be performed if any of the following conditions is disrupted.
Order Type
Open Price StopLoss (SL) TakeProfit (TP) BuyModification is prohibited Bid-SL ≥ StopLevel TP-Bid ≥ StopLevel SellModification is prohibited SL-Ask ≥ StopLevel Ask-TP ≥ StopLevel BuyLimitAsk-OpenPrice ≥ StopLevel OpenPrice-SL ≥ StopLevel TP-OpenPrice ≥ StopLevel SellLimitOpenPrice-Bid ≥ StopLevel SL-OpenPrice ≥StopLevel OpenPrice-TP ≥ StopLevel BuyStopOpenPrice-Ask ≥ StopLevel OpenPrice-SL ≥ StopLevel TP-OpenPrice ≥ StopLevel SellStopBid-OpenPrice ≥ StopLevel SL-OpenPrice ≥ StopLevel OpenPrice-TP ≥ StopLevel
FreezeLevel Limitation (Freezing Distance).
Market orders can not be closed if the StopLoss and TakeProfit values violate the FreezLevel parameter requirements.
StopLoss or TakeProfit orders can not be modified if StopLoss or TakeProfit values violate the StopLevel parameter requirements.
Pending orders can not be deleted or modified if the declared open price violates the FreezeLevel parameter requirements.
Order Type
Open Price StopLoss (SL) TakeProfit (TP) BuyModification is prohibited Bid-SL > FreezeLevel TP-Bid > FreezeLevel SellModification is prohibited SL-Ask > FreezeLevel Ask-TP > FreezeLevel BuyLimitAsk-OpenPrice > FreezeLevel Regulated by the StopLevel parameter Regulated by the StopLevel parameter SellLimitOpenPrice-Bid > FreezeLevel Regulated by the StopLevel parameter Regulated by the StopLevel parameter BuyStopOpenPrice-Ask > FreezeLevel Regulated by the StopLevel parameter Regulated by the StopLevel parameter SellStopBid-OpenPrice > FreezeLevel Regulated by the StopLevel parameter Regulated by the StopLevel parameter
Thank you for pointing me in the right direction Fernando. In case it's helpful to anyone else implementing SYMBOL_TRADE_STOPS_LEVEL overcame my issue.
double stopLevel = SymbolInfoInteger(_Symbol, SYMBOL_TRADE_STOPS_LEVEL) * _Point; double buyPrice = NormalizeDouble(ask + stopLevel, _Digits); trade.BuyStop(lotSize, buyPrice, _Symbol, sl, tp, ORDER_TIME_DAY)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I am attempting to upload my EA to the Market place and I keep getting this validation error. I don't really see the issue since my price / sl / tp all appear to be valid. Any help would be much appreciated.
I cannot reproduce in my strategy tester.
Here is validation output: