How can we select a SL/TP price level based on balance percentage?
-
I remember this was asked long time ago, but I simply can't find the thread again, sorry.
None of the current SL/TP options available now on the 'buy/sell now' blocks allow to select, for example, 1% of current balance.I remember there was a loophole to get it, but I can't remember it. Could someone please help?
-
Any suggestion?
-
Surly the option is in blocks? I don't use but:

-
That is for calculating lot size. I need the same to calculate SL and TP distances in percentage. For example, my TP to be at 2% profit. I cannot find any option for that. Same for SL.
-
-
I need the price level, my friend. That's not what my bot does.

-
@l-andorrà
All good, merely thought this ( your own code ) would be a place to start.
Maybe using the same logic, but have 2 independent calculations.
1 = calculate Lose % of Balance
2 = calculate TP % of Balance.
I might have miss understood, sorry.
Knowing you, you'll get it...

-
@l-andorrà
You probably mean money to price fraction.First get the SL / TP in money. Then convert the money to fraction
Divide this money by (lots*MoneyPerTick/TickSize), will give the fraction.
You can get the MoneyPerTick and TickSize from MarketInfo.
See if this demo help:
https://fxdreema.com/shared/JSwqXle7d -
@Vortrexcian Thanks for the help.

-
@sktsec Interesing. I will try it. Thank you.

-
In case you are interested to convert the price fraction into pips. Just divide the fraction by pip size.
Pip size = PipValue(_Symbol)*_Point
This PIpValue() function is reviewed by @roar long time ago and is calculated internally in the fxdreema.
-
Thank you!

