- The code you supplied is insufficient to be able to test and recreate the conditions that cause the problems mentioned.
- One clue, is that you mention error 130, which could indicate that you are not testing for the Minimum Stop conditions set by your broker, namely the MODE_STOPLEVEL size (check MODE_FREEZELEVEL too).
- Another, clue is that you are using the Bid price to calculate the Take-Profit (and maybe even the Stop-Loss) on a SELL_STOP order, but a Sell order will close at the Ask price, meaning you are not compensating for spread.
- One more clue, is error 3, which means that there are invalid parameters like volume or opening price:
- For the Opening Price and stops, remember that Buy orders open at Ask and close at Bid, while Sell orders open at Bid and Close at Ask. Also make sure the prices are aligned with the tick size (MODE_TICKSIZE). Don't just "NormalizeDouble()" without understanding the ramifications (search here on the forum as there is plenty of debate on that issue).
- For Volume, always check the market variables to make sure your parameters are valid, such as MODE_MINLOT, MODE_MAXLOT, MODE_LOTSTEP.
Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it.
It's use is always wrong
- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
- Lot size must also be adjusted to a multiple of LotStep. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
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 all,
I am struggeling with an error I constantly get from the order execution.
double BidPrice = NormalizeDouble(Bid, Digits);
The order is being executed, but then MT4 does not react anymore (so far I always cancelled further backtests as I doubt there will be any reactions anymore). The error I get as well is error 0.
Also if I replace BidPrice by Bid only, there is no change.
If I change the SellingPrice variable to the following:
I receive error #130.
On the live testing I received error #3 today with the following code:
Does anyone have any idea?