Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ReloadAllHistoricalData()

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

    ReloadAllHistoricalData()

    I want to use ReloadAllHistoricalData() in OnBarUpdate().

    I am aware that I need to use a logical condition that prevents ReloadAllHistoricalData() from being triggered several times in a row. This can be easily achieved by defining a reload time and counting real-time bars.

    Here are my questions:

    (1) It is my understading that ReloadAllHistoricalData() will reload all bar series loaded by the indicator. For example if I have an indicator that runs on a tick chart, but has a minute and a daily bar series added, all three bars objects - tick bars (chart bars), minute bars and daily bars - should be updated. Is this correct?

    (2) I understand that the reload affects other indicators added to the same chart. Is this correct?

    (3) I further understand that the reload will be applied to all charts with the same instrument and type of data. In the example above all tick bars, minute bars and daily bars for the instruments called by the indicator would be updated onall charts concerned. Is this correct?

    I am asking the question because in an automated strategy you would wish to update chart data

    - in the event of a disconnect
    - but also once per day after the daybreak

    I have tested the second option from within OnBarUpdate() and it seems to work.

    #2
    Calling in OnBarUpdate kind of works, but is not supported. I have had issues using it. I had asked for a better option to provide a means to only reload missing data instead of all data (similar to what NT does when you connect).

    See http://ninjatrader.com/support/forum/showthread.php?t=95035

    Comment


      #3
      Hello Harry,

      I just wanted to post a quick follow up message.

      aslane would be correct, using this from OnBarUpdate can certainly cause problems so it would not be suggested but you are certainly free to try and see if you can make this work for your use.

      As for your questions, 1 and 2 would be correct.
      The third question, from my test this seems to reload the subscribed instrument. With my test I saw the instrument reload on various timeframes rather than just the same data type.

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Hello Jesse,

        Thank you for your answer.

        Calling ReloadAllHistoricalData() so far seems to be the only option to catch the settlement price (daily close) in OnBarUpdate() via an automated strategy.

        Or are there any other options?

        Comment


          #5
          Hello Harry,

          Thank you for your response.

          Reloading the historical data should not give you the most recent close of a bar when running with Calculate.OnBarClose. Are you advising that is in fact loading the last bar for the series when reloading historical data and using Calculate.OnBarClose?

          I look forward to your response.

          Comment


            #6
            Originally posted by Harry View Post
            Calling ReloadAllHistoricalData() so far seems to be the only option to catch the settlement price (daily close) in OnBarUpdate() via an automated strategy.

            Or are there any other options?
            I found the only way to get this data reliably was to use OnMarketData and look for
            Code:
            marketDataUpdate.MarketDataType == MarketDataType.Settlement
            Combining this with adding the daily data series for historical closes generally works.

            There is another thread here somewhere where I talk about todays daily bar does not get properly updated with the settlement price (so you have to monitor the OnMarketData). I think Ninja was going to address, but it is still an issue in 8.0.4.0. Obviously, monitoring market data to get the settlement is not particularly efficient.

            Comment


              #7
              Here is the other thread for reference: http://ninjatrader.com/support/forum...ad.php?t=92794

              Comment


                #8
                Originally posted by NinjaTrader_PatrickH View Post
                Hello Harry,

                Thank you for your response.

                Reloading the historical data should not give you the most recent close of a bar when running with Calculate.OnBarClose. Are you advising that is in fact loading the last bar for the series when reloading historical data and using Calculate.OnBarClose?

                I look forward to your response.

                Hi Patrick,

                I was talking about daily data. When you let the chart run, it loads real-time data. A daily bar built from real-time data will show the daily high, daily low and last traded price. A daily bar built from historical data (case DTN/IQ or Kinetick) will show the daily high, the daily low and the daily settlement price.

                Therefore I need to replace real-time data with historical data, if I wish to catch the settlement price from the historical daily data base.

                When the indicator is running in Calculate.OnBarClose, the daily bar loaded via the secondary bar series should be processed end of day. When it is processed it will probably not show the settlement price, but the last traded price of the day.

                However, this bar is not always processed, because in some cases, NinjaTrader 8 omits processing this bar. This is a bug which had been discussed in a different thread. So what I need to do is

                -> trigger the loading of historical data (backfill) in the beginning of the new trading day (the settlement price is only available after the CME technical break)
                -> then catch the settlement price as the daily close of the prior day, such as available in the historical data base

                Aslane has suggested a different way of catching the settlement price via marketDataUpdate.MarketDataType == MarketDataType.Settlement. I have not yet tried this option but will do so. Maybe it is a more elegant way of getting hold of the settlement price.
                Last edited by Harry; 02-06-2017, 11:43 AM.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by CortexZenUSA, Today, 12:53 AM
                0 responses
                1 view
                0 likes
                Last Post CortexZenUSA  
                Started by CortexZenUSA, Today, 12:46 AM
                0 responses
                1 view
                0 likes
                Last Post CortexZenUSA  
                Started by usazencortex, Today, 12:43 AM
                0 responses
                5 views
                0 likes
                Last Post usazencortex  
                Started by sidlercom80, 10-28-2023, 08:49 AM
                168 responses
                2,265 views
                0 likes
                Last Post sidlercom80  
                Started by Barry Milan, Yesterday, 10:35 PM
                3 responses
                12 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X