calculating lot size

Created at 05 Jan 2025, 08:38
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!
RU

ruddymff

Joined 04.01.2025

calculating lot size
05 Jan 2025, 08:38


Hello,

I need help please. I want to calculate lot size. What is wrong whith the following code?

 double risk = ( riskAmount / stopLossDistance ) / 10;

            Print("Risk amount: {0}, Stop Loss Distance: {1}, Lot: {2}", riskAmount, stopLossDistance, risk);
            

             Print("Pip Value: {0}", Symbol.PipValue);

            // var lotSize = risk / Symbol.PipValue;

            // var lotSize = Math.Round(risk);

            //Print("Lot Size: {0}", Symbol.QuantityToVolumeInUnits(lotSize));

            return Symbol.QuantityToVolumeInUnits(risk);

 

Thanks


@ruddymff