How to take profit using indicator
-
Please help,
I want to build an EA that takes profit using an indicator. so from the attached image, if I buy at the bottom where the arrow is and I want to take profit further up when the candle crosses x< the ema or adx indicator above a certain price level ( where the circles are. it could be any of the circle. this is just to illustrate). so in steps it will be:- let's say I Buy
- let's say the price has gone up 2x the stoploss distance.
- the candle crosses x< the adx/ema indicator
- TP
I did my search on the forum and came across this:
https://fxdreema.com/forum/topic/9640/how-to-make-tp-take-profit-a-variable-based-on-an-indicator?_=1683643943502
But it didn't really help. if someone can give me just and example on how i will stack those blocks together.
Thanks in advance.

-
Before doing anything you need to check if the indicator repaints, because if it does, the bot is doomed.
-
Yeah i checked, it doesn't repaint. it's quite easy doing it manually with the eyes. once the price is above certain level and price crosses x< the indicator you exit but programming it, it's a bit tricky. the yellow line is the ema. even if TP using the ema i will still be the same principal. please if you can help me.
-
Ok. Did you create any initial project?
-
Hi, Sorry I was away. I got stuck here when I was building it so I haven't done the Selling section
https://fxdreema.com/shared/dv2mpR98 -
You can remove the OR block number 15. Your current connections are achieving the same effect. Do trades open as you want?
-
Yes, Trades do open as i want, I added another formula block that subtract the SL from the EMA than times it by 2 for the TP. I need help with closing the trade. as i stated in the question. how do i close a buying trade once the price has gone up twice the SL than the price crosses back down x< the adx indicator. As you can see I managed to do step 1 &2. I'm already calculating the x2 SL for my TP now it just implementing the x< above the TP (x2 SL) thanks
-
Could you please upload a screenshot with a numeric example of what you need? I don't fully understand that SL calculation.
-
-
Are you sure Buffer0 of the indicator HMA is the value you want?
-
I gave as an example, an example of closure using indicator, you edit condition .
-
Hello, I think there's a misunderstanding. My issue is about exit not entry.
I have attached a new link where I over simplified the EA. i also attached two pictures to explain it better.
Pic 1

Pic 2

Link
https://fxdreema.com/shared/lh4RO3mJbthere are two steps for the exit i want.
- Price is at least x2 greater than the stop loss.
- Price crosses back the MA indicator.
As you can see I'm only on step1
What i want is to exit the trade when the market crosses x< the MA but only if the market is atleast x2 higher the value of the SL so if the market crosses the MA but it's lower than x2 SL value the trade shall continue. thanks for all your assistance so far.
-
https://fxdreema.com/shared/b96swwxEc
Can you review it, maybe it will be a clue for the solution. -
Hi thank you for the suggestion but I still couldn't figure it out. can someone Help please