Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.TextFixed() Issue

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

    Draw.TextFixed() Issue

    I found an issue with Draw.TextFixed(). The outlineBrush parameter does not appear to be working. See attached image.

    Here is my code:

    Code:
    		private void UpdateInfoBox()  
    		{    
    			// Update and display the Info Box
    			
    			string	sInfoBoxText	= "";		// Holds Text Data for mini data info box
    			
    			Brush brushInfoBoxTextColor 	= Brushes.Black;
    			Brush brushInfoBoxFillColor 	= Brushes.White;
    			Brush brushInfoBoxOutlineColor 	= Brushes.Black;			
    			
    			sInfoBoxText += " OB Spread: " + dKCOutterBandSpacing.ToString( "N2" );
    			sInfoBoxText += "\n Volume: " + dSessionVolume.ToString( "N0" ) + "K";
    
    			sInfoBoxText += "\n \x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e";  // sInfoBoxText += "\xA9" = Copyright Symbol
    			
    			sInfoBoxText += "\n " + sVersion;
    			
    			Draw.TextFixed( this, "tagInfoBox", sInfoBoxText, TextPosition.BottomRight, brushInfoBoxTextColor, SimpleFontDataBox, brushInfoBoxOutlineColor, brushInfoBoxFillColor, 50 );
    		}
    Attached Files

    #2
    Originally posted by Omega View Post
    I found an issue with Draw.TextFixed(). The outlineBrush parameter does not appear to be working. See attached image.

    Here is my code:

    Code:
    		private void UpdateInfoBox()  
    		{    
    			// Update and display the Info Box
    			
    			string	sInfoBoxText	= "";		// Holds Text Data for mini data info box
    			
    			Brush brushInfoBoxTextColor 	= Brushes.Black;
    			Brush brushInfoBoxFillColor 	= Brushes.White;
    			Brush brushInfoBoxOutlineColor 	= Brushes.Black;			
    			
    			sInfoBoxText += " OB Spread: " + dKCOutterBandSpacing.ToString( "N2" );
    			sInfoBoxText += "\n Volume: " + dSessionVolume.ToString( "N0" ) + "K";
    
    			sInfoBoxText += "\n \x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e";  // sInfoBoxText += "\xA9" = Copyright Symbol
    			
    			sInfoBoxText += "\n " + sVersion;
    			
    			Draw.TextFixed( this, "tagInfoBox", sInfoBoxText, TextPosition.BottomRight, brushInfoBoxTextColor, SimpleFontDataBox, brushInfoBoxOutlineColor, brushInfoBoxFillColor, 50 );
    		}
    You will need to specifically set the IsOutlineVisible property to true.

    Comment


      #3
      Thanks for the quick reply. I see that this was reported back in June. Setting IsOutlineVisible property to true allows the software to compile, but the chart locks up when I load the Ninjascript. Need to work on it some more.

      Comment


        #4
        I am still having issues with Draw.TextFixed().

        Draw.TextFixed( this, "tagInfoBox", sInfoBoxText, TextPosition.BottomLeft, brushInfoBoxTextColor, SimpleFontDataBox, brushInfoBoxOutlineColor, brushInfoBoxFillColor, 50 ).IsOutlineVisible=true;
        This line cause the chart to freeze and close the program. If I take out the .IsOutlineVisible=true property, the code works, but the outline is still missing.

        Comment


          #5
          Hello,

          I am not seeing the same behavior on my end when I plug in your code. The chart continues to update and is still responsive to input, and the outline is drawn around the text. Is it possible there is something else being done at the same time in your code that may be causing the issue?
          Dave I.NinjaTrader Product Management

          Comment


            #6
            This is a bug since the beginning and I know Brett has been alerted (by me). Draw.TextFixed has the problem and enabling the outline locks up my Beta3.
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment


              #7
              It is very possible that this issue has been resolved in the most current internal testing build. I will get more information on this in the morning and give you an update.
              Dave I.NinjaTrader Product Management

              Comment


                #8
                Thanks Dave. I am using Beta 3. I wrote a stand alone applications. It compiles but locks up the chart.

                #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.Gui.Tools;
                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
                {
                public class DTAInfoBox : Indicator
                {
                private SimpleFont SimpleFontDataBox;

                protected override void OnStateChange()
                {
                if (State == State.SetDefaults)
                {
                Description = @"Test code for the Info Box";
                Name = "DTAInfoBox";
                Calculate = Calculate.OnEachTick;
                IsOverlay = true;
                DisplayInDataBox = true;
                DrawOnPricePanel = true;
                DrawHorizontalGridLines = true;
                DrawVerticalGridLines = true;
                IsOverlay = true;
                MaximumBarsLookBack = MaximumBarsLookBack.Infinite;
                ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                IsSuspendedWhileInactive = true;
                }
                else if (State == State.Configure)
                {
                }
                }

                protected override void OnBarUpdate()
                {
                // Update and display the Info Box

                string sInfoBoxText = ""; // Holds Text Data for mini data info box

                SimpleFontDataBox = new Gui.Tools.SimpleFont( "Arial", 11 ) { Bold = true };

                Brush brushInfoBoxTextColor = Brushes.Black;
                Brush brushInfoBoxFillColor = Brushes.White;
                Brush brushInfoBoxOutlineColor = Brushes.Black;

                sInfoBoxText += " OB Spread: " ;
                sInfoBoxText += "\n Volume: " ;

                sInfoBoxText += "\n \x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x7e\x 7e\x7e\x7e\x7e";

                sInfoBoxText += "\n " + "This is a test version. "; //sVersion;

                Draw.TextFixed( this, "tagInfoBox", sInfoBoxText, TextPosition.BottomLeft, brushInfoBoxTextColor, SimpleFontDataBox, brushInfoBoxOutlineColor, brushInfoBoxFillColor, 50 ).IsOutlineVisible=true;
                }
                }
                }

                #region NinjaScript generated code. Neither change nor remove.

                namespace NinjaTrader.NinjaScript.Indicators
                {
                public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
                {
                private DTAInfoBox[] cacheDTAInfoBox;
                public DTAInfoBox DTAInfoBox()
                {
                return DTAInfoBox(Input);
                }

                public DTAInfoBox DTAInfoBox(ISeries<double> input)
                {
                if (cacheDTAInfoBox != null)
                for (int idx = 0; idx < cacheDTAInfoBox.Length; idx++)
                if (cacheDTAInfoBox[idx] != null && cacheDTAInfoBox[idx].EqualsInput(input))
                return cacheDTAInfoBox[idx];
                return CacheIndicator<DTAInfoBox>(new DTAInfoBox(), input, ref cacheDTAInfoBox);
                }
                }
                }

                namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
                {
                public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
                {
                public Indicators.DTAInfoBox DTAInfoBox()
                {
                return indicator.DTAInfoBox(Input);
                }

                public Indicators.DTAInfoBox DTAInfoBox(ISeries<double> input )
                {
                return indicator.DTAInfoBox(input);
                }
                }
                }

                namespace NinjaTrader.NinjaScript.Strategies
                {
                public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
                {
                public Indicators.DTAInfoBox DTAInfoBox()
                {
                return indicator.DTAInfoBox(Input);
                }

                public Indicators.DTAInfoBox DTAInfoBox(ISeries<double> input )
                {
                return indicator.DTAInfoBox(input);
                }
                }
                }

                #endregion

                Comment


                  #9
                  Just to be certain, I've installed the Beta 3 build and tried once more. I've used the same method overload as Omega, and passed in the same arguments. I also copied Omega's entire code into a new indicator, and I'm still seeing the text draw as expected, with the outline, with no performance impact.

                  Have you run into this issue with other drawing object properties, by chance?
                  Dave I.NinjaTrader Product Management

                  Comment


                    #10
                    Dave,

                    No I haven't. I am using tick charts for the ES. It doesn't matter if is historical or real time.

                    Comment


                      #11
                      Thank you -- after playing around with this quite a bit, I was finally able to find one reproducible scenario in Beta 3. The only way I could get your code to freeze up a chart was to first apply the indicator to a new panel, then move it to Panel 1. As it attempts to move to Panel 1 (in Beta 3), the chart freezes and the platform must be forced closed. However, this does not occur in any other scenario that I could find (including applying the indicator to Panel 1 initially).

                      The good news is that even this scenario is not reproducible in out current internal build. It does seem that this issue has been resolved in our current build. Please note this issue and give it another try in the next Beta release to see if the issue persists for you, but it should not.
                      Dave I.NinjaTrader Product Management

                      Comment


                        #12
                        That is good news. Mine is in an indicator panel and I cannot activate the outline. Maybe you can answer this question. Why do we now have to set .IsOutlineVisible when the overload for outline color always worked fine when setting to Transparent or Empty?
                        eDanny
                        NinjaTrader Ecosystem Vendor - Integrity Traders

                        Comment


                          #13
                          Thanks!

                          I am using Panel 1 and Panel 2 for testing. Glad to hear issue was resolved in B4.

                          Comment


                            #14
                            Originally posted by eDanny View Post
                            Why do we now have to set .IsOutlineVisible when the overload for outline color always worked fine when setting to Transparent or Empty?
                            IsOutlineVisible is being set to False within State.Configure on these classes, and there is currently no logic in place to automatically set it to True when the constructors which take Outline Brush arguments are used. If you'd like, I can log this as a suggested enhancement of Draw.Text and Draw.TextFixed, to see if we can automatically switch the value of IsOutlineVisible when those overloads are used.
                            Dave I.NinjaTrader Product Management

                            Comment


                              #15
                              Originally posted by NinjaTrader_Dave View Post
                              IsOutlineVisible is being set to False within State.Configure on these classes, and there is currently no logic in place to automatically set it to True when the constructors which take Outline Brush arguments are used. If you'd like, I can log this as a suggested enhancement of Draw.Text and Draw.TextFixed, to see if we can automatically switch the value of IsOutlineVisible when those overloads are used.
                              Sounds like we can just write an overload to the base method, no?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by arvidvanstaey, Today, 02:19 PM
                              4 responses
                              11 views
                              0 likes
                              Last Post arvidvanstaey  
                              Started by samish18, 04-17-2024, 08:57 AM
                              16 responses
                              60 views
                              0 likes
                              Last Post samish18  
                              Started by jordanq2, Today, 03:10 PM
                              2 responses
                              9 views
                              0 likes
                              Last Post jordanq2  
                              Started by traderqz, Today, 12:06 AM
                              10 responses
                              18 views
                              0 likes
                              Last Post traderqz  
                              Started by algospoke, 04-17-2024, 06:40 PM
                              5 responses
                              47 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X