I met this situation before too, StopLoss too small, or slippage pips too small, try to make slippage bigger. untill it works.
May be it's in OrderSend function, or OrderClose function. I solved this already. Beginner too.
order = 3; // Sell Pending Order
Especially, when posting code here, it is a good idea to get into the habit of using enums.
order = OP_SELLLIMIT; // Sell Pending Order
is instantly understood.
currentPrice = currentPriceAsk;
Why are you getting the Ask price for a Sell limit order? Sells are at Bid.
if (currentPrice >= entryPrice)
Current price must be smaller than the entry price for a sell limit
Placing a sell limit order at a lower price than the current price will give error 130
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
Hello guys, just started learning MQL4 programming 2 days ago and I decided to code out an EA based on a strategy that I used to trade after
watching some tutorial videos online. It is still quite raw and needs a lot of adjustment. However, when I run the EA (it should at least work for
the Order Sending part), it keeps returning me back the error code #130. I done some research online and found out the possible reasons could
be the decimal points issue, order needs to be send and modified to have SL/TP and also the SL level being too close to the price. All of which I
had try to solve using NormalizeDouble, creating another function to send and modify immediately afterwards with SL/TP, and checked that the
SL level is more than the market stop loss level. Any advice/tips would be greatly appreciated!!