Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Lost price connection disables strategies

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Lost price connection disables strategies

    Hi, I made a test run of strategy what happens if WIFI is disconnected.
    what happens is that the strategies are all disabled, and I configured it to be ignoreallerrors, and it stops the strategy when the wifi returns.
    how to fix it?

    Also, I tired to configure in options for it to keep running, but I still get the same problem and the strategies are disabled.

    even minor wifi disconnection, disables all the strategies within 3 minutes.

    #2
    Hello zoharcho,

    Thank you for your post.

    What do you have set under Tools > Options > Strategies > On Connection Loss? Could you provide a screenshot of the current settings?

    IgnoreAllErrors would only affect what occurs when a order is rejected - connection loss isn't considered an error.

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi, thank you,
      this is what the first configuration that I had when I discovered the issue.
      tell me what to do and I will try it. (BTW I tried to change the Handling to Keep Running, and it didn't work either).
      thanks in advance.

      Comment


        #4
        Hello zoharcho,

        Thank you for your reply.

        You'd probably need to do some testing to see what value works best for you, but you should be able to put a large number in the Disconnect delay seconds field to allow enough time for your network to re-establish the connection. Right now it's only set to wait 10 seconds, so you might want to try like 300, which would be 5 minutes, or 600 for ten minutes.

        You should pick either "Keep running" if you don't want the strategy to run through the historical data after it connects again, or set it to "Recalculate" to calculate the strategies position again.

        After the "Disconnect delay seconds" clock has run out, NinjaTrader will begin to try and restart the strategy. "Number of restart attempts" Should be set to 10 or 20 just to make sure it has enough chances to restart and "Restarts within x minutes" should be something like 10 minutes, just for good measure.

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hello Kate,

          I tried your solution and it worked.

          But I have now another issue.

          Before the disconnection the orders fill price is not mentioned, as you can see in picture 1 - which is correct

          after the disconnection the orders fill price is 0.000 and mentioned, as you can see in picture 2

          usually when I see the fill price the orders are not always delete each other, and they sometimes not really cancelled - and thus the strategy can't initiate a new fresh order.

          In General: what should I do when I close the computer after the trading hours are over? and I close the TWS?
          when I reopen the TWS and NINJA in the next day, ninjatrader know to update the orders or I need to delete them and then enable the strategy and it will generate new orders?
          what is preferred?

          (I tried to let ninja update the orders but sometimes, he is not able to cancel the old one or he just enter a new order and I get 2 live orders instead of 1)

          thank you in advance, hope you could help.

          Comment


            #6
            Hello zoharcho,

            Thank you for your reply.

            What happens when a strategy is restarted depends on your settings.

            In the historical data the conditions in the script will be run as a backtest and have historical results before real-time data processing and real-time order submissions begin.

            Depending on your settings, the script will either not try and match any previous made orders made by the script on a previous run (Wait until flat), or will attempt to resume and try and match previously made orders (Immediately submit) with the orders it calculates in historical data.

            If the settings are setup to resume and have the calculated historical orders match the previously made real-time orders, when orders are matched, these will still show in the real-time strategy performance as real-time (as these orders were made in real-time and by being matched are resumed).

            NinjaTrader can try and resume your strategies when you restart them.

            To do this, you will need to enable the following option before starting a new instance of a strategy:
            • Right-click the chart and select Strategies or right-click the Strategies tab of the Control Center and select New Strategy...
            • Select the strategy from the Available list (in the Chart Strategies window click the New button to add an instance of the strategy)
            • In the parameters on the right, set 'Start behavior' to 'Immediately submit, synchronize account' (or 'Immediately submit')
            • After running your strategy, be sure to save your workspace when you shutdown NinjaTrader
            Below is a link to the help guide on Syncing Account Positions. Please see the section 'Immediately submit, synchronize account'
            http://ninjatrader.com/support/helpG...hronizeAccount

            Further, below is a public link to a forum post about startup behavior.
            https://ninjatrader.com/support/foru...776#post528776

            With these options the following will happen when the strategy resumes. (From the help guide on Immediately submit, synchronize account):

            This combination should be used when you want to begin trading your strategy off a flat state with minimal user interaction to sync your Account Position prior to start.
            • When your strategy starts it will check for any active orders previously generated by the strategy on your account. Any active orders on the account previously generated by the strategy that does not match* an active strategy order will be cancelled. Should the strategy be unable to cancel and receive confirmation on the cancellation of these orders within 40 seconds the strategy will not start and an alert will be issued.
            • The matching active orders on the account will then be mapped to the active strategy orders. These orders will be resumed properly.
              After the strategy is successful in cancelling any orders necessary, any remaining active strategy orders that cannot be successfully paired will be submitted live and the strategy will then try to sync your Account Position to your Strategy Position. On multi-instrument strategies it will perform this check for all instruments used by the strategy.

              (It would be recommended to disable the Tools > Options > Strategies > NinjaScript > 'Cancel entry orders / Cancel exit orders when strategy is disabled' so that these remain in a working state so these can be resumed (should they not fill while the strategy is disabled))
            • If the Account Position matches your Strategy Position, no reconciliatory order will be submitted. The strategy will then begin managing your Strategy Position immediately.
            • If the Account Position does not match your Strategy Position, NinjaTrader will submit a market order(s) to reconcile the Account Position to match your Strategy Position. The strategy will then begin managing your Strategy Position immediately.

              * A previously generated order is considered to match an active strategy order when the order action, order type, quantity, limit price, and stop price are exactly identical.
            As mentioned in the help guide, if the historical orders do not match real-time orders made previously they are cancelled.

            If you want to ensure that your strategy resumes the previously placed orders and positions with the 'Immediately submit' setup, you will need to ensure that the historical trades match the real time trades.

            Adding intra-bar granularity can help with this.

            When in historical data, only the Open, High, Low, an Close will be available and there will be no intra-bar data. Intra-bar granularity adds a second data series such as a 1 tick series so that the strategy has finer granularity in the historical data in between the OHLC of the primary series. This allows for more accurate trades.

            If the strategy was running in real-time with Calculate set to 'On price change' or 'On each tick', it would be recommended to enable TickReplay so that any indicators that may have been updating in real-time and whom's values are used in conditions that trigger orders can also update historically for each tick or price change.

            Below is a link to an official reference sample that demonstrates how to add intra-bar granularity.
            http://www.ninjatrader.com/support/f...ead.php?t=6652

            Also, here is a link to the differences on real-time vs backtest (historical).
            http://ninjatrader.com/support/helpG...ime_vs_bac.htm

            As well as a link to the help guide on the AddDataSeries() method.
            http://ninjatrader.com/support/helpG...dataseries.htm

            A link to the help guide on BarsInProgress.
            http://ninjatrader.com/support/helpG...inprogress.htm

            And a link to the help guide on Multi-Time Frame & Instruments. Please see the section 'How Bar Data is Referenced', and 'Accessing the Price Data in a Multi-Bars NinjaScript'.
            http://ninjatrader.com/support/helpG...nstruments.htm

            And a link to another forum post that describes intra-bar granularity with a 1 tick series, TickReplay, and High Order Fill resolution in more detail.
            https://ninjatrader.com/support/foru...297#post491297
            ​​​​​​​

            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              Thank you Kate for the detailed and with much effort explanation. It is a lot of stuff to work with, I will check all those options and test them and report

              Comment


                #8


                I went over the ideas above and I don't think they will solve the problem.

                After 8 hours test, I had 1 disconnection on TWS, the order cancellation was errors as mentioned in the pictures
                Last edited by zoharcho; 09-09-2020, 06:30 AM. Reason: pictured remove due to personal information

                Comment


                  #9
                  I attach here the pictures of the log errors and the orders TAB.

                  as you can see, it has a problem cancelling the old (before the disconnection) orders, and thus either the strategy get stuck or submitting another order
                  and I am left with duplicate orders.

                  I also noticed that I have orders which their name is "external" and they are not attached to any strategy (and I did not submit them).

                  what are those "external" orders?

                  In short, I have distilled the problem to this: whenever a disconnection happens, when resumed, the strategy tries to cancel the old orders using "external" name which is not linked to the strategy somehow, and thus either a duplicate or cancel pending happen , which give a faulty strategy operation.

                  Comment


                    #10
                    Addition: ERROR: Ninjatrader will not "see" live orders on IB server after disconnecting from TWS and then reconnecting.
                    here is how to generate this error on your side:

                    be connected with ninjatrader to TWS.
                    enter limit order in tws
                    see that order in the orders TAB in ninja
                    disconnect ninjatrader from TWS.
                    connect ninjatrader to TWS.
                    then you wont see the live limit order that is placed in TWS.

                    it might be connected to the issue I told you above.

                    Comment


                      #11
                      Hello zoharcho,

                      Thank you for your replies.

                      We'll need to take a look at your log and trace files to see what's occurring. Rather than have you post them here, since they contain potentially personally identifiable information, we'd prefer you send them in through the platform directly to us.

                      You can do this by going to the Control Center-> Help-> Email Support

                      Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

                      Please reference the following ticket number in the body of the email: 2731084 ATTN Kate W.

                      Thanks in advance; I look forward to assisting you further.
                      Kate W.NinjaTrader Customer Service

                      Comment


                        #12
                        thank you, did it, let me know your thoughts.

                        p.s. I attached the log and trace in a zip file which was close after the error described. But in message #10 , I can generate that problem anytime.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by quantismo, 04-17-2024, 05:13 PM
                        5 responses
                        32 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by proptrade13, Today, 11:06 AM
                        1 response
                        5 views
                        0 likes
                        Last Post NinjaTrader_Clayton  
                        Started by love2code2trade, 04-17-2024, 01:45 PM
                        4 responses
                        34 views
                        0 likes
                        Last Post love2code2trade  
                        Started by cls71, Today, 04:45 AM
                        2 responses
                        10 views
                        0 likes
                        Last Post eDanny
                        by eDanny
                         
                        Started by kulwinder73, Today, 10:31 AM
                        1 response
                        10 views
                        0 likes
                        Last Post NinjaTrader_Erick  
                        Working...
                        X