Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plotting High, Low, Open, Close. They all overlaps, Bug?

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

    Plotting High, Low, Open, Close. They all overlaps, Bug?

    I am trying to plot 4 lines that will show "High, Low, Open, Close" into a new window. But for some reason, they all overlap each other as if all those 4 values on a bar is equal.

    Is there a way to correct this? Thank You!

    Code

    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.Gui.Chart;
    #endregion
    
    // This namespace holds all indicators and is required. Do not change it.
    namespace NinjaTrader.Indicator
    {
        /// <summary>
        /// Version1
        /// </summary>
        [Description("Version1")]
        public class AAAOverview1 : Indicator
        {
            #region Variables
            // Wizard generated variables
            // User defined variables (add any user defined variables below)
            
            private DataSeries myDataSeriesHigh;
            private DataSeries myDataSeriesLow;
            private DataSeries myDataSeriesOpen;
            private DataSeries myDataSeriesClose;
            #endregion
    
            /// <summary>
            /// This method is used to configure the indicator and is called once before any bar data is loaded.
            /// </summary>
            protected override void Initialize()
            {
                Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "High"));
                Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Low"));
                Add(new Plot(Color.FromKnownColor(KnownColor.DarkViolet), PlotStyle.Line, "Open"));
                Add(new Plot(Color.FromKnownColor(KnownColor.Firebrick), PlotStyle.Line, "Close"));
                
                CalculateOnBarClose = false;
                Overlay                = false;
                
                myDataSeriesHigh = new DataSeries(this);
                myDataSeriesLow = new DataSeries(this);
                myDataSeriesOpen = new DataSeries(this);
                myDataSeriesClose = new DataSeries(this);
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
                
                myDataSeriesHigh.Set(High[0]);
                myDataSeriesLow.Set(Low[0]);
                myDataSeriesOpen.Set(Open[0]);
                myDataSeriesClose.Set(Close[0]);
                
                High.Set(myDataSeriesHigh[0]);
                Low.Set(myDataSeriesLow[0]);
                Open.Set(myDataSeriesOpen[0]);
                Close.Set(myDataSeriesClose[0]);
            }

    #2
    I found the problem.

    It's my Noob mistake. Never name your plots "High", "Low", "Open" or "Close".

    Comment


      #3
      Great, you got it working, correct those are 'reserverd' words.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      579 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X