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

Gaps in data from NinjaTrader Continuum

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

    Gaps in data from NinjaTrader Continuum

    I have downloaded 20 days of 30-second bars of the ES 12-23 and NQ 12-23 contracts from NinjaTrader Continuum to find significant gaps in these price histories. For example, the entire week of 2023-09-25 is missing for both contracts:

    ES 12-23,2023-09-22 14:58:30,4361.75,4361.75,4361.5,4361.75,116
    ES 12-23,2023-09-22 14:59:00,4361.75,4362,4361.5,4362,110
    ES 12-23,2023-09-22 14:59:30,4362.25,4362.25,4361,4362.25,421
    ES 12-23,2023-09-22 15:00:00,4362.25,4363,4362.25,4362.75,183
    ES 12-23,2023-10-03 00:00:30,4318,4318.75,4317.75,4318.75,313
    ES 12-23,2023-10-03 00:01:00,4318.5,4320,4318.5,4319.75,720
    ES 12-23,2023-10-03 00:01:30,4319.75,4320.25,4319.5,4320,247
    ES 12-23,2023-10-03 00:02:00,4320,4320.25,4319.5,4319.5,115


    NQ 12-23,2023-09-22 14:58:30,14873.5,14873.75,14872.5,14873,17
    NQ 12-23,2023-09-22 14:59:00,14872.5,14874,14872.5,14874,63
    NQ 12-23,2023-09-22 14:59:30,14874.75,14875,14871.25,14874.5,120
    NQ 12-23,2023-09-22 15:00:00,14874.5,14876.75,14874.5,14876.25,73
    NQ 12-23,2023-10-03 00:00:30,14956,14961,14955,14958.75,160
    NQ 12-23,2023-10-03 00:01:00,14959,14966.25,14959,14965.25,201
    NQ 12-23,2023-10-03 00:01:30,14965.25,14968.5,14964,14966.75,122
    NQ 12-23,2023-10-03 00:02:00,14967.25,14967.75,14964,14964.5,60

    I am using the following indicator to download these price histories:

    Code:
    [HASHTAG="t3322"]region[/HASHTAG] Using declarations
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System.Windows.Media;
    using System.Xml.Serialization;
    #endregion
    
    //This namespace holds Indicators in this folder and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.Indicators
    {
    public class SavePriceHistory : Indicator
    {
    private string path;
    private StreamWriter sw; // a variable for the StreamWriter that will be used
    
    protected override void OnStateChange()
    {
    if(State == State.SetDefaults)
    {
    Calculate = Calculate.OnBarClose;
    Name = "SavePriceHistory";
    PrintTo = PrintTo.OutputTab1;
    }
    // Necessary to call in order to clean up resources used by the StreamWriter object
    else if(State == State.Terminated)
    {
    if (sw != null)
    {
    sw.Close();
    sw.Dispose();
    sw = null;
    }
    }
    }
    
    protected override void OnBarUpdate()
    {
    string path = NinjaTrader.Core.Globals.UserDataDir + Instrument.FullName + ".csv"; // Define the Path to our test file
    Print(NinjaTrader.Core.Globals.UserDataDir);
    sw = File.AppendText(path); // Open the path for writing
    sw.WriteLine(Instrument.FullName + "," + Time[0] + "," + Open[0] + "," + High[0] + "," + Low[0] + "," + Close[0] + "," + VOL()[0]); // Append a new line to the file
    sw.Close(); // Close the file to allow future calls to access the file again.
    }
    }
    }
    
    [HASHTAG="t3322"]region[/HASHTAG] NinjaScript generated code. Neither change nor remove.
    
    namespace NinjaTrader.NinjaScript.Indicators
    {
    public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
    {
    private SavePriceHistory[] cacheSavePriceHistory;
    public SavePriceHistory SavePriceHistory()
    {
    return SavePriceHistory(Input);
    }
    
    public SavePriceHistory SavePriceHistory(ISeries<double> input)
    {
    if (cacheSavePriceHistory != null)
    for (int idx = 0; idx < cacheSavePriceHistory.Length; idx++)
    if (cacheSavePriceHistory[idx] != null && cacheSavePriceHistory[idx].EqualsInput(input))
    return cacheSavePriceHistory[idx];
    return CacheIndicator<SavePriceHistory>(new SavePriceHistory(), input, ref cacheSavePriceHistory);
    }
    }
    }
    
    namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
    {
    public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
    {
    public Indicators.SavePriceHistory SavePriceHistory()
    {
    return indicator.SavePriceHistory(Input);
    }
    
    public Indicators.SavePriceHistory SavePriceHistory(ISeries<double> input )
    {
    return indicator.SavePriceHistory(input);
    }
    }
    }
    
    namespace NinjaTrader.NinjaScript.Strategies
    {
    public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
    {
    public Indicators.SavePriceHistory SavePriceHistory()
    {
    return indicator.SavePriceHistory(Input);
    }
    
    public Indicators.SavePriceHistory SavePriceHistory(ISeries<double> input )
    {
    return indicator.SavePriceHistory(input);
    }
    }
    }
    
    #endregion
    ​


    I closed and reopened NinjaTrader and reran the indicator but the same data are still missing.

    How can I resolve this problem and access complete price histories?

    #2
    Hello Red_70,

    Thanks for your post.

    So I may accurately assist, please answer all the questions below.
    • What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)
    • Are you testing this by enabling the indicator on a chart window? Or, are you testing this by backtesting a strategy using that indicator in the Strategy Analyzer?
    • Are you downloading historical Minute data in the Tools > Historical Data window or historical Tick data in the Tools > Historical Data window?
    • If you re-download historical data for those instruments on that date in the Tools > Historical Data window, do you see the historical data listed in the Tools > Historical Data window?
    I look forward to assisting further.


    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hi Brandon,
      • I'm using NT version 8.1.1.7 64-bit;
      • Yes, I'm testing this by enabling the indicator on a chart window;
      • No, I wasn't downloading data via Tools -> Historical Data; instead I selected 30 second bars in the Properties section of the chart's Data Series window;
      • If I download these data using Tools -> Historical Data, I do see the data in the Tools -> Historical Data window.
      At this point, if I rerun my indicator in the desired chart windows, all of the previously missing data appears to now be present. So the problem seems to be solved.

      So, for a follow up question, why doesn't all of the data download from the chart without manually using the Tools -> Historical Data approach?​

      Comment


        #4
        Hello Red_70,

        Thanks for your notes.

        I am unable to reproduce the behavior you are reporting in regard to data for 09/25/2023 loading on the chart for the ES or NQ instrument. Note that I did not download historical data in the Tools > Historical Data window before testing this.

        See the attached image showing that I see data populating on the chart for the ES instrument on 09/25/2023.

        Without reproducing the behavior it is hard to say for certain exactly what occurred on your end.

        That said, if you see the behavior occur again in the future, please write in to support[at]ninjatrader[dot]com and one of our Support Technicians will be happy to assist.
        Attached Files
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Great. Thanks for following up!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by futtrader, Today, 01:16 PM
          0 responses
          0 views
          0 likes
          Last Post futtrader  
          Started by Segwin, 05-07-2018, 02:15 PM
          14 responses
          1,789 views
          0 likes
          Last Post aligator  
          Started by Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          838 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,294 views
          1 like
          Last Post jgualdronc  
          Started by Touch-Ups, Today, 10:36 AM
          0 responses
          13 views
          0 likes
          Last Post Touch-Ups  
          Working...
          X