Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw Objects from indicator not drawn when using AddChartIndicator

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

    Draw Objects from indicator not drawn when using AddChartIndicator

    I created an indicator with the line
    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
    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
    	}
    }
    Strategy Code

    Code:
    		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()
    		{
    		
    			
    		}

    #2
    Hello jabeztrading,

    Thanks for your post.

    Yes, this is a bug, it was previously reported [NT8-9328], it has been fixed (I verified with your code example) and will be included in the next release of NinjaTrader 8.

    Thank-you for your participation in the NinjaTrader 8 beta, we appreciate it.
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by helpwanted, Today, 03:06 AM
    1 response
    7 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    7 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    5 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    242 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    384 views
    1 like
    Last Post Gavini
    by Gavini
     
    Working...
    X