In the strategy analyzer I can't get the time or the y values
When it runs on historical data I can't get the y values until it runs on current data
Here is my 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 MyCustomStrategy : Strategy { #region Variables // Wizard generated variables private int myInput0 = 1; // Default setting for MyInput0 // User defined variables (add any user defined variables below) #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() { CalculateOnBarClose = true; } IRegressionChannel reg; bool first = true; /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { if(first) { ClearOutputWindow(); if(CurrentBar < 1600)return; first = false; reg = DrawRegressionChannel("regg",11,1,Color.Blue); Print(String.Format("first == true Time: {0} startY: {1} endY: {2} historical: {3} toStr: {4}", Time[0],reg.StartY,reg.EndY,Historical,reg.ToString())); } else { if(reg == null)return; Print(String.Format("first == false Time: {0} startY: {1} endY: {2} historical: {3} toStr: {4}", Time[0],reg.StartY,reg.EndY,Historical,reg.ToString())); } } } }
I deleted some output but it just repeats itself. As you can see as soon as it gets to live data the info on the y values is there.
**NT** Enabling NinjaScript strategy 'MyCustomStrategy/67a15dcc3a36481b8d579656a9698772' : 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=10 CancelEntryOrdersOnDisable=False CancelExitOrdersOnDisable=True CalculateOnBarClose=True MaxRestarts=4 in 5 minutes
first == true Time: 01/08/2016 09:15:00 startY: 0 endY: 0 historical: True toStr: Name='Regression Channel' Time='01/08/2016 08:20:00' StartBar='1539' EndTime='01/08/2016 09:10:00' EndBar='1549'
first == false Time: 01/08/2016 09:20:00 startY: 0 endY: 0 historical: True toStr: Name='Regression Channel' Time='01/08/2016 08:20:00' StartBar='1539' EndTime='01/08/2016 09:10:00' EndBar='1549'
first == false Time: 01/08/2016 12:15:00 startY: 0 endY: 0 historical: True toStr: Name='Regression Channel' Time='01/08/2016 08:20:00' StartBar='1539' EndTime='01/08/2016 09:10:00' EndBar='1549'
first == false Time: 01/08/2016 12:20:00 startY: 0 endY: 0 historical: True toStr: Name='Regression Channel' Time='01/08/2016 08:20:00' StartBar='1539' EndTime='01/08/2016 09:10:00' EndBar='1549'
first == false Time: 01/08/2016 12:25:00 startY: 0 endY: 0 historical: True toStr: Name='Regression Channel' Time='01/08/2016 08:20:00' StartBar='1539' EndTime='01/08/2016 09:10:00' EndBar='1549'
first == false Time: 01/08/2016 12:30:00 startY: 0 endY: 0 historical: True toStr: Name='Regression Channel' Time='01/08/2016 08:20:00' StartBar='1539' EndTime='01/08/2016 09:10:00' EndBar='1549'
first == false Time: 01/08/2016 12:35:00 startY: 0 endY: 0 historical: True toStr: Name='Regression Channel' Time='01/08/2016 08:20:00' StartBar='1539' EndTime='01/08/2016 09:10:00' EndBar='1549'
first == false Time: 01/08/2016 12:40:00 startY: 0 endY: 0 historical: True toStr: Name='Regression Channel' Time='01/08/2016 08:20:00' StartBar='1539' EndTime='01/08/2016 09:10:00' EndBar='1549'
first == false Time: 01/08/2016 12:45:00 startY: 0 endY: 0 historical: True toStr: Name='Regression Channel' Time='01/08/2016 08:20:00' StartBar='1539' EndTime='01/08/2016 09:10:00' EndBar='1549'
first == false Time: 01/08/2016 12:50:00 startY: 0 endY: 0 historical: True toStr: Name='Regression Channel' Time='01/08/2016 08:20:00' StartBar='1539' EndTime='01/08/2016 09:10:00' EndBar='1549'
first == false Time: 01/08/2016 12:55:00 startY: 0 endY: 0 historical: True toStr: Name='Regression Channel' Time='01/08/2016 08:20:00' StartBar='1539' EndTime='01/08/2016 09:10:00' EndBar='1549'
first == false Time: 01/08/2016 13:00:00 startY: 0 endY: 0 historical: True toStr: Name='Regression Channel' Time='01/08/2016 08:20:00' StartBar='1539' EndTime='01/08/2016 09:10:00' EndBar='1549'
first == false Time: 01/08/2016 13:05:00 startY: 1.11759090909091 endY: 1.1167 historical: False toStr: Name='Regression Channel' Time='01/08/2016 08:20:00' StartBar='1539' EndTime='01/08/2016 09:10:00' EndBar='1549'
Comment