FXCM - Tick Value is wrong - compromise? - page 2

 
DomGilberto:
Anyone...? I swear my formula is right, yet this is returning "0.0"

You are doing a MathFloor() on LotSize_Sell, and therefore 16.4532 / 20.3047 gets rounded down to zero.

 

Thanks I took a break from it and realised my rookie error!

I have since fixed it so that if it's < minlot the LotSize = minlot. I assume MathCeil() rounds it up?

 Thank you kindly for your help :) 

 
DomGilberto:

I have since fixed it so that if it's < minlot the LotSize = minlot. I assume MathCeil() rounds it up?

Yes, MathCeil() rounds up.

But the use of MathFloor() and the resulting zero tells you something useful: you cannot place a trade without breaking your money management rules. If you saying that you want an s/l at X pips and you are prepared to risk $Y or (Z% of equity/balance), then a resulting lot size less than the minimum means that your trade is riskier than you want to allow. Or your s/l is too wide. Using MathCeil() will mean that you routinely risk more than $Y or Z%.

 
I agree, going up to minlot can greatly exceed your risk tolerance. My NormalizeLots uses MathRound instead of floor before checking minlot. This allows 1/2 a lotstep above max risk as a compromise in marginal trades.
Reason: