Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-Instrument Market Analyzer Column hangs Market Analyzer

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

    Multi-Instrument Market Analyzer Column hangs Market Analyzer

    Hi, I'm facing a hanging issue with a multi-instrument Market Analyzer column, which I believe comes from a deadlock. I've attached a Market Analyzer template and the code for the custom column below.

    FYI, for some weird reason, the hang doesn't always happen, and I've found that in some computers it doesn't hang most of the time, and in others it hangs almost always.

    The code simply adds 28 forex instruments, and calculates an EMA when the column reaches State.Transition. I've also setup multiple of these columns on a Market Analyzer and added the 28 instruments it uses as rows. After doing this, Market Analyzer gets stuck in a "Loading..." or "Calculating..." state forever. None of the columns update anymore, and even some charts get affected. Even closing NT8 gets affected, it stays open in the background forever, and needs to be force closed with the Task Manager.

    I'm using the latest version of NT8 and the "My NinjaTrader" data provider.

    I'd really appreciate some help on finding a workaround or getting this issue fixed!
    Attached Files
    Last edited by Matheusfx; 02-22-2021, 03:16 AM.

    #2
    Hello Matheusfx thanks for your post.

    This script works properly on my installation with a Kinetick connection. There is likely an issue with data loading on your end. Please reduce the script to narrow down the data loading issue, loading one instrument at a time. Once you have confirmed that one instrument is loading, add the next one. Once you have found the instrument where the script stops loading, try loading that onto a blank chart to see if your data feed is providing that instrument.

    I look forward to assisting.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      The data provider is providing all of the instruments, everything loads and updates as expected without the multi-instrument column. I suspect the underlying issue is related to this one: https://ninjatrader.com/support/foru...angs-the-chart

      Also, switching to a FXCM Demo connection causes the same issue.
      Last edited by Matheusfx; 02-22-2021, 09:07 AM.

      Comment


        #4
        Hello Matheusfx, thanks for your reply.

        Have you tried reducing the amount of data series being added? What if you try N-1, N-2, N-3 added series? Is there any point where it does load? If you do find a certain point where the multiple series will load and when you add another series, it does not load, I will be happy to test the same thing on a test FXCM connection.

        Best regards.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          I've narrowed down the problem, the reduced examples are attached in this post.

          The hang starts happening after I add the EURGBP data series to the column, removing it seems to make it stop hanging the application. I also couldn't reproduce it without the AUDCAD line inserted into the Market Analyzer template. I'm not sure if it's due to these currency pairs specifically, or the number of instruments added, but there is definitely something going wrong internally inside NT8. Another thing that seems to be important to cause this is calling an Indicator. If I remove the EMA call that's in State.Transition, I can't reproduce the issue, even with the 28 currency pairs inserted.

          A tip to reproduce this without relying too much on luck, is repeatedly pressing F5 to reload the scripts in Market Analyzer, as fast as you can. It hangs after a few reloads on my machine.

          I'd really appreciate some help on this issue, this has been plaguing my workflow for months.
          Attached Files

          Comment


            #6
            Hello Matheusfx,

            On the line calling the EMA I was getting a bars ago error because all internal price series indexes are -1. Please check to see if you are getting any errors in the Log tab of the Control Center as well. I changed the use of the Closes array to BarsArray to target the bars series:

            CurrentValue = EMA(BarsArray[BarsInProgress], 20)[0];

            Please let me know if I can assist any further.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChrisL View Post
              Hello Matheusfx,

              On the line calling the EMA I was getting a bars ago error because all internal price series indexes are -1. Please check to see if you are getting any errors in the Log tab of the Control Center as well. I changed the use of the Closes array to BarsArray to target the bars series:

              CurrentValue = EMA(BarsArray[BarsInProgress], 20)[0];

              Please let me know if I can assist any further.
              I did your suggested change and my Market Analyzer still hangs after a few reloads. I'm not even sure how it would have any internal price series indexes at -1 during State.Transition, as it's only supposed to be called after processing all historical data.

              During my last test run I've got a few errors on my Log, but I'm not sure if they happened right before it hanged, or if they were already there, but here they are:
              Error in realtime market data handling: System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException( ExceptionResource resource) at System.Collections.Generic.List`1.Enumerator.MoveN extRare() at NinjaTrader.NinjaScript.NinjaScriptBase.SetState(S tate state) at NinjaTrader.Gui.MarketAnalyzer.MarketAnalyzerGrid. HandleBarsBackNow(PendingBarsBackState barsBackState) at NinjaTrader.Gui.MarketAnalyzer.MarketAnalyzerGrid. OnRealTimeDataTimerTick(Object sender, EventArgs e) at NinjaTrader.Cbi.Instrument.<>c__DisplayClass155_0. <OnRealtimeDataTimerElapsed>b__1(SubscribedThrea d[] threads, Int32 i, RealtimeEvents evts)
              'MAHangTest' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state. Attempted to load EURNZD Default: 5 Minute
              'MAHangTest' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state. Attempted to load AUDJPY Default: 5 Minute
              'MAHangTest' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state. Attempted to load AUDCAD Default: 5 Minute
              'MAHangTest' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state. Attempted to load USDJPY Default: 5 Minute
              'MAHangTest' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state. Attempted to load NZDUSD Default: 5 Minute
              'MAHangTest' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state. Attempted to load USDCHF Default: 5 Minute
              'MAHangTest' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state. Attempted to load USDCAD Default: 5 Minute
              'MAHangTest' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state. Attempted to load EURJPY Default: 5 Minute
              'MAHangTest' tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state. Attempted to load EURUSD Default: 5 Minute
              The "tried to load additional data" errors don't make any sense to me, as the AddDataSeries methods are all clearly defined inside the State.Configure state.
              As for the "error in realtime market data handling", it's an internal NT8 error which I couldn't debug because NT8's code is obfuscated.

              This doesn't seem to be expected behavior, especially because it happens even without the fast reloads, randomly. I'd be really grateful if you could forward this to the development team to see if they're able to find the underlying issue.

              Comment


                #8
                Hello Matheusfx, thanks for the follow up.

                I'm sorry but I am not able to reproduce the issue. What is the main purpose of the custom column? What is it supposed to do? Why is it loading all these series just to input a single EMA value from one into CurrentValue at loading time? I will not be able to report anything as a bug unless we have completely ruled out the possibility of custom code causing the problem.

                I look forward to hearing from you.
                Chris L.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by nutmame1, Today, 08:26 PM
                0 responses
                9 views
                0 likes
                Last Post nutmame1  
                Started by dr0832, Today, 07:02 PM
                0 responses
                14 views
                0 likes
                Last Post dr0832
                by dr0832
                 
                Started by mlurskint8, Today, 05:27 PM
                3 responses
                19 views
                0 likes
                Last Post NinjaTrader_ShawnB  
                Started by SteveTheCPA, Today, 04:54 PM
                0 responses
                10 views
                0 likes
                Last Post SteveTheCPA  
                Started by Unsuitable, Today, 02:42 PM
                2 responses
                14 views
                0 likes
                Last Post Unsuitable  
                Working...
                X