My question is in two closely related parts:
Given the entry price and stop loss, how can I calculate my lot size so that 2.5% of my current account balance would be risked on trades?
Also in cases where the 2.5% lot size is not a tradable lot size, say 0.013 and 0.018, how can I round the lot size already calculated in 1. to the closest tradable lot size 0.01 (for 0.013) and 0.02 (for 0.018)?
I know how to calculate the number of pips between my entry price and stop loss:
double DiffInPips = MathAbs(NormalizeDouble(stopLoss-openPrice,Digits)/Point);
I believe it is needed to solve this, but not sure how to arrive at the desired lot sizes in both of the above.