Stop Loss Reference
-
Hi anyone,
I am new and still learning to build EAs on fxdreema. Part of my EA works to reduce the loss amount buy entering an opposite trade. I however don't know how to make this new trade position use the 'parent trade' TP as it's Stop Loss. Any help will be greatly appreciated -
You need to store the value of the initial trade into a variable so that it can be used as you need. Are you familiar with using variables?
-
I'm not familiar with variables
-
That makes it more difficult. Can you please share the link to your project?
-
here's the link. Any help will go a long way.
shared/gm1eh0cQc -
You can begin by substituting blocks 87 and 90 by using 'for each trade' blocks instead.
-
okay, then what next?
-
Is the bot working now?
-
the bot works. I needed a way to reference the stop loss of the new trades to the parent trade
-
Can you please share the link to the latest version? We'll continue from there.
-
here's the link
https://fxdreema.com/shared/ai448wmH -
You need to use the 'on trade' tab for sure. My question is. How can you define the 'parent trade' exactly? Do you mean the recently closed trade only? I mean the last trade closed by hitting its SL only?
-
The parent trade would be the first trade that was made. when it comes to adding winning trades, it is easy to do using 'add volume' block. but when trades are losing there's no opposite block that would "reduce volume" by adding an opposite.
-
Ok. Now it's clear to me. Now let's focus on that 'first trade'. We can store its ticket number into a variable as well as other requested info, but the problem is how many 'subsequent' trades are possible and when the first one is supposed to be closed so that a new 'first one' is open. Could you please elaborate?