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

2012.02.01 15:05
Close at Profit

Close at Profit - expert for MetaTrader 4

| English Spanish Portuguese

Views:
16988
Rating:
votes: 3
Files:

Description:

CloseAtProfit is an EA that I use only to close orders after defined profit, or loss, you can define if to close only trades on current symbol or to close all orders on all symbols, to close only opened trades or also delete pending orders.

I am using it in live trading. I have closed with it more than 200 trades at once, without any problem. The speed of closing depends on time when it trades, on broker you are using and symbols you are trading.

INPUTS:

  • useProfitToClose = true; - if it is true the EA will close trades when the profit is greater than defined profit to close;
  • profitToClose = 20; - the defined profit in account currency, when close trades;
  • useLossToClose =false; - if it is true the EA will close trades when the loss is greater than defined loss to close;
  • lossToClose =100; - the defined loss in account currency, when close trades;
  • AllSymbols =true; - if it is true the EA closes trades on all symbols, if false- only on current symbol where EA is attached;
  • PendingOrders =true; - if it is true the EA closes also pending orders, on all symbols or current symbol depends on AllSymbols setting;
  • MaxSlippage = 3; - maximal allowed slippage in pip;
  • showMenu = true; - if true, EA shows on graph information about open trades, lots and profit;
  • menuColor = Yellow; - color of menu text;
  • variablesColor = Red; - color of variables;
  • font = 10; - font size;
Last comments | Go to discussion (13)
MQL4 Comments
mql4_comments | 11 Dec 2012 at 02:11

Very good, thanks

MQL4 Comments
mql4_comments | 11 Dec 2012 at 02:11

Very good, thanks

MQL4 Comments
mql4_comments | 4 Jul 2013 at 22:56

Hi,

This is a great EA, I use it daily to reach my daily goal but good someone add trailing to this EA, thanks

MQL4 Comments
mql4_comments | 17 Sep 2013 at 16:10

Thank you for this ea. I have been using it. The for loop in the CloseDelete functions never completes because the return comand in each case not only returns the status of the orderclose

but jumps out of the function. I fixed this by using a status flag and then returning the flag at the end of the function. Then the ea was able then able to close more than one order of the same currency pair as the per the for loop design. Thanks again for the ea.

MQL4 Comments
mql4_comments | 17 Sep 2013 at 16:14

Very good ea. The for loop in the CloseDelete function never completes because the return(false); not only returns the order condition but jumps out of the function. I fixed this using a status flag and then all my orders

of the same pair were able to delete as per the for loops design. Thanks again for the ea.