Not logged in
Viewing 9 posts - 1 through 9 (of 9 total)

Forums>StrategyQuant>General Discussion>Error 132 (market closed)

  • #257226 |
    Tomáš Dušek
    Customer
    5 Posts

    I am testing the demo account of the first strategy (D1 strategy) generated by SQX to detect the first errors and to encounter error 132 (market closed). When I researched this, the strategy is trying to place orders at the broker server downtime. In our time, I think it’s 23: 00-23: 05CET, how do you handle it? Is there any script that watches and sends commands again or another solution?

    Here in the forum I found advice to use EA Wizard, which no longer works with SQX strategies

    I’ve already given advice on using OpenBarDelay. For D1 strategy this may not matter, but for strategy H4 and below, there will be a big difference between real and backtest
    extern int OpenBarDelay = 0; // open bar delay in minutes
    // it can be used for Daily Strategies to trigger trading a few minutes later –
    // because brokers sometimes have a technical delay after midnight and we have to postpone order execution

    The solution would be to check the placement of the order and try again if it is not

    Attachments:
    You must be logged in to view attached files.
    #257245
    tomas262
    Administrator
    1304 Posts

    Thanks for your feedback. As you mentioned for the daily chart simply the OpenBarDelay parameter can be set to 5 or 6 but for H1 or H4 strategies this would cause some issues with not optimal entry fills. We will look into this how this could be improved

    #257248
    Tomáš Dušek
    Customer
    5 Posts

    I found the exact market opening times in the MT4 market specification.
    I searched for the solution and found this thread

    https://www.mql5.com/en/forum/35805
    https://www.forexfactory.com/showthread.php?t=548770

    Attachments:
    You must be logged in to view attached files.
    #257260
    Tomáš Dušek
    Customer
    5 Posts

    I found the exact market opening times in the MT4 market specification. I searched for the solution and found this thread https://www.mql5.com/en/forum/35805 https://www.forexfactory.com/showthread.php?t=548770

     

    I found this. Would it not help to place orders only at the time of opening the markets? Everyone could set the clock according to their broker

    https://robottradingsystem.com/mql4-simple-time-based-entry/

    Attachments:
    You must be logged in to view attached files.
    #257300
    tomas262
    Administrator
    1304 Posts

    Yes, that seems useful. I have forwarded it to developers so the order execution can be improved

    #257302
    Customer
    422 Posts

    its not user friendly to add 2 another variables to the EAs, where user will need to set this manually, because for every broker the “technical pause” of no trading is different, there are brokers with no pause, with 5 minute pause, etc.

    solution is simple – you get error “market is closed” – RETRY

    and i dont think that this is a big issue, i dont see any bigger differences on the lower TFs with my real trading so far

    You want to be a profitable algotrader? Sharing of final strategies with real traders just started. Fill in this FORM. 1500+ final SQ3 and SQX strategies for members running on demo accounts DEMO ACCS. We provide also strategies for indices - DAX and DOW JONES, because we have realtick data from brokers.

    #257377
    Customer
    422 Posts

    in the old SQ3 code we made also the changes, so our tuned MQL code will take care about these basic errors

     

    case ERR_TRADE_CONTEXT_BUSY:
    msg = “Trade context busy”;
    wait = true;
    break;
    case ERR_BROKER_BUSY:
    msg = “Broker busy”;
    wait = true;
    break;
    case ERR_SERVER_BUSY:
    msg = “Server busy”;
    wait = true;
    break;

    case ERR_MARKET_CLOSED:
    msg = “Market closed”;
    minWaitTime = 5000;
    wait = true;
    break;

     

    for market closed error we have set to wait some time after next retry…. SIMPLE and it WORKS

    You want to be a profitable algotrader? Sharing of final strategies with real traders just started. Fill in this FORM. 1500+ final SQ3 and SQX strategies for members running on demo accounts DEMO ACCS. We provide also strategies for indices - DAX and DOW JONES, because we have realtick data from brokers.

    #257383
    Tomáš Dušek
    Customer
    5 Posts

    in the old SQ3 code we made also the changes, so our tuned MQL code will take care about these basic errors case ERR_TRADE_CONTEXT_BUSY: msg = “Trade context busy”; wait = true; break; case ERR_BROKER_BUSY: msg = “Broker busy”; wait = true; break; case ERR_SERVER_BUSY: msg = “Server busy”; wait = true; break; case ERR_MARKET_CLOSED: msg = “Market closed”; minWaitTime = 5000; wait = true; break; for market closed error we have set to wait some time after next retry…. SIMPLE and it WORKS

     

    I searched for strategy code “case ERR_MARKET_CLOSED:” but it’s not there. I added it and I will see how it goes in the test.

    #257475
    Tomáš Dušek
    Customer
    5 Posts

    Thanks for your feedback. As you mentioned for the daily chart simply the OpenBarDelay parameter can be set to 5 or 6 but for H1 or H4 strategies this would cause some issues with not optimal entry fills. We will look into this how this could be improved

    in the old SQ3 code we made also the changes, so our tuned MQL code will take care about these basic errors case ERR_TRADE_CONTEXT_BUSY: msg = “Trade context busy”; wait = true; break; case ERR_BROKER_BUSY: msg = “Broker busy”; wait = true; break; case ERR_SERVER_BUSY: msg = “Server busy”; wait = true; break; case ERR_MARKET_CLOSED: msg = “Market closed”; minWaitTime = 5000; wait = true; break; for market closed error we have set to wait some time after next retry…. SIMPLE and it WORKS

     

    So it looks like the error will be in the missing error code “case ERR_MARKET_CLOSED:”
    I just added “case ERR MARKET CLOSED:” to the strategy and the strategy repeatedly sent the order until the broker opened the market again.

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

You must be logged in to reply to this topic.