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. ??!!
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. ??!!
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:
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.
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?
To add comments, please log in or register