Draw.Text(this,"tagBarCount"+CurrentBar,""+Current Bar, 0, High[0]+3* TickSize, Brushes.Green);
and called the indicator BoxTest. It just draw text of bar numbers above each bar.
I created a strategy and added the indicator with
AddChartIndicator(BoxTest());
Everything compiles with no errors.
Whe I add the indicator to a chart it works as expected and draws the text. But When I add the strategy to a chart ( I connected to kinetic)
it does not draw the text on the chart.
Now if I add the statement AddPlot(Brushes.Orange, "SPlot"); along with public Series<double> SPlot ...etc in the properties
section with in the indicator, compiling again without errors, and then add the strategy, it would now show the text on the chart.
Is this a problem/bug or am I doing something wrong?
Version 8.0.0.8 (Multi-Broker) - BETA
Indicator code
// // Copyright (C) 2015, NinjaTrader LLC <www.ninjatrader.com>. // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release. // #region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; #endregion // This namespace holds indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { /// <summary> /// </summary> public class BoxTest : Indicator { protected override void OnStateChange() { if (State == State.SetDefaults) { Name = "BoxTest"; IsOverlay = true; IsSuspendedWhileInactive = true; //AddPlot(Brushes.Orange, "SPlot"); } //else if (State == State.Configure) //{ //} } protected override void OnBarUpdate() { Draw.Text(this,"tagBarCount"+CurrentBar,""+CurrentBar, 0, High[0]+3* TickSize, Brushes.Green); } #region Properties //[Browsable(false)] //[XmlIgnore()] //public Series<double> SPlot //{ // get { return Values[0]; } //} #endregion } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = NinjaTrader.Custom.Resource.NinjaScriptStrategyDescriptionSampleBoxText; Name = "SampleBoxTestStrategy"; } else if (State == State.Configure) { AddChartIndicator(BoxTest()); } } protected override void OnBarUpdate() { }
Comment