• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 7:13am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 7:13am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

MT4 Draw Symbol instead of Arrow, Draw n instead of square 2 replies

Closing mt4 orders one time for all 1 reply

Stop orders instead of limit orders 0 replies

EA for closing all pending orders 4 replies

Script: Closing All Orders 8 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 1
Attachments: Closing all orders immediately instead of one at a time
Exit Attachments

Closing all orders immediately instead of one at a time

  • Post #1
  • Quote
  • First Post: Jan 16, 2009 2:18am Jan 16, 2009 2:18am
  •  urbanFX
  • | Joined Sep 2008 | Status: Forex Alchemist | 116 Posts
Hi All,

I wonder if somebody could help me out. I've been using a EA for the last little while that works great, except for the fact that it closes out the orders one at a time. This causes a problem if I'm trading some of the more volatile currencies, sometimes a profitable trade turns into a loss by the time all the trades have closed out.

How can I change the EA that the trades all close out instantaneously instead of one at a time? I remember playing around with an EA from here a little while ago that closed all orders like that, just wonder how to accomplish it in the one I'm using now.

Thanks in advance for the help!
"The market giveth and the market taketh away"
  • Post #2
  • Quote
  • Jan 16, 2009 2:20am Jan 16, 2009 2:20am
  •  luxinterior
  • Joined Nov 2006 | Status: MT4 EA Coder Since 2006 | 300 Posts
I don't believe it's possible as tasks are executed as they arrive at the server and the next task will not happen until the previous one has succeeded or failed.

Lux
MT4 EA, Indicator and Alert Coder Since 2006
 
 
  • Post #3
  • Quote
  • Jan 16, 2009 2:36am Jan 16, 2009 2:36am
  •  urbanFX
  • | Joined Sep 2008 | Status: Forex Alchemist | 116 Posts
Not sure about that. The EA I'm using now works loosely on a martingale scenario and opens a new trade every X pips, when the final trade take profit all of them are closed, from newest to oldest, one at a time.

The previous EA I was using, which unfortunately just didn't have all the features of the new one, closed out differently. Each time it opened a new trade it changed all the previous trades TP levels to that of the latest trade, once one of the trades took profit they all did due to the fact that they all had the same TP level. Sure, there was minimal slippage, but not nearly what there is now. On average the slippage that I get closing the way I do now can range anything from 10 to 30 PIPS.

Hope this all made sense and thans for the contribution.
"The market giveth and the market taketh away"
 
 
  • Post #4
  • Quote
  • Jan 16, 2009 6:32am Jan 16, 2009 6:32am
  •  Zen_Leow
  • Joined Jun 2008 | Status: Programming for a better future. | 649 Posts
No what you want can't be done. I'm afraid an EA can only send 1 command at a time to the broker's server. which means trades can only be closed via EA in sequence and never simultaneously. unless like you said, its the case of them all hitting the same SL or TP. But that's not controlled by the EA but by your broker's server.
Programming for a better future.
 
 
  • Post #5
  • Quote
  • Jan 16, 2009 7:00am Jan 16, 2009 7:00am
  •  mniemiec
  • | Joined Aug 2006 | Status: MIR | 82 Posts
Just put this in the script folder and it will close all your trades when you double click on it!!!!!!!!!!!!!!
Attached File
File Type: mq4 close open.mq4   1 KB | 327 downloads
MIR
 
 
  • Post #6
  • Quote
  • Jan 16, 2009 7:40am Jan 16, 2009 7:40am
  •  piccolo
  • Joined Feb 2006 | Status: adjust your sails to the wind | 1,354 Posts
in metatrader orders have to be closed one by one. you can close partial orders, tho. not that it helps in this case.
 
 
  • Post #7
  • Quote
  • Jan 16, 2009 7:49pm Jan 16, 2009 7:49pm
  •  jaws810
  • | Joined Jan 2009 | Status: Member | 277 Posts
I don't know much about EAs but shouldn't it be possible to keep a count of all the orders opened and then when the close command is sent use the count to close all orders at once. Here is an example five long trades are initiated and after each one is complete the counter increases by one, Then the single close command would be sell 5x the standard number of lots traded. This should work unless you are using hedging or the number of lots changes from trade to trade.
 
 
  • Post #8
  • Quote
  • Jan 16, 2009 10:45pm Jan 16, 2009 10:45pm
  •  Zen_Leow
  • Joined Jun 2008 | Status: Programming for a better future. | 649 Posts
Quoting mniemiec
Disliked
Just put this in the script folder and it will close all your trades when you double click on it!!!!!!!!!!!!!!
Ignored
that's not what the threadstarter wants
Programming for a better future.
 
 
  • Post #9
  • Quote
  • Last Post: Jan 16, 2009 10:48pm Jan 16, 2009 10:48pm
  •  Zen_Leow
  • Joined Jun 2008 | Status: Programming for a better future. | 649 Posts
Quoting jaws810
Disliked
I don't know much about EAs but shouldn't it be possible to keep a count of all the orders opened and then when the close command is sent use the count to close all orders at once. Here is an example five long trades are initiated and after each one is complete the counter increases by one, Then the single close command would be sell 5x the standard number of lots traded. This should work unless you are using hedging or the number of lots changes from trade to trade.
Ignored
unfortunately, most MT4 brokers don't work that way. when you place short orders in presence of long orders. they don't cancel each other off. you'll just have both long and short trades running in your trade pool.

What you've talked about is more of ECN type of execution.
Programming for a better future.
 
 
  • Platform Tech
  • /
  • Closing all orders immediately instead of one at a time
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2022