Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Close[0] freezing with Zen-Fire feed

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

    Close[0] freezing with Zen-Fire feed

    Noticed a peculiar phenomenon today. Close[0] freezes a few seconds after the start of the strategy (i.e. its value ceases to update) when using Zen-Fire data. I am accessing Close[0] inside OnMarketData(). However, 'Last' appears to get properly updated (delivered thru MarketDataEventArgs), and GetCurrentBid() and GetCurrentAsk() work fine too inside OnMarketData(). Control Center, Dom, MarketAnalyzer, T&S and charts all appear to display the last trade price correctly, or at least uniformly. I have the latest NT7 (release 9). Zen-Fire is a Mirus demo. The same problem occurs with my NT live licence key and the Sim key provided by Mirus.

    #2
    Hello,

    Thank you for your post.

    Where exactly are you calling Close[0] from in OnMarketData? Are you using it inside any bracket statements?

    Are you printing times to debug this and determine it is freezing? Can you show me what your test looks like?

    When using the following functions as my first line in OnMarketData(), I do not experience any delay in Close[0] on the Zen-Fire feed. Can you please try the same?

    Code:
       Print("Last = " + e.Price + " " + e.Time);
       Print("Close = " + Close[0] + " " + e.Time);
    MatthewNinjaTrader Product Management

    Comment


      #3
      Originally posted by NinjaTrader_Matthew View Post
      Hello,

      Thank you for your post.

      Where exactly are you calling Close[0] from in OnMarketData? Are you using it inside any bracket statements?

      Are you printing times to debug this and determine it is freezing? Can you show me what your test looks like?

      When using the following functions as my first line in OnMarketData(), I do not experience any delay in Close[0] on the Zen-Fire feed. Can you please try the same?

      Code:
         Print("Last = " + e.Price + " " + e.Time);
         Print("Close = " + Close[0] + " " + e.Time);
      Hi Matthew,
      Pls find attached the log file, fields delimited by semi-colon ";". First mismatch on row 373, after which Close[0] (column 'Close') does not follow Last any more (column 'ArgPrice' when ArgDataType = Last). I tried to send Excel but this system did not allow. Same thing with ES, CL, etc.
      Attached Files

      Comment


        #4
        Hi again,
        Same problem with AMP-CQG demo when tracking CL, log attached. The problem appears on line 1313 after which Close[0] freezes. Note that decimal separator is comma (,), not dot. Implies that this does not originate from Zen-Fire? Pls let me know if you want to see the whole source code, can send it to you. Cheers - Jari
        Attached Files

        Comment


          #5
          Hello,

          If you do not mind sharing a snippet of the code you are using to produce this behavior, I would like to take a look to see if there is anything there causing this.
          MatthewNinjaTrader Product Management

          Comment


            #6
            Matthew,

            Here's the code (attached). Added some comments. You may run it in 2 different modes: either in print-to-file or in print-to-the-output-window mode. In the former case the program assumes the use of C\NTLogs folder for writing the log file. Anxiously waiting for your results / comments! - Cheers Jari
            Attached Files

            Comment


              #7
              Thanks for this script.

              I noticed you were missing the protected override void OnBarUpdate() method in your code.

              While you're not using this, it is required to ensure functionality. After adding this to your test, the behavior was eliminated and updates as expected.

              Please let me know if this does not improve the results on your end.
              MatthewNinjaTrader Product Management

              Comment


                #8
                Interesting, I thought that one should not include any protected override methods that are not used. But OnBarUpdate() is an exception,should I leave it blank? Will test... Jari

                Comment


                  #9
                  OnBarUpdate is an abstract method, which would be required. Unlike the virtual methods such as OnStartUp, etc.



                  It can be left blank, but is required that is declared.
                  MatthewNinjaTrader Product Management

                  Comment


                    #10
                    Problem solved with a blank OnBarUpdate(). Close[0] gets updated in tandem with 'Last'. Works well with both data feeds. Also noticed that OnMarketData() gets called *before* OnBarUpdate() when there's a trade - which suits me well. Thanks again.

                    Comment


                      #11
                      Glad to hear that worked for you too.

                      OnMarketData and OnBarUpdate are running on separate threads so there is no predictability as to which method gets called first.
                      MatthewNinjaTrader Product Management

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by arvidvanstaey, Today, 02:19 PM
                      4 responses
                      11 views
                      0 likes
                      Last Post arvidvanstaey  
                      Started by samish18, 04-17-2024, 08:57 AM
                      16 responses
                      59 views
                      0 likes
                      Last Post samish18  
                      Started by jordanq2, Today, 03:10 PM
                      2 responses
                      9 views
                      0 likes
                      Last Post jordanq2  
                      Started by traderqz, Today, 12:06 AM
                      10 responses
                      18 views
                      0 likes
                      Last Post traderqz  
                      Started by algospoke, 04-17-2024, 06:40 PM
                      5 responses
                      47 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Working...
                      X