What formula is VolumeForProportionalRisk using?

Created at 21 Apr 2023, 15:16
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CO

couscousmckoy

Joined 07.02.2018

What formula is VolumeForProportionalRisk using?
21 Apr 2023, 15:16


Good afternoon

Can you share the formula behind VolumeForProportionalRisk please?

Previously in my cBots I have used the following code...

symbol.NormalizeVolumeInUnits(riskPercentage / (Math.Abs(stopLossInPips) * symbol.PipValue / accountBalance * 100));

...But I have noticed that this isn't generally giving the same volume as VolumeForProportionalRisk.  Sometimes not even close!

For example:

riskPercentage = 1

stopLossInPips = 123.1

PipValue = , 0.00008301235

Balance = 100,000 GBP

Symbol:  NZDUSD

My code returns:  97,000 

VolumeForProportionalRisk returns 133,000

Any reason why this might be?

Thanks

Marcus

 


@couscousmckoy