Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Indicator Not Plotting Values

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

    Indicator Not Plotting Values

    Hello support,

    I am having problems with a custom indicator. It does not plot anything, not even the constant lines.

    Code:
          Add(new Line(Color.FromKnownColor(KnownColor.Black), 0.0, "Zero"));
                Add(new Line(Color.FromKnownColor(KnownColor.Black), 0.5, "Half"));
                Add(new Line(Color.FromKnownColor(KnownColor.Black), 1.0, "One"));
                Add(new Line(Color.FromKnownColor(KnownColor.Black), 2.0, "Two"));
    despite the indicator range is 0.0 to 1.0 ( so there should be the Zero, Half and One lines). Also,

    Code:
         protected override void OnBarUpdate()
            {
    			double UD = UpDownTick.DeltaClose[0];
    			double UDTrades = UpDownTickTrades.DeltaClose[0];
    			
    			Print( UD + "/" + UDTrades );
    			TicksVolPerTicksTrades.Set( UD / UDTrades );
            }
    prints values to Output Window without any problems, but again, plotting does not happen. Please, what am I doing wrong?

    Regards,
    Daniel.

    #2
    Hello Eubie,

    Thank you for your post.

    I tested the Add()line methods you are using and have no issues.

    The Add lines should be added in the Initialize() method. However, Initialize() is only called when you first apply an indicator to a chart.

    If you are having issues, please try removing and re-adding this indicator to your chart. Also make sure you are adding this indicator to panel 2. You can set this in Initialize() by setting "Overlay = false".
    MatthewNinjaTrader Product Management

    Comment


      #3
      Hello Matthew,

      herein is the whole code.

      Code:
      namespace NinjaTrader.Indicator
      {
          /// <summary>
          /// V tomto indikatoru zobrazujeme hodnoty UpDownTicks/UpDownTicksTrade. Idea je takova, ze pokud jdeme na short, chceme nejen oba Ticky rude, ale navic je potreba, aby to nebylo par velkych tradu, ale naopak hodne malych, ktere otoci trh.
          /// </summary>
          [Description("V tomto indikatoru zobrazujeme hodnoty UpDownTicks/UpDownTicksTrade. Idea je takova, ze pokud jdeme na short, chceme nejen oba Ticky rude, ale navic je potreba, aby to nebylo par velkych tradu, ale naopak hodne malych, ktere otoci trh.")]
          public class gomTicksVolPerTicksTrades : Indicator
          {
              #region Variables
              // Wizard generated variables
              // User defined variables (add any user defined variables below)
      		
      		private GomCD2 UpDownTick;
      		private GomCD3 UpDownTickTrades;
      
              #endregion
      
              /// <summary>
              /// This method is used to configure the indicator and is called once before any bar data is loaded.
              /// </summary>
       		protected override void OnStartUp()
      		{
      			UpDownTick 	= GomCD2( GomCDCalculationModeType.UpDownTickWithContinuation, GomCDChartType.NonCumulativeChart, true);
      			UpDownTickTrades = GomCD3( GomCDCalculationModeType.UpDownTickWithContinuationTrades, GomCDChartType.NonCumulativeChart, true);
      		}
      
              protected override void Initialize()
              {
                  Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "TicksVolPerTicksTrades"));
                  Add(new Line(Color.FromKnownColor(KnownColor.Black), 0.0, "Zero"));
                  Add(new Line(Color.FromKnownColor(KnownColor.Black), 0.5, "Half"));
                  Add(new Line(Color.FromKnownColor(KnownColor.Black), 1.0, "One"));
                  Add(new Line(Color.FromKnownColor(KnownColor.Black), 2.0, "Two"));
                  Overlay				= false;
              }
      
              /// <summary>
              /// Called on each bar update event (incoming tick)
              /// </summary>
              protected override void OnBarUpdate()
              {
      			double UD = UpDownTick.DeltaClose[0];
      			double UDTrades = UpDownTickTrades.DeltaClose[0];
      			
      			Print( UD + "/" + UDTrades );
      			TicksVolPerTicksTrades.Set( UD / UDTrades );
              }
      So everything seems OK. A tried readding, I tried turning Ninja off and on again... Is there a limit for number of panels on a chart? This is my 9th one...

      Thank you,
      Daniel.

      Comment


        #4
        Probably got it. I reran the replay and the first values showed. Then a bar with a value of 0/0 to plot appeared and all of a sudden the whole indicator plot disappeared.

        Thanks for your kindness.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        1 view
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        18 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        1 view
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        6 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Working...
        X