Transformation of profit/loss into price level
-
I always ignored the repeated requests of transformation from money to price level in order to find a TP/SL level. However, I finally find myself needing it for a project. Sadly, I don't find the formula doing that.
My project is having several open trades at the same time (buys and sells) and I need to find the dynamic price level that would hit a specific TP/SL in money. So far I selected the corresponding 'check profit/loss' block and then close them all. However now I'm explicitly requested to find the corresponding price level where that will happen. Could someone please tell me the formula used to transform money into price?
-
Idea:
x = Money/lot size
a = Money per tick
b = tick sizeamount = b(x/a)
-
@l'andorrà
https://fxdreema.com/shared/037xpdHFb
-
On every source code downloaded from fxdreema, there is a function called DynamicLots. Inside that function is an equation that calculates the lot size using a price distance (the SL) and a money value (% of equity).
With some high school math, you can reverse that equation to calculate a price distance using the lot size and money value.
@sktsec 's example appears to be about right

-
Thank you to all. I will check all options. All of you are great!

-
@sktsec I tried it but it doesn't work. The final result is only modified by the value of 'TP_money' constant only. I tried the same value for 'TP money' with different lot size values and the result on 'tp_fraction' doesn't change. I'm testing on EURUSD with a 5 digits chart.
Now I will try to work on roar's suggestion.
-
@roar I began to review it and I would appreciate some confirmation here on the variables of that formula:
- 'Size' and 'value' variables mean current lot size.
- SL means stop loss distance in pips. In effect this is the number I'm looking for.
- 'AccountEquity' mean equity right now.
- Both 'TickValue' and ' PipValue' numbers can be found as per sktsec's suggestion, right?
-
- Size is lot size, but "value" is a percentage of equity, the user input in in the "risk % of equity" setting. You can replace the whole ((value/100)/AccountEquity()) part with your own money variable.
- Yes
- Yes
- You can see how TickValue is fetched with SymbolInfoDouble() function a bit higher up in my screenshot. You can use that method or the fxdreema dropdown, its the same thing.
I think you need to always use PipValue(symbol) as a custom function, there is no drop-down selection for that.
-
please am a beginner, just finished a simple project but it cannot run on the strategy tester , what should i do thanks
-
@roar Thanks, I will try to build a new formula with it.
-
@nwabu Could you please open a new thred for your question instead of kidnapping this one?
-
Hello @roar
I want to know the amount of tp and sl in currency (not in price or pip).I read your post and created a project based on it.
But unfortunately, it does not work properly in different markets.
I am sending the picture of the result in Eurusd and Nasdaq market as an example. -

