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 sjsj2732, 03-23-2026, 04:31 AM
      0 responses
      42 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      295 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      290 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      135 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      98 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X