MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Source code library - Expert Advisors, Indicators and Scripts

Hundreds of Forex Robots from MetaTrader Market at Your Service
To post a new code, please log in or register

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2007.11.21 04:35
Close Orders

Close Orders - script for MetaTrader 4

| English Spanish Portuguese Russian

votes: 1




    Close all multi currency open orders and cancel pending orders according to various scenarios. Slippage for open orders is calculated for each currency.
    Choose only one scenario per visit, the script processes the first menu item selected.

    Last comments | Go to discussion (22)
    MQL4 Comments
    mql4_comments | 16 Sep 2008 at 01:09
    Does this script close just the orders from the currently viewd pair/chart, or does it close all open orders in the terminal regardless of how many pairs are being traded?
    Edward Hirsch
    sxTed1 | 21 Sep 2008 at 12:36
    chris phs, sorry for the delay I only check mail at the week end, if open orders are EURUSD and USDJPY and current chart where the script is launched from is GBPUSD then orders for EURUSD and USDJPY will be closed.
    Edward Hirsch
    sxTed1 | 21 Sep 2008 at 12:38
    bnbb2004, thank you for the compliment.
    James Malwitz
    Jedimedic77 | 4 Dec 2008 at 00:37
    thanks, but i don't understand how system works. qeuity was 6900 i set up 5000 (level after close orders). system closed orders but queity was 3900. when i type 3000 (level of lost), every order is automaticly close. it doesn't matter quantity 100k, 50k, 10k. what should i put that system works good?

    hey, the problem that you are experiencing is so simple that you are overlooking the solution, this EA is essentially an "Oh Crap i need to get out" button. When loaded as an EA on any one chart it will close orders opened from any other source regardless of chart. it is meant to be loaded onto a chart with EAs disabled and than when the trader expects the market to change detrimentally to the traders profits or the trader for some reason desires to close all his or her positions in total or of a particular type at once rather than individually and manually which takes time, the trader only has to enable EAs via the button nect to the open order button and all the orders will be closed according to the settings of the EA. Now if the EA button is left in the enabled position any order that is open will be immediately closed additionally this EA doesn't play well with other EA's loaded onto other charts because it is global in its nature and chart irrespective. There is your answer.

    Good Luck


    MQL4 Comments
    mql4_comments | 2 May 2011 at 16:45
    can we close orders open only on the window we drop the script on ? Thank you.