MQL4 - automated forex trading   /  

Code Base

Read Financial Magazines in MetaTrader 4 and MetaTrader 5!

Code Base  Expert Advisors  Close at Profit To post a new code, please log in or register

Download MetaTrader 5 and visit MQL5.community Code Base
and Trade on the Go!
and Trade on the Go!
Couldn't find the right code? Order it in the Jobs section

This Expert Advisor is for
MetaTrader 4
Download MT 4 - 455 Kb

and Trade on the Go!

and Trade on the Go!

Name:
Close at Profit
Author: gery18 (2012.02.01 16:05)
Rating: 8
Downloaded: 15307
Download:
 CloseAtProfit.mq4 (14.1 Kb) View

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;
13 comments: 1 2   To post a new comment, please log in or register

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.

17.09.2013 18:14 bakermansell

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.


17.09.2013 18:10 bakermansell

Hi,

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

05.07.2013 00:56 arieldutchess

Very good, thanks

 

11.12.2012 03:11 wdxsh2012

Very good, thanks

 

11.12.2012 03:11 wdxsh2012
Thanks, can you explain detail it? position profit or loss? at how much??
16.05.2012 16:13 walking

Hello

This is a very good EA.

Can you please arrange it so it first closes the position on current symbol where EA is attached and then try to close the other ones?

And if it got a requote it checks the profit again ( of course only for the first position ) and then try to execute its task ?

And another request is that its alarm for manual confirmation be continuous not only one single alarm.

Thank you very much.

16.03.2012 19:09 Dariush

really nce EA

by using loss to close = everybody = serious trader

pls can u add

1/choice of currency base ( € or usd )

2/ REVERSE ALL POSITION yes/no in the menu ( = close pending orders as well )

change the display on the main screen pls

now we see some good info but would prefer to see only 2 butons like here under

  1. one in big with Pnl

if want to catch it before target specified in the menu i just press that buton !

  1. one buton = put stop loss at break even ( if not to complex break even can be > 0 to pay for slippage of execution and spreads )

pls contact me at lerecidiviste@gmail.com if needed

regards

29.02.2012 16:57 lerecidiviste

nice thanks

pls can u add this

1. Closed all Symbols base on " Total profit " ( in dollar )

means :all the total symbols and total trades add together and is in Profit than close " Total profit " ( in dollar )

afther its perfect ..........

regards

29.02.2012 10:20 lerecidiviste

thanks this is good ..

can you add a :

1. Closed all Symbols base on " Total profit " ( in dollar )

means :all the total symbols and total trades add together and is in Profit than close " Total profit " ( in dollar )

16.02.2012 03:52 david2222