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

Determining historical data while processing delayed data

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

    Determining historical data while processing delayed data

    I currently subscribe to kinetick data, but do not pay any exchange fees and because of this I have data that is delayed 15 min by my understanding. In my strategy I send out email alerts, but would like to determine when I am backtesting, or loading up historical data vs running real time such that I do not send emails out everytime i reload a chart. I have tried the "Historical" property, but this apparently returns true all the time and I can only guess this is because I am on 15 min delayed data. Is there a way that I could easily determine that I am live with my data? I have tried some method but none have worked thus far.

    Mark

    #2
    Hi Mark, correct this would be unfortunately a limitation you run into here working on delayed streaming data - I would suggest adding a user input (for example a bool) to your strategy that you can toggle to enabled / disable alerts, this way you could control them before reloading data or backtesting from the chart.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hello Mark and Bertrand,

      I know this is many months after the thread started, but I had an idea about this, since I have a similar need, and I wanted to get your view point on it.

      If I understand correctly, the OnMarketData() method is only called in real time, whether the data is delayed or not. It is not called for historical data. I was thinking of setting up a boolean variable that gets set to true by the OnMarketData method, and then checking that variable in code that needs to know if the bar is real-time or not. I'm thinking that OnMarketData will almost always be called before the OnBarUpdate method of the far-right bar of a chart. I could use the following line at the beginning of the OnMarketData method:

      if (!isRealTime) { isRealTime = true; }

      Do you think this will work as a tool to help with optimizing code to work properly with historical and real time data (even delayed)? (I'm already using the OnMarketData method for other reasons, so I wouldn't be using it for just this purpose. I know putting something in that method slows performance.)

      Thanks in advance.

      Scott
      sh_daggett
      NinjaTrader Ecosystem Vendor - NinjaLaunchpad

      Comment


        #4
        Hi Scott, I think that's a good idea and should do it - especially if you're already working with OMD in your script here.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kujista, 04-22-2024, 07:46 AM
        4 responses
        17 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by SentientDavid, Today, 01:34 AM
        1 response
        23 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Irukandji, Today, 05:50 AM
        0 responses
        5 views
        0 likes
        Last Post Irukandji  
        Started by ageeholdings, Today, 05:22 AM
        0 responses
        11 views
        0 likes
        Last Post ageeholdings  
        Started by llanqui, 04-28-2024, 10:32 AM
        2 responses
        22 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Working...
        X