Scripts: Close Pending Orders.mq4

 

Close Pending Orders.mq4:

This script can close all your pending orders in your MT4, or you can select different pending orders.

Author: George Alexander

 

I don't trust this code...

if (deleted==false) Print ("Error: ",  GetLastError());

when deleting of the selected trade fails

the only thing the code is doing

printing 'Error: ....'

It is not handling the error to delete the trade for cases like ERR_BROKER_BUSY or ERR_TRADE_CONTEXT_BUSY

the code is only trying once to delete the trade and will not give info what trade is failing to delete and there is nothing

when it fails to try again deleting that trade

It simply keep the pending trade that fails with trying once to delete

Also you could add inside the code

if(OrderType < 2)continue;

It looks to me you were only advertising your website adding this code to Code Base

 
deVries:

I don't trust this code...

if (deleted==false) Print ("Error: ",  GetLastError());

when deleting of the selected trade fails

the only thing the code is doing

printing 'Error: ....'

It is not handling the error to delete the trade for cases like ERR_BROKER_BUSY or ERR_TRADE_CONTEXT_BUSY

the code is only trying once to delete the trade and will not give info what trade is failing to delete and there is nothing

when it fails to try again deleting that trade

It simply keep the pending trade that fails with trying once to delete

Also you could add inside the code

if(OrderType < 2)continue;

It looks to me you were only advertising your website adding this code to Code Base

Thanks for your input, but I don't think it worth it to add error handling to this script. If some orders are not deleted, you can just drag the script to the chart again.

If somebody will ask for that, I'll do it.

 
thinktrusttrade:

Thanks for your input, but I don't think it worth it to add error handling to this script. If some orders are not deleted, you can just drag the script to the chart again.

If somebody will ask for that, I'll do it.

OK, then I'll ask ....

Please add error handling to this script

Because if you wanna advertise your website with its forex lessons and free tools then i think you should provide good tools

Just drag the script to the chart again when a pending trade is not deleted is a solution you don't expect

from someone giving forex lessons and free tools on the website he or she is advertising.

I think bad coding shouldn't belong into CodeBase.

 
deVries:
thinktrusttrade:

Thanks for your input, but I don't think it worth it to add error handling to this script. If some orders are not deleted, you can just drag the script to the chart again.

If somebody will ask for that, I'll do it.

OK, then I'll ask ....

Please add error handling to this script

Because if you wanna advertise your website with its forex lessons and free tools then i think you should provide good tools

Just drag the script to the chart again when a pending trade is not deleted is a solution you don't expect

from someone giving forex lessons and free tools on the website he or she is advertising.

I think bad coding shouldn't belong into CodeBase.

You ask for it...? You obviously can do it yourself if you want and seems you have too much free time, so I'll not do it for you.

You really mind that much that short reference to my site?

396 downloads so far and nobody had any problem. Code passed proofreading as well. So please stop bothering me and mind your own business.

 
thinktrusttrade:

You ask for it...? You obviously can do it yourself if you want and seems you have too much free time, so I'll not do it for you.

You really mind that much that short reference to my site?

396 downloads so far and nobody had any problem. Code passed proofreading as well. So please stop bothering me and mind your own business.

Maybe you are not willing it to do for me but you could do it for all others that try to learn how to make a good written program

.

Stop bothering you ?? You are the one that post a Code to CodeBase where everyone can give comments to the post you did....

If that is bothering you then stop advertising your website with your Code that can be done better....

and yes i code myself and i can make such kind of code also better working then this code does

396 downloads or a million downloads will not say that your program is used and well tested.... Not everyone will comment his problem with codes downloaded at codebase

About passed proofreading as well ...

That is no proof your code does what you want us to believe that it has to do

....... CLOSE ALL PENDING that you want to have to close

There are a lot bad written codes inside CodeBase that also passed proofreading and some of them totally useless using to trade forex

So accept the fact to get comments to the Code you post at CodeBase....

I still believe you were only advertising your website adding this code to Code Base and everyone can give its comments

I did ...

 
deVries:
thinktrusttrade:

You ask for it...? You obviously can do it yourself if you want and seems you have too much free time, so I'll not do it for you.

You really mind that much that short reference to my site?

396 downloads so far and nobody had any problem. Code passed proofreading as well. So please stop bothering me and mind your own business.

Maybe you are not willing it to do for me but you could do it for all others that try to learn how to make a good written program

.

Stop bothering you ?? You are the one that post a Code to CodeBase where everyone can give comments to the post you did....

If that is bothering you then stop advertising your website with your Code that can be done better....

and yes i code myself and i can make such kind of code also better working then this code does

396 downloads or a million downloads will not say that your program is used and well tested.... Not everyone will comment his problem with codes downloaded at codebase

About passed proofreading as well ...

That is no proof your code does what you want us to believe that it has to do

....... CLOSE ALL PENDING that you want to have to close

There are a lot bad written codes inside CodeBase that also passed proofreading and some of them totally useless using to trade forex

So accept the fact to get comments to the Code you post at CodeBase....

I still believe you were only advertising your website adding this code to Code Base and everyone can give its comments

I did ...

It's so simple, if you don't like my code, don't use it.

If you want to save the world, create a better one as an alternative. People will love it.

So far it seems you are more passionate about commenting then coding.

Advertising? Come on, what is your problem?

 

I don't know how to code this stuff, and I am not taking sides here. 

But if there is a possibility that this script fails, I agree that it would be nice to have some sort of built-in error checking.

I am thinking of end of trading week, for example, where I might be in a situation where I forgot to close pending orders, and I can just launch a script like this to make sure everything is closed before my broker cuts off any new orders.  a sort of last minute panic-button, if you will. 

It sounds like it is not difficult to code, from your discussion, so I think it might be nice to have... if that doesn't add a lot of processing overhead to mt4.

thanks.  

 

Thank you abundantly.

It helps me cleaning up my messy stop orders.

Reason: