Ernest Klokow: I have an EA that places BuyLimit and SellLimit trades. Most of the time there is no problem and the trades are placed successfully. But every now and then there is a trades that refuses to go through and ndlessly giving an "invalid stops" error. The problem is I define NO specific SL or TP. They are both set at "0". This is so frustrating! Can anybody help me?
You have to consider the contract specifications for the Freeze Level and Stops Level. Please read the following ... Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
- book.mql4.com
Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
- Ernest Klokow: I have an EA that places BuyLimit and SellLimit trades.
There is no need to create pending orders in code.
- 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.)
Don't worry about it unless you're scalping M1 or trading news.
-
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.
- 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.)
- Ernest Klokow: Can anybody help me?
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) or attach the source file.
We can't see your broken code.
With the information you've provided — we can only guess. Which Fernando already did.
Thanks for that info. I inserted the following code and so far I have had no errors. Hold thumbs!
if(Ask - LimitBuyPrice < StopLevel * _Point || LimitBuyPrice >= Ask) LimitBuyPrice = Ask - (StopLevel * _Point); if(LimitSellPrice - Ask < StopLevel * _Point || LimitSellPrice <= Bid) LimitSellPrice = Bid + (StopLevel * _Point);
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
I have an EA that places BuyLimit and SellLimit trades. Most of the time there is no problem and the trades are placed successfully. But every now and then there is a trades that refuses to go through and ndlessly giving an "invalid stops" error. The problem is I define NO specific SL or TP. They are both set at "0".
This is so frustrating! Can anybody help me?