Home Forums Tickstory Lite General Discussion Clarification Of Spread In FXT Editor (How to Calc Spread)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • imported_tickstory
    Participant
    Post count: 1479

    Hi Trader 2384,

    The spread value of in MT4 is expressed in Points. This is because “pips” as we know it is dependent also on the number of “digits” the broker has (i.e. whether it supports fractional digits or not).
    Here is some code that will help demonstrate the point and let you confirm that the actual test values are as you expect:


    // SpreadDivider is used to calculate whether the spread should be divided by 10 to get the "pip" spread
    int spreadDivider = (Digits % 2 == 1) ? 10:1;
    Print("Spread (Ask-Bid): " + DoubleToStr(Ask-Bid));
    Print("Spread (expressed in Points): " + MarketInfo(Symbol(),MODE_SPREAD));
    Print("Spread (Pips): " + DoubleToStr(MarketInfo(Symbol(),MODE_SPREAD) / spreadDivider));

    On a 5-digit instrument, you would be expecting your Ask-Bid to be 0.00002 if your spread was set to 0.2 pips.

    There is some discussion on MT4 forum threads that discuss this concept more.

    Hope this helps.

    Trader2384
    Participant
    Post count: 75

    Interesting – that code helps a lot. Thank you!

    So just to confirm – for a 5-digit broker on a 5-digit currency pair like EURUSD, entering the number “2” in strategy tester spread box means 2 points or 0.2 pips?!

    Is there a way to tell in mt4 the number of “digits” the broker has?

    imported_tickstory
    Participant
    Post count: 1479

    Correct – “2” on a 5-digit broker means 0.2 pips (as the Tickstory UI shows).
    In Metatrader MQL language, you can use “Digits” to determine how many digits a symbol has.

    Regards.

    Trader2384
    Participant
    Post count: 75

    great, thanks!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.