Download MetaTrader 5

MQL4: Found difference in lot calculation between 'spread betting'-accounts and 'normal' accounts...

To add comments, please log in or register
Having troubles understanding the code? Perhaps, you can find an article on that topic!
Martin Fischer
Martin Fischer 2016.08.01 15:18 
Hi to all,

I found out, that the lot-calculation for 'normal'-accounts and 'spread-betting'-accounts seems to be different.

In the documentation I found the following for the lot-calculation on futures: SYMBOL_CALC_MODE_FUTURES

Profit =  (close_price-open_price)*TickPrice/TickSize*Lots

I'm checking the necessary calculation-method with:

 //... Calculation 

If I change the formula by lots, I get (not normalized)

lots = (invest * tickSize) / (priceDiff * tickValue)

On a GKFX Spread-betting-account and symbol AUDJPYSP (Future), this formula is working well, but
with a Pepperstone account and the symbol USDX (Future), I get:

invest = 10.0 €
tickSize = 0.1
tickValue = 0.1
priceDiff = 0.493

The result is: lots = 20.283

If I place an order with a difference between entry and stop loss of 0.493 and a lot size of 20, the result is, that the real stop-loss is about 877 € and not 10.0 €.

If I extend the formulas with

lots = lots / exchangeRate / contractSize


profit = profit * exchangeRate * contractSize

the result is ok. But these are complete new formulas...

So there must be an additional parameter, that makes it possible to extend this formula for different account-types.

How can I find out the type of the account and the correct corresponding and really complete formula that is working well with every broker?

Thank you very much!

To add comments, please log in or register