Close At Profit EA

To add comments, please log in or register
jacktrader
87
jacktrader  

Hi Guys,

FOund this ea from mql4 but i figured it could be much better if someone could modify it to close trades base on pip value rather than account currency.

Thanks in advance for helping out.

Files:
William Snyder
9396
William Snyder  
jacktrader:
Hi Guys,

FOund this ea from mql4 but i figured it could be much better if someone could modify it to close trades base on pip value rather than account currency.

Thanks in advance for helping out.

Hi Jacktrader,

Try this please

Files:
jacktrader
87
jacktrader  

Hi Mrtool,

Thanks for your help. I tried the ea but it is still not working as i want. Maybe i should elaborate a bit more in detail. Please see attached picture for better example. I would like the ea to close any trade that reach the profit level (as according to setting in SetProfitToclose) instead of all trades when certain profit level reached.

thank you

Files:
untitled.jpg 125 kb
William Snyder
9396
William Snyder  
jacktrader:
Hi Mrtool,

Thanks for your help. I tried the ea but it is still not working as i want. Maybe i should elaborate a bit more in detail. Please see attached picture for better example. I would like the ea to close any trade that reach the profit level (as according to setting in SetProfitToclose) instead of all trades when certain profit level reached.

thank you

Hi Jacktrader,

Have you tried AllSymbols = false, looking in the code think it should close trades by separate symbol when SetProfitToclose is hit.

jacktrader
87
jacktrader  

Hi Mrtool,

sorry what i meant was when each trade reach the TP or SL say for example 0.1 pip then the EA will close only that trade when it has reached its TP or SL in pips. Because the current EA closses all the trades only when the basket profit is reached.

Mladen Rakic
106510
Mladen Rakic  

...

Here is a simple EA that will do exactly what you need.

It has only 2 parameters : CloseAtPipsProfitand AllSymbols.

- if AllSymbolsis set to true it will look into every order, otherwise it will test only the chart symbol for profits

- if CloseAtPipsProfitis set to 0 it will examine each and every order and in combination with AllSymbols, if the profit is equal to or greater than the required one in pips, it will close the order

PS: this EA adds up order profit, order swap and order commission in order to get a real profit (it is not ignoring the swap and commission) so, in cases when commission and/or swap is present, the difference between order close price and order open price in pips might differ from the CloseAtPipsProfit parameter but the profit will be correct. Also default profit in pips is set to 0, so do not forget to set it to desired value when starting the EA

jacktrader:
Hi Mrtool, sorry what i meant was when each trade reach the TP or SL say for example 0.1 pip then the EA will close only that trade when it has reached its TP or SL in pips. Because the current EA closses all the trades only when the basket profit is reached.
jacktrader
87
jacktrader  

thanks mladen!

the EA works great as i wanted.

could you do me another favor, im testing another EA and everything seems alright except the EA doesn't have any stoploss function. I am wondering if you can take a look for me on the other thread, and add a stoploss function with it. Thanks alot!

you can see it here

Files:
Mladen Rakic
106510
Mladen Rakic  

...

Added initialStopLoss parameter, so if you specify a initial stop loss > 0 it will apply it to an order when it is opened, otherwise it will work as before.

PS: initialStopLoss is in pips

jacktrader:
thanks mladen!

the EA works great as i wanted.

could you do me another favor, im testing another EA and everything seems alright except the EA doesn't have any stoploss function. I am wondering if you can take a look for me on the other thread, and add a stoploss function with it. Thanks alot!

you can see it here
Files:
jacktrader
87
jacktrader  

great stuff! mladen.

one more quick question, how to code the ea if i wish to input hiddel tp/sl?

I am trying to code the ea myself, still in learning progress but would be great if you could teach me and help me with it. Thanks for your fast reply.

Jack

Mladen Rakic
106510
Mladen Rakic  

...

jack

What we usually refer to as "hidden tp and / or sl" is simply an EA that close an order when some level of loss or profit is reached without applying the "hard" stop loss or take profit. EA from post #4 of this thread works like that so it can be used as a model how to apply "hidden" take profit. The hidden stop loss would be if you check if the profit is less than some negative value and in that case it would be as if you have applied a usual (non-positive - since with trailing stops stop loss can reach the positive zone too) stop loss

jacktrader:
great stuff! mladen.

one more quick question, how to code the ea if i wish to input hiddel tp/sl?

I am trying to code the ea myself, still in learning progress but would be great if you could teach me and help me with it. Thanks for your fast reply.

Jack
jacktrader
87
jacktrader  

Thanks mladen.

i will take a look at that model and try to learn the hidden sl/tp code. As far as i know, hidden tp/sl allows the user to close trade even it is smaller that +1 pips profit because the broker doesn't allow take profit point any smaller than 2 or 3 pips perhaps, in other way, scalping. Am i right?

Thank you very much for replying.

Jack

To add comments, please log in or register