Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

The strategy freezes and freeze chart.

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

    #16
    I am still searching the way to let the strategy work stable.
    The latest try - a mechanism that prevent sending next order before OnOrderUpdate() run. And this version worked stable for a 6 hours.
    But when I run two instances (even on different accounts) - it froze whole NT.

    Maybe this can give a hint to what is happening?
    Some internal locks, maybe?
    Or just too slow PC?

    In attachment there are both 2 strategies: original and fixed.
    Attached Files
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    Comment


      #17
      Hi all!

      I've also tried this strategy and also got freezed

      Comment


        #18
        Managed orders freezes too.
        I tested these strategies on multiple PCs and found that they works fine on powerful processors like i9-7940
        I implemented delays for all orders events and now strategies words significantly longer before to freeze.
        Attached Files
        fx.practic
        NinjaTrader Ecosystem Vendor - fx.practic

        Comment


          #19
          Hello fx.practic,

          Thank you for your replies.

          We are still looking into this behavior on our end and will reply with more information as we have it.

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

          Comment


            #20
            hi everybody. I also tried to launch the strategy (sTest_07_Market_Freeze.cs) and it hung up after 2 minutes.

            Comment


              #21
              This is a common screenshot of what I see when strategy freezes: this is StopMarket entry order that changing or cancelling with dark orange colour.

              I found, also, that same strategy may works fine on my PC and freeze immediately on powerful enough VPS:
              Windows Server 2016 Datacenter
              Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz 2.20
              GHz (6 processors)
              16.0 GB


              Attached Files
              fx.practic
              NinjaTrader Ecosystem Vendor - fx.practic

              Comment


                #22
                Hi all!

                I used sTest_07_Market_Freeze

                And my result before hanging out was the next - I got delay of the quotes for ES futures during market close at about 10 mins!!!!

                Comment


                  #23
                  I have an assumption: it affected processors with Single Thread Performance.
                  When chart frozen, it impact other NT windows randomly. Some windows may slows down, some can become frozen too (code editor, for example).
                  Attached Files
                  Last edited by fx.practic; 03-19-2020, 02:54 PM.
                  fx.practic
                  NinjaTrader Ecosystem Vendor - fx.practic

                  Comment


                    #24
                    Hello,

                    I made an account here today at the NinjaTrader Forum, just so I can confirm that I too have been experiencing the same issues with Strategies operating on NinjaTrader.
                    Can this issue be resolved, or is NinjaTrader not good for automated trading?

                    I have been developing strategies for several months only to have them all rendered useless is a bit frustrating.

                    Comment


                      #25
                      Hello,

                      Thank you for your replies.

                      The issue we are looking at in this thread is specifically regarding the speed with which multiple orders are being fired by a strategy. The thing is that NinjaTrader isn't really designed to send large groups of orders in rapid succession as in fx.practic's test scripts.

                      NinjaTrader 8 is multi-threaded. It is important to understand what this means on a practical level when troubleshooting freezing behavior.

                      In NinjaTrader 7, a freeze would cause the entire platform to become unresponsive as there was only one thread. Because NinjaTrader 8 is multi-threaded, only the thread(s) which is experiencing performance issues will freeze leaving the rest of the platform unaffected and responsive, which is what I see with fx.practic's test scripts.

                      Here is a practical example:

                      A user is loading a workspace with 30 AAPL charts. They only have 2 SMAs on each chart. They are experiencing freezing behavior on those charts, but the platform is responsive and they can open a MSFT chart without issue.

                      This means that there are 30 charts loading on one thread as all of them are loading the same instrument. In this example case, reducing the amount of windows loading the single instrument would be a good place to start troubleshooting.

                      Why?
                      • An instrument can only be assigned one thread
                      • If multiple threads were used per instrument, different NinjaTrader windows could get out of sync.
                      With that in mind, when we are sending large numbers of separate orders in rapid succession, we are, in effect, jamming the queue. NinjaTrader not only has to submit all the orders, it has to render the chart which is constantly updating, calculate any indicators you have applied to the chart, render markers and text for each order, etc. You're essentially overloading the thread the strategy is running on. Depending on your PC resources, the point at which you overload things may be different, so there's not really a set limit for how many can be sent within a specific time frame.

                      rparm - it's fairly unlikely that your strategies are being affected by this particular issue. If you'd like to write directly into us at platformsupport [at] ninjatrader [dot] com, we would be happy to take a look at what's specifically occurring with your strategies and provide guidance on how to avoid issues you may be experiencing.

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

                      Comment


                        #26
                        Hello, Kate.

                        Thank you for the detailed answer.
                        NT is highly reliable, customise-able and fast platform.
                        That's it is critically important to be able to determine its natural limitations for the scripts, dealing with the real world in real-time.

                        I tried to implement tricky delay between end of the OnOrderUpdate() method and firing orders events (50 - 5000 msec). Strategies work much longer now, but still overload NT in 30-300 minutes.

                        So, my the biggest question for now: how can I check if orders events queue is almost (or already) overcrowded?

                        If this is impossible, I want to request the feature: implement some kind of property like IsOrdersQueueOk or IsNTHealthStillFineAfterAllIDid
                        PHP Code:
                        if( IsOrdersQueueOk )
                        {
                               
                        SubmitOrderUnmanaged()

                        I want to underline that examples in this thread were artificial. Same time the strategies with much less frequent orders events once meet market conditions that cause freezing. It happened after hours and days of stable work on live market.k
                        fx.practic
                        NinjaTrader Ecosystem Vendor - fx.practic

                        Comment


                          #27
                          Hello fx.practic,

                          Thank you for your reply.

                          There would not be a way to check if the thread is getting "crowded" from NinjaScript. It's more complicated than just the orders themselves - anything you have running off of that thread is taking up some of its resources. Everything has to have time to process.

                          That being said, I will submit a feature request for this and follow up with a tracking number for you on Monday.

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

                          Comment


                            #28
                            Hello, Kate.

                            Form all trading platforms NT is the best.
                            From all NT scripts, strategies are deal with real money.
                            From all events orders launching takes significant time.
                            And script creators needs reliable diagnostics tools.

                            Hence, I decided to track live orders, to determine the sensitive quantity jamming the queue.
                            The test was performed on VPS, with only NT was running.
                            There were 3 NT windows:
                            - ControlCenter;
                            - Output Window;
                            - 1 tick chart with no indicators and with one only strategy running.
                            Sim101 account was reset before to start.
                            Simulated Data Feed connection used.


                            On each tick the strategy printed in Output Window information from Account.Orders, grouped by OrdersState and enumerating all orders not in terminal state.
                            Also, strategy printed the list of "launched" orders (the orders between submitting and triggering OnOrderUpdate()):
                            - new orders submitted;
                            - submitted to change ;
                            - submitted to cancel .

                            This is the end of the list for the latest bars, and in attachment you may find whole list:

                            Code:
                            2020-03-21 9:29:31 AM  -------------
                            Filled: 117
                            Cancelled: 58
                            Accepted: 1
                               shrt_sl_26
                            Working: 1
                               shrt_tp_26
                            launched: 0
                            
                            2020-03-21 9:29:43 AM  -------------
                            Filled: 118
                            Cancelled: 58
                            CancelSubmitted: 1
                               shrt_tp_26
                            launched: 1
                               shrt_tp, canceling
                            
                            2020-03-21 9:29:44 AM  -------------
                            Filled: 118
                            Cancelled: 59
                            launched: 0
                            
                            2020-03-21 9:29:47 AM  -------------
                            Filled: 118
                            Cancelled: 59
                            Accepted: 1
                               long_en_34
                            launched: 0
                            
                            2020-03-21 9:29:48 AM  -------------
                            Filled: 118
                            Cancelled: 59
                            Accepted: 1
                               long_en_34
                            launched: 0
                            
                            2020-03-21 9:29:49 AM  -------------
                            Filled: 119
                            Cancelled: 59
                            Submitted: 2
                               long_sl_34
                               long_tp_34
                            launched: 0
                            
                            2020-03-21 9:29:50 AM  -------------
                            Filled: 119
                            Cancelled: 59
                            [B]Accepted: 1
                               long_sl_34
                            Working: 1
                               long_tp_34[/B]
                            launched: 0
                            
                            2020-03-21 9:29:51 AM  -------------
                            Filled: 120
                            Cancelled: 60
                            launched: 0
                            
                            1816488, [2, ES 06-20, 1 Tick]   FREEZE
                            From example above we can see that the queue contained 2 orders (OCO-paired stop loss and profit target) and no new orders submitted before to freeze. It looks like reasonable load.
                            Attached Files
                            Last edited by fx.practic; 03-21-2020, 11:56 AM.
                            fx.practic
                            NinjaTrader Ecosystem Vendor - fx.practic

                            Comment


                              #29
                              Here is the primitive way to calculate delay between bars events and real-time.
                              I hope there is more elegant way.
                              Attached Files
                              fx.practic
                              NinjaTrader Ecosystem Vendor - fx.practic

                              Comment


                                #30
                                I have the same issue which only occurs with live orders. In my case it is occurs with stop loss move. When the freeze occurs the stop loss is yellow in color, meaning that the order was submitted but no confirmation. At that point the chart is frozen and I'm forced to restart. After restart, I see that the stop loss move was actually successful, so it was Ninja likely freezing before confirmation from CQG. I did not have this issue on NinjaTrader 8 rev 20. I had upgraded from 20 to 22 and this is when I noticed the issue. I have reverted back to 20 and will verify if issue occurs or not. If it does, then I will suspect the major Windows update, otherwise the issue was introduce with either Rev 21 or 22 (I never ran rev 21).

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by trilliantrader, 04-18-2024, 08:16 AM
                                5 responses
                                22 views
                                0 likes
                                Last Post trilliantrader  
                                Started by Davidtowleii, Today, 12:15 AM
                                0 responses
                                3 views
                                0 likes
                                Last Post Davidtowleii  
                                Started by guillembm, Yesterday, 11:25 AM
                                2 responses
                                9 views
                                0 likes
                                Last Post guillembm  
                                Started by junkone, 04-21-2024, 07:17 AM
                                9 responses
                                68 views
                                0 likes
                                Last Post jeronymite  
                                Started by mgco4you, Yesterday, 09:46 PM
                                1 response
                                12 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Working...
                                X