
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 am attempting to write my first EA, and have read the documentation and the MQL4 tutorial book. I believe I understand about minimum stop distances.
But try as I might, I'm still getting Error 130 when I submit my orders, and I don't understand why.
Here is the code:
minDistance = MarketInfo(Symbol(), MODE_STOPLEVEL);if (Debug) Print("Sending Sell Order: ", Lots_New, " lots at ", DoubleToStr(Bid, Digits),
" with Stop at ", DoubleToStr(SL, Digits), " and TP at ", DoubleToStr(TP, Digits));
if (Debug) Print("STOPLEVEL = ", DoubleToStr(minDistance, Digits));
SL = NormalizeDouble(SL, Digits);
TP = NormalizeDouble(TP, Digits);
Ticket=OrderSend(Symbol(),OP_SELL,Lots_New,Bid,2,SL,TP,"",MN);
And here are some typical log results:
Sending Sell Order: 2.12 lots at 1.35846 with Stop at 1.35957 and TP at 0.00000
07:03:05 QuickScalp EURUSD,M1: STOPLEVEL = 1.00000
This is on a demo account at FinFx. This is SELL order, and clearly the stop (1.35957) is greater than the Bid price (1.35846) by much more than the required minimum level. The order is being entered without a take profit level.
Why am I still getting the Error 130?
Any help would be appreciated.