Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Market Replay issue - Range Bars issue on 1st day only?

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

    Market Replay issue - Range Bars issue on 1st day only?

    There's a small issue here, Windows XP and Vista 32 bit, NT 7.0.1000.10.

    ES 03-12 chart, default 24/7 or CME US Index Futures ETH.
    TRIN, US Equities RTH.

    Set Market Replay to 2/15/2012 with finish in April or whatever should be fine.

    On ES 03-12 4 range bar chart, add strategy below to the chart.
    This adds ^TRIN as the secondary series. (Calculate on Bar Close = False).

    Doesn't appear to matter where you start or if you use goto data to get closer to 9:30 am.

    The error is that the secondary bar series doesn't start getting called (to print) until 10:33 AM.

    BarsInProgress = 0 is getting called for each tick.


    Things I've noticed:

    - changed to minute bars appears to do something that causes this to work. And I was able to change by to range bars and it worked.
    - disconnecting market replay or restarting NT would cause the 10:33 am start again.
    - It appears that this past week works fine on the 1st day.
    - July 2011 did not.
    - Adding the strategy into the Strategies tab appears to work each time.
    - The values are correct when it starts at 10:33 am, so it's not 1 hour off or anything.
    - The charts are playing fine and have no issues of starting 1 hour late.

    The 2nd day forward starts at 9:33 am as expected.


    Code:
    #region Using declarations
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.Indicator;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Strategy;
    #endregion
    
    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
        /// <summary>
        /// Enter the description of your strategy here
        /// </summary>
        [Description("Enter the description of your strategy here")]
        public class FirstTradeAftet10 : Strategy
        {
            #region Variables
            // Wizard generated variables
            // User defined variables (add any user defined variables below)
    
            public static int ES   = 0; // 4 range
            public static int TRIN  = 1;
           
    
           
            #endregion
    
            /// <summary>
            /// This method is used to configure the strategy and is called once before any strategy method is called.
            /// </summary>
            protected override void Initialize()
            {
                Print ( "Initializing Test!" );
    
                CalculateOnBarClose = false;
       
       
    
                Add("^TRIN",     PeriodType.Minute, 3);  //BarsInProgress = 1 = TRIN
               
            }
    
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
    
               
                if (Historical) return;
               
                //Print ( "BarsInProgress   = " + BarsInProgress + "  " + Time[0].ToString() );           
               
                if ( BarsInProgress == TRIN )
                {   
               
                    Print ( " ["+BarsInProgress+"]=" + String.Format( "{0,7}" , String.Format( "{0:####.00}" ,Close[0])) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Time[0]) +
                                " [ES][0]=" + String.Format( "{0:0.00}" ,Closes[0][0]) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Times[0][0]) +
                                " [TRIN][0]=" + String.Format( "{0:0.00}" ,Closes[TRIN][0]) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Times[TRIN][0]) );         
    
                }
            } // end onBarUpdate   
               
               
            #region Properties
            #endregion
               
        }
    }

    #2
    Sledge,

    I will investigate and get back to you as soon as possible.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      So I have a few questions here.

      1. Does the starting data matter, or does this happen no matter which starting date you use?
      2. Subsequent days after the first day start at the time you expect?
      3. Does this only occur with this particular strategy or are you able to replicate with other strategies?
      Adam P.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_AdamP View Post
        Hello,

        So I have a few questions here.

        1. Does the starting data matter, or does this happen no matter which starting date you use?
        2. Subsequent days after the first day start at the time you expect?
        3. Does this only occur with this particular strategy or are you able to replicate with other strategies?
        1) I saw it happen on 2/15/12, 2/16/12, 2/17/12, 7/11/11.
        2) The next day starts at 9:30 am. Which is correct.
        3) I reduced the strategy to print statements as you see below. It doesn't get any more simpler than that.

        I've never noticed before until I was investigating the other tread with 'market replay returns different results'. I started seeing that the first day never had a trade, but if I started a day earlier, it had a trade.

        I'm going to try to run a test right now with ES 3/12 and DX 3/12 as the added item.

        Comment


          #5
          Originally posted by NinjaTrader_AdamP View Post
          Hello,

          So I have a few questions here.

          1. Does the starting data matter, or does this happen no matter which starting date you use?
          2. Subsequent days after the first day start at the time you expect?
          3. Does this only occur with this particular strategy or are you able to replicate with other strategies?
          DX 03-12 was fine with 24x7 session. It immediately started printing 9:25 am.

          I changed the DX 03-12 session template.

          DX 03-12 with US EQUITIES RTH failed. It started at 10:30 (the 10:33 bar). It should have started 9:30 am on the 9:33bar.



          **NT** Enabling NinjaScript strategy 'FirstTradeAftet10/16870f0115fa4f2f8fee418f1e85264a' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=15 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True CalculateOnBarClose=False MaxRestarts=482 in 5 minutes
          [1]= 79.65 ,02/15 10:33:00 [ES][0]=1349.75 ,02/15 10:29:59 [TRIN][0]=79.65 ,02/15 10:33:00
          [1]= 79.65 ,02/15 10:33:00 [ES][0]=1349.75 ,02/15 10:29:59 [TRIN][0]=79.65 ,02/15 10:33:00
          [1]= 79.65 ,02/15 10:33:00 [ES][0]=1349.75 ,02/15 10:29:59 [TRIN][0]=79.65 ,02/15 10:33:00

          Code:
          #region Using declarations
          using System;
          using System.ComponentModel;
          using System.Diagnostics;
          using System.Drawing;
          using System.Drawing.Drawing2D;
          using System.Xml.Serialization;
          using NinjaTrader.Cbi;
          using NinjaTrader.Data;
          using NinjaTrader.Indicator;
          using NinjaTrader.Gui.Chart;
          using NinjaTrader.Strategy;
          #endregion
          
          // This namespace holds all strategies and is required. Do not change it.
          namespace NinjaTrader.Strategy
          {
              /// <summary>
              /// Enter the description of your strategy here
              /// </summary>
              [Description("Enter the description of your strategy here")]
              public class FirstTradeAftet10 : Strategy
              {
                  #region Variables
                  // Wizard generated variables
                  // User defined variables (add any user defined variables below)
          
                  public static int ES   = 0; // 4 range
                  public static int TRIN  = 1;
                 
          
                 
                  #endregion
          
                  /// <summary>
                  /// This method is used to configure the strategy and is called once before any strategy method is called.
                  /// </summary>
                  protected override void Initialize()
                  {
                      Print ( "Initializing Test!" );
          
                      CalculateOnBarClose = false;
             
             
          
                      Add("DX 03-12",     PeriodType.Minute, 3);  //BarsInProgress = 1 = TRIN
                     
                  }
          
          
                  /// <summary>
                  /// Called on each bar update event (incoming tick)
                  /// </summary>
                  protected override void OnBarUpdate()
                  {
          
                     
                      if (Historical) return;
                     
                      //Print ( "BarsInProgress   = " + BarsInProgress + "  " + Time[0].ToString() );           
                     
                      if ( BarsInProgress == TRIN )
                      {   
                     
                          Print ( " ["+BarsInProgress+"]=" + String.Format( "{0,7}" , String.Format( "{0:####.00}" ,Close[0])) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Time[0]) +
                                      " [ES][0]=" + String.Format( "{0:0.00}" ,Closes[0][0]) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Times[0][0]) +
                                      " [TRIN][0]=" + String.Format( "{0:0.00}" ,Closes[TRIN][0]) + " ," + String.Format( "{0:MM/dd HH:mm:ss}",Times[TRIN][0]) );         
          
                      }
                  } // end onBarUpdate   
                     
                     
                  #region Properties
                  #endregion
                     
              }
          }

          Comment


            #6
            Thanks Sledge,

            I was just verifying some things so I can begin testing on my side here.

            Would you say that valid replication steps are as follows?

            1. Download a few days of Market Replay data around the dates : 2/15/12, 2/16/12, 2/17/12, 7/11/11.
            2. Open a Range chart for the ES.
            3. Attach and run the strategy you have provided.
            4. Begin replay at each of the aforementioned dates.
            5. Watch to see the starting bar's time stamp that prints, it should start at 9:30 but you see it start at 9:33

            If you can modify these so they more accurately represent what it is your are doing it would be appreciated.
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              We are almost there.

              1) Yes. ES 03-12, DX 03-12. Set up DX 03-12 with US Equities RTH.
              2) Yes.
              3) Yes. attach strategy to the chart.
              4) Yes. 9:00 am, 9:25 am.
              5) NO

              See Attached images, day1 and day2.

              If I start on 2/16, I'm missing 9:30-10:29 am for 2/16
              If I start on 2/17, I'm missing 9:30-10:29 am for 2/17






              Originally posted by NinjaTrader_AdamP View Post
              Thanks Sledge,

              I was just verifying some things so I can begin testing on my side here.

              Would you say that valid replication steps are as follows?

              1. Download a few days of Market Replay data around the dates : 2/15/12, 2/16/12, 2/17/12, 7/11/11.
              2. Open a Range chart for the ES.
              3. Attach and run the strategy you have provided.
              4. Begin replay at each of the aforementioned dates.
              5. Watch to see the starting bar's time stamp that prints, it should start at 9:30 but you see it start at 9:33

              If you can modify these so they more accurately represent what it is your are doing it would be appreciated.
              Attached Files

              Comment


                #8
                Thanks sledge, we will set this up here and test your scenario.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  sledge, seeing this print here for ES on default ETH and DX on US Equities RTH in the Instrument Manager.

                  This is what you meant by setting up DX with RTH, correct?

                  Initializing Test!
                  **NT** Enabling NinjaScript strategy 'FirstTradeAftet10/6b40e98c80b044fd9039381a1f978a3d' : On starting a real-time strategy - StrategySync=SubmitImmediately SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=True CancelExitOrdersOnDisable=True CalculateOnBarClose=False MaxRestarts=4 in 5 minutes
                  [1]= 79.28 ,02/17 09:33:00 [ES][0]=1360.50 ,02/17 09:29:59 [TRIN][0]=79.28 ,02/17 09:33:00
                  [1]= 79.27 ,02/17 09:33:00 [ES][0]=1360.50 ,02/17 09:29:59 [TRIN][0]=79.27 ,02/17 09:33:00
                  [1]= 79.27 ,02/17 09:33:00 [ES][0]=1360.50 ,02/17 09:29:59 [TRIN][0]=79.27 ,02/17 09:33:00
                  [1]= 79.27 ,02/17 09:33:00 [ES][0]=1360.50 ,02/17 09:29:59 [TRIN][0]=79.27 ,02/17 09:33:00
                  [1]= 79.27 ,02/17 09:33:00 [ES][0]=1360.50 ,02/17 09:29:59 [TRIN][0]=79.27 ,02/17 09:33:00
                  [1]= 79.27 ,02/17 09:33:00 [ES][0]=1360.50 ,02/17 09:29:59 [TRIN][0]=79.27 ,02/17 09:33:00
                  [1]= 79.28 ,02/17 09:33:00 [ES][0]=1361.00 ,02/17 09:30:00 [TRIN][0]=79.28 ,02/17 09:33:00
                  [1]= 79.28 ,02/17 09:33:00 [ES][0]=1361.00 ,02/17 09:30:00 [TRIN][0]=79.28 ,02/17 09:33:00
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    edit: Minutes chart also affected. Adding it TO the chart doesn't work on day 1 until 10:30 am. Adding it to the Strategy tab does work, and starts at 9:30am.


                    I never got the email follow up to this. I wondered what happened to your results. I'm glad I dropped in.

                    Anyway, make ES a range bar of 4. not Minutes. (The Range specification was the title of the thread, and I didn't specifically note it in last summarized email). I did note some where that minute bars worked as expected.

                    I just did something else tonight with a secondary data series on US Equities RTH, with ES 4 Range Bars, and it didn't start until 10:30 am on market replay. UGH.

                    The date was for 9/4/2012... ES 09-12 contract, market replay recorded.



                    Originally posted by NinjaTrader_Bertrand View Post
                    sledge, seeing this print here for ES on default ETH and DX on US Equities RTH in the Instrument Manager.

                    This is what you meant by setting up DX with RTH, correct?

                    Initializing Test!
                    **NT** Enabling NinjaScript strategy 'FirstTradeAftet10/6b40e98c80b044fd9039381a1f978a3d' : On starting a real-time strategy - StrategySync=SubmitImmediately SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=True CancelExitOrdersOnDisable=True CalculateOnBarClose=False MaxRestarts=4 in 5 minutes
                    [1]= 79.28 ,02/17 09:33:00 [ES][0]=1360.50 ,02/17 09:29:59 [TRIN][0]=79.28 ,02/17 09:33:00
                    [1]= 79.27 ,02/17 09:33:00 [ES][0]=1360.50 ,02/17 09:29:59 [TRIN][0]=79.27 ,02/17 09:33:00
                    [1]= 79.27 ,02/17 09:33:00 [ES][0]=1360.50 ,02/17 09:29:59 [TRIN][0]=79.27 ,02/17 09:33:00
                    [1]= 79.27 ,02/17 09:33:00 [ES][0]=1360.50 ,02/17 09:29:59 [TRIN][0]=79.27 ,02/17 09:33:00
                    [1]= 79.27 ,02/17 09:33:00 [ES][0]=1360.50 ,02/17 09:29:59 [TRIN][0]=79.27 ,02/17 09:33:00
                    [1]= 79.27 ,02/17 09:33:00 [ES][0]=1360.50 ,02/17 09:29:59 [TRIN][0]=79.27 ,02/17 09:33:00
                    [1]= 79.28 ,02/17 09:33:00 [ES][0]=1361.00 ,02/17 09:30:00 [TRIN][0]=79.28 ,02/17 09:33:00
                    [1]= 79.28 ,02/17 09:33:00 [ES][0]=1361.00 ,02/17 09:30:00 [TRIN][0]=79.28 ,02/17 09:33:00
                    Last edited by sledge; 09-17-2012, 07:35 PM. Reason: minute affected

                    Comment


                      #11
                      Thanks sledge, we will again try to reproduce here.
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        sledge, would you mind recording a video using for example Jing with the steps you take to see this happening on Market Replay? You can direct it to me via Help >> Mail to Support - I would greatly appreciate it to further investigate, so far we unfortunately have not been able to hit it here. I was using a 4 Range bar for ES using ETH session, and the added series on RTH as you noted.
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_Bertrand View Post
                          sledge, would you mind recording a video using for example Jing with the steps you take to see this happening on Market Replay? You can direct it to me via Help >> Mail to Support - I would greatly appreciate it to further investigate, so far we unfortunately have not been able to hit it here. I was using a 4 Range bar for ES using ETH session, and the added series on RTH as you noted.
                          Learn about Articulate, maker of award-winning online training tools Articulate 360 and Rise.com, and why we're one of Inc.'s Best Workplaces.


                          I added the strategy to the ES chart.

                          Replay #1 Missing is 9/10 9:30-10:30 am., 9/11 9:30-10:30 work fine.
                          I restart Market Replay on 9/11, and 9:30-10:30am is missing.

                          The charts are fine and are also in the video for DX.

                          If I would have added the strategy to the Strategies Tab in the Control center, it would work without missing Market replay day 1 of 9:30-10:30.

                          If you need me to do a video of that I can, or of any other testing, let me know.

                          Comment


                            #14
                            Thanks much sledge, we will look into reproducing here.
                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              sledge, could you please also contact me via email at support at ninjatrader dot com with the license key you would use in testing this?

                              Thanks
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by kujista, Today, 05:44 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post kujista
                              by kujista
                               
                              Started by ZenCortexCLICK, Today, 04:58 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post ZenCortexCLICK  
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              172 responses
                              2,281 views
                              0 likes
                              Last Post sidlercom80  
                              Started by Irukandji, Yesterday, 02:53 AM
                              2 responses
                              18 views
                              0 likes
                              Last Post Irukandji  
                              Started by adeelshahzad, Today, 03:54 AM
                              0 responses
                              8 views
                              0 likes
                              Last Post adeelshahzad  
                              Working...
                              X