OrderClose function, Help! - page 2

 

Does it matter if I have several open orders it should close? Or does the orderclose function only close 1?

 
OneandOnly666:
Ok, thanks. By the way, what was I doing wrong in the first orderclose code I sent you?

Please read my reply again : it is explained in it what was your error

 
OneandOnly666:
Does it matter if I have several open orders it should close? Or does the orderclose function only close 1?

OrderClose() function itself closes only one order (the one specified by the order ticket) For a case when you need to close multiple orders, you have to call OrderClose() for each and every order that needs to be closed

 
mladen:
OrderClose() function itself closes only one order (the one specified by the order ticket) For a case when you need to close multiple orders, you have to call OrderClose() for each and every order that needs to be closed

My EA have to close multiple orders but buy only and sell only, according to the BBtrend and matrend.

There are scripts that closes all sell and all buy orders with case function.

Can that be inplemented in an EA code?

 
OneandOnly666:
My EA have to close multiple orders but only and sell only.

There are scripts that closes all sell and all buy orders with case function.

Can that be inplemented in an EA code?

In that code snippet you have a loop that is going through all opened orders and, instead of having case structure, you have 2 ifs that are determining if a currently selected order is a buy or a sell order (you don't need a case structure if there will be just buy or sell orders). So you have all the elements of those scripts (up to a possibility to close multiple orders if needed) that you are mentioning in that code snippet. Simply apply it on a right place with right conditions and it will do the job

 
mladen:
In that code snippet you have a loop that is going through all opened orders and, instead of having case structure, you have 2 ifs that are determining if a currently selected order is a buy or a sell order (you don't need a case structure if there will be just buy or sell orders). So you have all the elements of those scripts (up to a possibility to close multiple orders if needed) that you are mentioning in that code snippet. Simply apply it on a right place with right conditions and it will do the job

Ok, I understand.

Can I send my EA to you on a private message?

Dont want everybody else to have it.

Maybe there you will see what I mean with my EA and how it works.

English isnt my native language and I dont allways understand everything and cant express myself fully eather.

Reason: