Stop Loss based on the gain value in real time.
-
I would like to know how to make my Stop Loss value always based on the gain value in real time.
For example:
Stop Loss initially defined will be 100 pips and I have $ 100 in value to make my trade.
I must inform in some field through a constant the value that I want to have as a basis to start my trade.
I will inform you as an example $ 100
When I start the trade I have a gain of 50 $ this will increase my current value to $ 150, but of these 150 I would like my stop loss to be 50% of this value, that is to say $ 75.In short, I would like my stoploss to always be 50% of the updated value for each trade.
-

As shown in the image, I thought of something:
A variable should check my current profit
After checking this profit and informing the variable "SUMOFGAINS" he must make a calculation using the block "formula" of SUMOFGAINS - PERCENTAGE that would be 50%
After calculating this value and entering the variable "NewStopLoss, it would have to be converted into pips and informed in the block" modify stops of positions " -
Could ypu please share your project instead of just showing the image? That would help to find a solution.
-
https://fxdreema.com/shared/6flU9Pq2d
Thank @l-andorrà i need help to understand this.
-
I spent the whole afternoon trying to find a way to get these calculations and also to display on the screen which is something important.
Just reviewing.
My intention is to get this information, display it on the screen, perform the calculations and let the stoploss be adjusted automatically for each trade. -
i try, but this not working https://fxdreema.com/shared/OCFY0SPEd
-
Values of profit no show
-
@l-andorrà Hello my friend, I managed to make it work this way below

-
Good for you. Congratulations!

-
@l-andorrà not work fine, sane situation, i will found programmer to create code for me input on the fxdreema
-
Sorry for that.

