How to add a common TP price for a group of trades
-
I have an EA that is simply based on DCA averaging. It will simply add more trades if the price goes against us. Every time an additional trade is entered, the EA will adjust the TP price for all trades; however, the TP price is always the same for all the EAs. I wonder how can I do something like this with fxdreema.
Here is an example how it happens:

See that both the trades have the same TP price. -
@vish You can calculate the new TP into a variable and then use this:

-
I am aware of this block. My question is actually how you get this new TP price. Let's say you have 3 on going trades that were opened at three different prices and three different lot sizes. And under EA settings I can set a TP in pips. Let's say the TP is 10 pips. And then this EA calculates a TP price that will be a common average TP price while achieving 10 pips profit combining all three trades, their open prices and lot sizes.
I can currently do it with Check Profit (unrealized) block:

But in this method, there is no TP line on MT4 and trades go on without TP line (TP is virtual). I want to calculate this price when a trade is opened and then place hard TPs on trades with the way you proposed with an "OnTrade" event.
Can you help on this?
-
As @l-andorrà comments, you must create and calculate it with a variable, for better performance use the mql4 / 5 code block and create the variable and modify it in that block, there are no specific blocks already generated in fxDreema, you must create it yourself.
-
@xyon126 Exactly, you will need a specific structure to do that. The only way to create a hard TP is calculating the proce value first and then use the pink blocks to put it on the chart.
-
@l-andorrà Please how do I calculate the price value to use as a variable? Say my TP is 10 pips?
-
@betapips That depends on how that TP is supposed to be calculated. Will it be a fixed distance only? And from which reference price will it considered? Do you mean 10 pips from the first open price, for example?
-
@l-andorrà yes please can you how to do it?
-
@mdfaculty As I said one year ago, that depends on what you exactly want.

-
@l-andorrà OK. Please can you tell me what the "create Area" is used for?
-
@mdfaculty It is used to include some blocks within that are supposed to be moved together when moving that area on the builder.
-
@l-andorrà that's all it does? Another question please how can I modify my open trade take profit to break-even or open price after going 15pips in loss?
-
@mdfaculty Yes, that is all it does. You will need a 'For each trade' block and then selecting the corresponding condition blocks below it. What conditions are specifically necessary for that.
-
@l-andorrà I did that by using three blocks after my buy or sell condition is fulfilled. Here is how:
- For each trade block, connected to
- Pips away from open price block(-15pips), connected to
- Modify stop block(Take profit to Open price parent trade). (Note: I have this same three block setup added to the strategy except that the third block is "add volume block" which adds a trade every -5pips from current open price trade)
My problem now is, it will only modify the first 3 trades to parent open price which is what I want but it doesn't modify the rest trades or every new trades that open should have the parent open price as take profit when the market goes more than -15pips in loss until it comes back and hit the parent open price which is now take profit and close all open positions whether it's a buy or sell. How can I solve this problem?
-
@vish do you still have access to this setup? I actuallly need exactly this.
-
@urielacosta Calculate a weighted average price considering different prices and lot sizes and then add a TP in pips to this WA price which should be the common TP. But you need to do custom coding. I never tried that on fxdreema.