Distance to Take Profit
-
I am using a hedge account where I open several orders with the respective take profit. I need to find the distance between the current price and the first take profit above the current price and the first take profit below the current price. How can I do this?
I saw that in the "Bucket of Positions / Orders", "Take-profit", "Price Level", "Max value" or "Min value", I can find the distance to the highest and lowest take profit, but there is no way locate the first from the current price. -
@vanderleyfm It depends on several elements. Just two initial questions:
- Are all trades automatically open by the EA or are there manually open trades also?
- How many open trades can the EA have at the same time?
-
When starting the EA, at the predetermined time all orders are placed and, as the price varies, they are opened.
As many orders as I want can be placed. Usually about 200 orders (100 buy and 100 sell - grid type), with the respective take profit -
@vanderleyfm So you confirm no manaul trades are included ever?
-
@l-andorrà I confirm, no manual.
-
@vanderleyfm Ok. Ypu will need some variables to store that info. Can you please share you project?
-
@l-andorrà Yes, I can share, but how do I do it?
-
in builder window, top left "Projects," -> "Create Shared Copy" -> Paste link here.
-
@jsauter86 shared/zi69KIdac
-
@vanderleyfm Wow. That's a very complex project. Reviewing it all would last al lot of time. Let's do this: You can store a TP level by doing this immediately after every buy/sell now block:

You will need as manu variables as open trades. That way you can know exactly the position of every TP level. Then you can this this block to calculate the distance:

-
@l-andorrà On my FxDreema screen there is no option for "For each Trade". Only "For each Position", "For each Pending Order" and "For each Close position" appear.
-
@vanderleyfm I also didn't understand how to use manu variables to find each TP.
-
@vanderleyfm You can use 'For each position'. That is the equivalent of 'For each trade' but for MT5. On how to use variables. I strongly recommend you to read this:
https://fxdreema.com/instructions/builder/constants-and-variables
-
@l-andorrà I know how to use declaring variables. So much so that I used several in my project. What I'm not able to understand is how to use "For each Position" to get the data I need.
-
@vanderleyfm Ok. Then just substitute the block I suggested you in my screenshot by a 'For each position' one and store the TP price as I show there.