calculate lot size
calculate lot size
05 Jan 2025, 09:32
Hi
Following my recent post, the fromula to calculate my lot is :
LOT SIZE= RISK AMOUNT/DISTANCE STOP LOSS IN PIPS/PIP VALUE
Can any one help me to code this please?
This is my draft but there is return “BAD VOLUME”. I don't understand what is wrong
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);