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

1 tick data series late

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

    1 tick data series late

    Hi.


    I have made indicator with additional 1 tick data series.
    I'm trying to understand why the indicator start calculate 1 tick data series only after one day of primary data series.


    This is my code.
    Code:
    protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description                                    = @"Enter the description for your new custom Indicator here.";
                    Name                                        = "Test";
                    Calculate                                    = Calculate.OnEachTick;
                    IsOverlay                                    = true;
                    DisplayInDataBox                            = true;
                    DrawOnPricePanel                            = true;
                    DrawHorizontalGridLines                        = true;
                    DrawVerticalGridLines                        = true;
                    PaintPriceMarkers                            = true;
                    ScaleJustification                            = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                    //Disable this property if your indicator requires custom values that cumulate with each new market data event. 
                    //See Help Guide for additional information.
                    IsSuspendedWhileInactive                    = true;
                    
                    
                }
                else if (State == State.Configure)
                {
                    AddDataSeries(BarsPeriodType.Tick,1);
                }
            }
    
            protected override void OnBarUpdate()
            {
                Print(CurrentBars[0]+" "+CurrentBars[1]);
            }
        }
    When I run it on 30 minutes ES 09-18 I have following in the output.
    HTML Code:
    0 -1
    1 -1
    2 -1
    3 -1
    4 -1
    5 -1
    6 -1
    7 -1
    8 -1
    9 -1
    10 -1
    11 -1
    12 -1
    13 -1
    14 -1
    15 -1
    16 -1
    17 -1
    18 -1
    19 -1
    20 -1
    21 -1
    22 -1
    23 -1
    24 -1
    25 -1
    26 -1
    27 -1
    28 -1
    29 -1
    30 -1
    31 -1
    32 -1
    33 -1
    34 -1
    35 -1
    36 -1
    37 -1
    38 -1
    39 -1
    40 -1
    41 -1
    42 -1
    43 -1
    44 -1
    45 -1
    45 0
    45 1
    45 2
    45 3
    45 4
    45 5
    45 6
    45 7
    45 8
    45 9
    45 10
    45 11
    45 12
    </div>

    As you can see 1 tick data series appeared only on 45th 30min bar(1 day later).

    #2
    Hello blekdzhon,

    It might be that you are causing errors by trying to print the value of a bar that does not exist.

    If you print these separately, are you getting the same behavior?

    What version of NinjaTrader are you using? (Help > About. e.g. 8.0.X.X)

    Is the tick data showing as available in the Historical Data window?

    Try changing your code to:
    Code:
    if (CurrentBar > 0)
    	Print(string.Format("BIP: {0}, Time[0]: {1}, CurrentBar: {2}", BarsInProgress, Time[0], CurrentBar));
    My output when testing this showed thousands of ticks before the primary bar closed.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi. Thanks for reply.


      I'm using the last version - 8.0.14.1.
      I can see tick data in Historical Data window.
      I attached only part of output.

      There is no error on my side. The issue is that there are no tick data at the first day of data range.

      It should show lots of tick bars on one one primary bar. But as you see from 0 to 44 bar there is no 1 tick data, it prints -1.



      It works good on rithmic connection, the issue happens only on cqg continium.

      Comment


        #4
        Hello blekdzhon,

        The latest version of NinjaTrader is 8.0.14.2.

        The primary series is going to print for every tick (showing the timestamp of the close of the bar) due to TickReplay, and each individual tick will print as well for the secondary series (showing the actual time of that print).

        I have tested the print I have suggested on my end and I am finding the individual ticks are printing with the primary, alternating back and forth.

        The if (CurrentBar > 0) part should be removed though so we can see the first bar of primary printing. In the video I actually change this to if (CurrentBars[0] < 3) so that I can limit the output of output appearing in the output window (because of the number of ticks this is exceeding the maximum amount of prints that can appear in the output window)

        Below is a link to a video of this test.


        May I confirm you have tested the code shown suggested and you have experienced different behavior than what is shown in the video?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi.


          I have tested your code. It works as in your video.



          I'm not sure why did you use both tick replay and secondary data series? Does it make sense?


          I want to use indicator without tick replay, that's why I'm adding secondary data series.
          And it doesn't work with cqg provider.
          It skips first day with secondary data series.


          0 -1

          1 -1

          2 -1

          3 -1

          4 -1

          This first column is CurrentBars[0](30 min)
          The second column is CurrentBars[1](1 tick)
          0 -1 - means that there are no tick data on the close of the first 30min bar
          1 -1 - means that there are no tick data on the close of the second 30min bar
          and so on till 45th 30 min bar.
          On the 45th primary bar the output prints secondary data series, but not eariler.

          Comment


            #6
            Hello blekdzhon,

            That was my mistake. I was confusing this ticket with another ticket that involves an added 1 tick series with TickReplay enabled.

            However, I am not able to reproduce the behavior even with TickReplay disabled.

            Below is a link to a video with the same test with TickReplay disabled.

            Code:
            if (CurrentBars[0] < 3)
            	Print(string.Format("BIP: {0}, Time[0]: {1}, CurrentBar: {2}", BarsInProgress, Time[0], CurrentBar));
            Using the steps in the video are you getting different behavior?

            If so, I will want to connect with you and observe the behavior. Please send an email to platformsupport [at] ninjatrader [dot] com.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Yes I get different behavior. There are no tick data on first 3 primary bars.
              I have only three records.

              BIP: 0, Time[0]: 14.06.2018 1:30:00, CurrentBar: 0
              BIP: 0, Time[0]: 14.06.2018 2:00:00, CurrentBar: 1
              BIP: 0, Time[0]: 14.06.2018 2:30:00, CurrentBar: 2

              Comment


                #8
                Hello blekdzhon,

                I would like to schedule a call with you so that I may test this script on your end and verify the data is available.

                Please send an email to platformsupport [at] ninjatrader [dot] com. In the email please include a link to this forum thread.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by michi08, 10-05-2018, 09:31 AM
                3 responses
                740 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by sightcareclickhere, Today, 01:55 PM
                0 responses
                1 view
                0 likes
                Last Post sightcareclickhere  
                Started by Mindset, 05-06-2023, 09:03 PM
                9 responses
                258 views
                0 likes
                Last Post ender_wiggum  
                Started by Mizzouman1, Today, 07:35 AM
                4 responses
                18 views
                0 likes
                Last Post Mizzouman1  
                Started by philmg, Today, 01:17 PM
                1 response
                9 views
                0 likes
                Last Post NinjaTrader_ChristopherJ  
                Working...
                X