multiple tp ( tp1-tp2-tp3)
-
Hi guys how to make a trade with multiple tp 1 - 2 and 3 and move sl to open price when tp 1 hit, move sl to tp1 when Tp 2 hit each tp is 1/3 of the volume
i cant figure it out tried it all with 3 trades partial close doesnt work what i am doing wrong ? -
@charlie66 That's a good one. I'm thinking of it since some times as well. There is a simple solution and there may be some not so easy ones.
The general issue is what happens if you close your terminal or change the settings of EA or casely close your chart and re-open it from the deleted charts. If you work with regular variables, those would be lost in all the stated cases. You might think of terminal variables maybe, but I haven't tried it, yet. The most reliable way would be if you could at any time recalculate your take profit targets, but that depends on how you calculate them.First the simple one: Split your order into 3 orders and each with 1/3 of the lot size. Set your TPs accordingly to your calculations. You may use groups for each different TP target. And finally you create a block path on the onTrade tab, where you do the following. If closed group 1 trade set group 2 and group 3 to BE (or wherever you want it) and so on
If you want to keep 1 order, than as stated above you need to store (or be able to re-calculate) the take profit targets ar any time and store them in variables. You also need to care about the case that EA ghets reloaded while trades are open. Then you'd check if profit target variables have a sensful value and if not you'd recalculate them.
Basically I've done both ways already in some projects. If you have some experience you may chose the second approach. Otherwise I'd recomand to choose the multiple trades option.
-
thx for the explanation I'm not capable of doing it any help appreciated
-
@charlie66
found it with trial and error thx for the inuput -
@charlie66 Ups, sorry I built your project yesterday but forgot to upload. I will send it anyway when I'm in front of my PC.
-
@charlie66 Here you go .. 0_1578696837127_10 pips.mq4
I implemented 2 ways. For BE I use the pips away block like you did. For SL to TP1 on TP2 I implemented on the onTrade tab if the 2nd trade was closed by TP.
I also introduced some constants in order to show how that would look like.

-
@trader-philipps
nicely done i havent finished my project yet i have noticed in your EA is TP1 is hit only the SL from the second trade TP2 moves to BE and not Trade 3i tried to move all SL to BE when tp1 is hit
Thx a lot for you input but first backtest seems to be profitable
-
@charlie66 It should set BE for both. At least it did when I tested it ?!?