Calculate Volume/Lot Size

Created at 12 Jul 2024, 11:51
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!
GO

GonzaloBlanco

Joined 18.04.2024

Calculate Volume/Lot Size
12 Jul 2024, 11:51


Hi, I am trying to calculate the volume according to the StopLoss in pips without the comission risking 1% of balance per trade with a 1:1 ratio. In theory it should work but the spread or something else alters the trade in backtesting. I guess that my function is wrong, someone can help me? Attached img:

       public double CalculateVolume(double StopLossInPips, double Risk)
       {
           double VolumeGross = (Risk / (0.01 * StopLossInPips)) * InicialBalance;
           double Volume = Math.Round(VolumeGross/100000, 2)*100000;
           // double Comission = 4 * LotSize;
           return Volume;
       }


@GonzaloBlanco