Create EA with partial take profit
-
I am trying to créate an EA with SL, TP and Parcial TP. Below have an example, I put a simple EA with moving average crosses:
Example:
Buy stock Price; $ 20,00
Stop Loss: 8%
Take Profit: 10%
Parcial Take Profit: 5%I tested with SL and TP and it is good, but I don´t know how can I put parcial take profit in %. The same with trailling Stop (or break even), I dont know how can I put in %. In pips is easy, but in % I don´t know how.
Here is an example that I am trying:
https://fxdreema.com/shared/uWt9FFLWb
Can you help me?
Thank you! -
Could you clarify this condition: "Parcial Take Profit: 5%"?
5% of what: TP, SL?
-
5% of entry price
-
Let's take a look at your Project.
I have changed the size of the postions (1 lot) and the EA is trading "Once per bar".

GBPUSD H4
Entry Price = 1.61728
SL Price = 1.74666 {= 1.61728 x(8%)} --> 1293.8pips
TP Price = 1.29382 {= 1.61728 x(-20%)} --> 3234.6pipsThe EA opens the trade as you expect.
3% of Current SL = 1293.8pips x 3% = 38.81pips --> Partial TP (1) = 1.61728 - 38.81pips = 1.613399

It works as expected. If the EA is evaluated with Every Tick, it would close partially the trade at 1.61335. For this case, it closes the trade partially at the begining of next bar.
Then, what you would like is a partial trade close when the profit reaches 5% of Open Price.
Partial TP Price (1) = 1.536416 {= 1.61728 x(-5%)} --> 808.6pips
The goal is to calculate how many pips belongs to a 5% of the Open Price in profit direction to be used in the "pips away from open-price" block.
The next might be an approach that works as expected




https://fxdreema.com/shared/1Bg0OYPTc
Of course, there are different options to get what you want and fxDreema allows you to investigate easily across many alternatives.
-
Thank you! Regards!