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.
#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 } }
Comment