my qustion is about error 4108 that kills my trade.
i get the order ticket by orderslect and then issue the ordererdelete function
You can get error 4108 for a number of reasons, including an attempt to delete an order which you have already successfully deleted. For example, if you call OrderDelete() twice with the same ticket number, the second call will fail. In essence, error 4108 seems to mean "either the ticket number is simply not valid, or the order is not valid for the action you are trying to perform on it".
now is this ea system a proffesional tool or just a nice marketing gimic, for tyoing and hvaing fun. ??!!
Both.
What about using the GetLastError() - Function. It gives you more information about the reason the error occured....
If you never used it befor have a look here:
https://docs.mql4.com/check/GetLastError
Good luck
EP
Post your code if you will.
However, I've seen this being caused by the loop you use to cycle through orders incrementing rather than decrementing.
It can cause the behaviour jjc mentions above.
Look for something like i++ to indicate that this is your problem. In that case you'll need to turn your loop around to start counting downwards using the following as your index -> (total number of orders -1) to 0 inclusive.
CB
I added some additional filters in my EA to get rid of that. but what cloudbreaker said was spot on.. its your loop
I have the same Issue but I'm not doing any loop over open open trades. I have an array of orders to close and I send a ticcket to Close Function.
I Attach an image where you can see the code, the values of the variables involved and the terminal info of the trades after trying to close an order with error 4108.
As you can see (sorry for the picture) ticket, Price, Lots, etc were alright. Does anyone know what happened?
- You are calling OrderClose for a pending order. OrderClose closes open orders. OrderDelete deletes pending orders.
-
Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it.
It's use is always wrong
- SL/TP are market orders when triggered, they don't need to be normalized, only 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
- Only the 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.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi, folks
I'm really impressed with the deep knowledge expressed in the forum
my qustion is about error 4108 that kills my trade.
i get the order ticket by orderslect and then issue the ordererdelete function
to kill a pending sellstop order. most of the times i get the 4108 error, now is this ea system
a proffesional tool or just a nice marketing gimic, for tyoing and hvaing fun. ??!!
thank you.