Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Connection Problems followed by NT Strategy Problems

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

    Connection Problems followed by NT Strategy Problems

    Hello,

    I have a problem with the connection of NinjaTrader with ZenFire. The Connection get lost sometimes without any reason. I have monitored the network connection and there was no interruption of the network service. NinjaTrader reconnects automatically.

    But the next problem occurs with the strategies. They stop tracing open positions, which means that, when a strategy automatically enters a trade short or long, the connection get lost and NT reconnects, the position will never be closed.

    Problem 2 can be solved by solving Problem 1, but i would prefer to solve both problems so that in case of a short network interruption trades don't go crazy. But again: I have a reliable broadband network connection and the interrupts of the connection between NT and ZenFire are not due to my network connection. Maybe connection options?

    #2
    Hi GerTrader, unfortunately the strategies will terminate if the connection is lost. Please make sure you keep an eye on your task manager, maxing the system out can also lead to disconnects.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Is there no other possibility? Does the strategy catch open positions when restarting them manually after a disconnect and reconnect?

      The problem is that my strategies rely on tight StopLosses, but when there is a disconnect, some trades just ran crazy and procude major losses.

      Comment


        #4
        GerTrader,

        You can turn off all error handling with this property. Be very careful if you decide you want to use this and monitor your connection through OnConnectionStatus().



        Ultimately though, if you get disconnected there is not much NinjaTrader can do. Your position runs the risk of being unprotected and you would want to immediately resolve handling of them over on your brokerage's end.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          More information.

          When you lose internet, the strategy will be cancelled as Bertrand has stated. Upon cancellation and restart of your strategy, NinjaTrader recalculates out its strategy position. This strategy position may or may not be in sync with the prior account position you had. On restart, you will need to be sure these two are in sync or else things will be wacky.

          Again, NinjaTrader does not "recover" your prior account position. It works off of its strategy position. Please read this article as it will provide more insight into the differences between the two: http://www.ninjatrader-support2.com/...ead.php?t=4033
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Hey Josh,

            A couple of days away from going live. I have been testing on a hosted server that is dedicated solely to NT with everything striped down to the bare minimum.

            Regarding this issue and syncing, etc. Could I just set something up that would simple do the following IF THERE IS A DISCONNECT.

            1. System rebooted.

            2. I start NT, and then restart my strategy for let's say the ES.

            3. In my code, I say flatten EVERYTHING on account either working or filled for the instrument this strategy is being started for. In this case, the ES.

            4. Then begin the strategy with a clean fresh slate.

            Flush the system if you will if a connection is lost and then assure that everything is in order. This would hurt one's track record, but a manual note could be made stating the system went down and a notation could be made I should think.

            Please let me know your thoughts on what the SIMPLEST thing would be to do in this case as I want to get live asap.

            Thank you,



            Originally posted by NinjaTrader_Josh View Post
            More information.

            When you lose internet, the strategy will be cancelled as Bertrand has stated. Upon cancellation and restart of your strategy, NinjaTrader recalculates out its strategy position. This strategy position may or may not be in sync with the prior account position you had. On restart, you will need to be sure these two are in sync or else things will be wacky.

            Again, NinjaTrader does not "recover" your prior account position. It works off of its strategy position. Please read this article as it will provide more insight into the differences between the two: http://www.ninjatrader-support2.com/...ead.php?t=4033

            Comment


              #7
              r2kTrader,

              You cannot flatten a position outside of your strategy instance. It is unaware of it and as such cannot act upon it.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Josh View Post
                r2kTrader,

                You cannot flatten a position outside of your strategy instance. It is unaware of it and as such cannot act upon it.
                Josh,

                Thank you for quick turn around. I am trying to get most of the major issues understood so I can launch.

                Regarding "flushing" of the orders both live and working for a given instrument. How can I "flatten everything" so I am in sync or start clean? Would I have to go to my DOM or something and click flatten manually?

                Comment


                  #9
                  That would be one approach. The idea is if you know you have any open positions, be sure to close those out with a reconciliation order. This order can be submitted from anywhere you want. Whether from a DOM, directly with your broker, etc.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_Josh View Post
                    That would be one approach. The idea is if you know you have any open positions, be sure to close those out with a reconciliation order. This order can be submitted from anywhere you want. Whether from a DOM, directly with your broker, etc.
                    Josh, in order to be in sync and make sure I start with a clean slate, I am willing to just close all existing orders and live positions. So...

                    Could you provide a code example, that will check ALL POSITIONS both WORKING and LIVE and flatten EVERYTHING for a given instrument. This should be independent of strategy. Say for example I have a dom order working and 1 car live on ES. Before the strategy runs, I want to flush that all out programmatically and then begin the strategy with live, not historical.

                    Thank you,

                    Comment


                      #11
                      Originally posted by r2kTrader View Post
                      Josh, in order to be in sync and make sure I start with a clean slate, I am willing to just close all existing orders and live positions. So...

                      Could you provide a code example, that will check ALL POSITIONS both WORKING and LIVE and flatten EVERYTHING for a given instrument. This should be independent of strategy. Say for example I have a dom order working and 1 car live on ES. Before the strategy runs, I want to flush that all out programmatically and then begin the strategy with live, not historical.

                      Thank you,
                      You can just click on File->Flatten Everything, in your control center.

                      Comment


                        #12
                        Correct heech, you can't do this programmatically. So 'Flatten everything' would certainly do the job.
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by heech View Post
                          You can just click on File->Flatten Everything, in your control center.
                          Thanks for the prompt replies guys.

                          Let me be more clear. I don't want to flatten everything, I want to flatten everything for an instrument. I am aware of flatten everything and also through the dom.

                          Bertrand, just to be clear. It can't be done programmatically, or you don't support this. Is there anyway to hook into the account info and see what is out there and manually take down what I want without manual intervention.

                          Otherwise, it sounds like a job for HotKey.exe

                          Which brings me to my next question, how do I call an external program from within a strategy?


                          Thanks,


                          r2kTrader

                          Comment


                            #14
                            r2kTrader, accessing live account info from within a NinjaScript strategy is already on our list for future versions of NinjaTrader - it's unfortunately not possible at this time. Calling an external program from NinjaScript is not supported, but you can take a look at this thread and the tip in there - http://www.ninjatrader-support2.com/...ad.php?t=11391
                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              Originally posted by NinjaTrader_Bertrand View Post
                              Calling an external program from NinjaScript is not supported, but you can take a look at this thread and the tip in there - http://www.ninjatrader-support2.com/...ad.php?t=11391
                              I use Macros Express Pro for startup.

                              To access any program programmatically from your strategy... this is the wonder of using C# (as opposed to random toy languages). You can do anything C# + .NET can do.

                              So, that means:


                              Until NT 7 is available... I personally plan on tying into the TWS API directly, and monitoring positions (just looking for discrepancies) directly through the API.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by martin70, 03-24-2023, 04:58 AM
                              15 responses
                              114 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by The_Sec, Today, 02:29 PM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              2 responses
                              30 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by Mindset, 05-06-2023, 09:03 PM
                              10 responses
                              265 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by michi08, 10-05-2018, 09:31 AM
                              5 responses
                              743 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X