Home Forums Tickstory Lite Issue/Bug tracking MT4: OrderSend error 4107 during back-test

Viewing 1 post (of 1 total)
  • Author
    Posts
  • admin
    Participant
    Post count: 92

    When back-testing on a 4-digit Metatrader 4 terminal, users could encounter the following error:

    OrderSend error 4107
    Error opening BUYSTOP order []: (4107) invalid price parameter for trade function
    invalid price 1.28236000 for OrderSend function

    You can resolve the issue by either:

    – Modifying your MQ4 mode (if you have access to it). You will need to amend all the “OrderSend” and “OrderModify” commands so they adjust your prices to 4-digits. You can do this by wrapping all prices in the function “NormalizeDouble(price, Digits)”. For example, if the code reads like the following:

       ticket=OrderSend(Symbol(),OP_BUY, lots, Ask, slip, stoploss, takeprofit, EA, MagicNo, 0, Blue);

    you will need to change it to:

       ticket=OrderSend(Symbol(),OP_BUY, lots, NormalizeDouble(Ask, Digits), slip, stoploss, takeprofit, EA, MagicNo, 0, Blue);

    – If you do not have the code, you can instead utilise a 5-Digit MT4 terminal to back-test your strategy.

    If either option is not viable, an enhancement is planned for the next version of Tickstory to ensure prices are rounded for 4-digit brokers.

    Regards.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.