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

Avoiding MarketAnalyzer being always 1 tick late

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

    Avoiding MarketAnalyzer being always 1 tick late

    Hi,
    This is to follow up OnBarUpdate/OnMarketData sequence threads, see








    Since OBU is always called before OMD (which updates the data in a bid/ask enabled indicator), how can we avoid indicator values being always 1 tick late in Market Analyzer ?


    Even if we manage to have up to date data showing up in the data using OnRender or other solutions, this hack is not availble in Market Analyzer columns.



    Thanks

    #2
    Hello gomifromparis,

    Is OnMarketData needed?

    Could you instead add a 1 tick ask and 1 tick bid series and put all of the logic in OnBarUpdate?

    Or could the indicator plot be updated from OnMarketData instead of waiting for the next tick to process in OnBarUpdate?

    It would not be possible to cause OnMarketData to trigger before OnBarUpdate.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,


      Thanks for replying but you're not answering.


      Originally posted by NinjaTrader_ChelseaB View Post
      Is OnMarketData needed?
      It's part of the question... If OnMarketData wasn't needed, there would be no issue.


      Originally posted by NinjaTrader_ChelseaB View Post
      Could you instead add a 1 tick ask and 1 tick bid series and put all of the logic in OnBarUpdate?

      Forget the bid/ask, just suppose I need OnMarketData. For instance because I am computing the current bar VWAP, or the current bar POC. So I need to be able to acces each tick's price and volume


      Originally posted by NinjaTrader_ChelseaB View Post
      Or could the indicator plot be updated from OnMarketData instead of waiting for the next tick to process in OnBarUpdate?
      This will work with the plot, but I found it not to work in Market Analyzer (probably because values are only updated after a call to OnBarUpdate). Did you try it ?

      Originally posted by NinjaTrader_ChelseaB View Post
      It would not be possible to cause OnMarketData to trigger before OnBarUpdate.
      This is not the question. Question is "when using OnMarketData to update indicator internal values (and Plots), is there a way to not have the MarketAnalyzer displayed values always be 1 tick late". I am not asking OMD to trigger before OBU. I am asking if there is "some way" that the market analyzer data can be kept in sync with the plot data.


      Thanks!

      Comment


        #4
        Hello gomifromparis,

        OnMarketData triggers after OnBarUpdate.

        I have tested on my end and I not finding that the market update value is different than the OnBarUpdate value when OnMarketData updates after OnBarUpdate.

        Do you have a test script that shows that the value produced by OnMarketData is different than the value produced by OnBarUpdate?

        I'm not showing that OnMarketUpdate is one tick late.

        Also, the link you provided to other thread is pertaining to the order of operations. joanrocagas is referring to OnBarUpdate never having the value of OnMarketData because OnMarketData updates after OnBarUpdate..
        Last edited by NinjaTrader_ChelseaB; 07-22-2018, 04:20 PM.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Sure, he's a test sample, it counts the number of ticks in a bar, updating data when tick info is received, ie in OnMarketData.

          You will see that in Market Analyzer data is always 1 tick late when compared to actual plot.
          Attached Files

          Comment


            #6
            Hello gomifromparis,

            I would recommend you use prints to observe instead of relying on the update intervals of the Market Analyzer and Chart.

            These windows do not update at the same speed. This means as values are changing rapidly they may display different values.

            Below is a link to a video that demonstrates.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              As you can see, it is not a refresh issue, https://www.screencast.com/t/au1tf3BQ


              You can wait mutliple seconds, the data in the market analyzer is always 1 tick late.

              Comment


                #8
                Hello gomifromparis,

                I disagree.

                The prints show otherwise.

                Can you show with prints that this is not the case?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  No I cannot show you with prints since prints are useless. Did you watch my video ?

                  The question is not if deep deep inside the indicator embedded in the market analyzer, the values are correct (which they are).
                  The question is are these values available to see for the trader watching them.

                  So please forget about the prints, and take a look at the video I made the effort to record, you will see that an actual trader in front of an actual screen will never see the same value in the market analyzer and the actual plot.


                  The market analyzer is always 1 tick late, so in very slow markets , the Market Analyzer will only "catch up" after multiple seconds or even minutes (depending on when the next tick arrives)

                  Comment


                    #10
                    Hello gomifromparis,

                    The prints are not useless. The prints are more accurate that what you will see on the UI.

                    Rely on prints, do not rely on what you are seeing in the UI.

                    The Market Analyzer UI updates 750 milliseconds slower than a chart. However, the script itself runs at the same speed.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Please watch the video, I don't think you're getting it.

                      You will see it's obviously not a problem of refresh.


                      You will see the Plot and the Market Analyzer always being off by 1 tick.
                      Reason being the plot is updated in OMD and showing it, while MarketAnalyzer also being updated in OMD (and showing it Prints, which we don't care), but not actually showing it (which we do care, since we don't use prints for trading)

                      Comment


                        #12
                        Hello gomifromparis,

                        I am understanding the Market Analyzer updates behind the chart.

                        This is an issue with the UI and is not an issue with OnMarketData and OnBarUpdate. The NinjaScript is working correctly and this is demonstrated in the prints.

                        I have submitted a report on your behalf that the Market Analyzer UI is updating behind the script.
                        From what I am seeing, the column in the Market Analyzer UI only updates when OnBarUpdate updates and does not update when OnMarketData updates in the script.
                        This causes the Market Analyzer UI to sometimes be behind the script that is setting the values.

                        Once I have a tracking ID for this behavior I will post in this thread.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          This thread has always been about the Market Analyzer UI, no one said NinjaScript wasn't working..

                          What I understand though from your convulated post is that you confirm that (inital question in OP...)
                          • With the actual design, Market Analyzer UI will always (not sometimes) be 1 Tick late if the indicator updates its data in OnMarketData.
                          • To you knowledge there is no hack around that.


                          Is this correct ?

                          Comment


                            #14
                            Hello gomifromparis,

                            Thank you for your response.

                            That is correct. We have confirmed that this is due to the UI and it appears to always be the case. At this time there is no work around for this.

                            Thank you for your report on this matter and your patience when sorting out the specifics.

                            I will update this thread when I have further details on this matter.

                            Comment


                              #15
                              Gomi,

                              Wanted to follow up a bit more to see if we could find a way that is currently undocumented to do this that perhaps we could make supported.

                              As you mentioned, OMD and OBU is just a sequence of events item where one has to come before the other. The issue is that you want to refresh the Market Analyzer after OMD but not before the next OBU. You mentioned you had a method to do that on Chart OnRender. Perhaps there is a solution thinking outside the box involving Timers. I'd like to understand the scenario a bit more. Can you reach out to me at brett.barrett at ninjatrader dot com and lets dig in a little more since I would like to find an approach for you if possible. I'd like to understand the approach your using in OnRender and I'll see if it could be applied to the Market Analyzer in another form.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by bortz, 11-06-2023, 08:04 AM
                              47 responses
                              1,602 views
                              0 likes
                              Last Post aligator  
                              Started by jaybedreamin, Today, 05:56 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post jaybedreamin  
                              Started by DJ888, 04-16-2024, 06:09 PM
                              6 responses
                              18 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by Jon17, Today, 04:33 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post Jon17
                              by Jon17
                               
                              Started by Javierw.ok, Today, 04:12 PM
                              0 responses
                              12 views
                              0 likes
                              Last Post Javierw.ok  
                              Working...
                              X