Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

It's all about the Plot

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

    It's all about the Plot

    I'm trying to get a plot to appear on the 2nd panel. This is the simplest indicator. It simply plots a horizontal with a value of zero on each OnBarUpdate(). After several minutes, the plot does not appear.

    (Eventually, this plot will have a math formula so it's not an oscillator line per se).

    namespace NinjaTrader.Indicator
    {
    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    [Description("Enter the description of your new custom indicator here")]
    public class MyCustomIndicator : Indicator
    {
    #region Variables
    // Wizard generated variables
    // User defined variables (add any user defined variables below)
    #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, "PlotFoobar"));
    CalculateOnBarClose = true;
    Overlay = false;
    PriceTypeSupported = false;
    }

    /// <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.
    PlotFoobar.Set(0);
    }

    #region Properties
    [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
    [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
    public DataSeries PlotFoobar
    {
    get { return Values[0]; }
    }

    #endregion
    }
    }

    #2
    Can you clarify-

    - A value of zero is plotted for a few minutes and the the indicator plot vanishes?

    Any error messages in the Log tab?
    RayNinjaTrader Customer Service

    Comment


      #3
      A value of zero is NEVER plotted. It never appears.

      I've tried different values: 10, 20, 30, etc.

      It just never appears in the first place.

      Here's some background: Earlier today, I was using OpenTick data feed and the plot lines were working. Then when the market closed, I started using the simulated data feed and the plot lines stopped appearing.

      I was using the simulated data feed to fire the OnBarUpdate() event. I've verified that OnBarUpdate() is firing via custom log messages.

      Comment


        #4
        Interesting...

        I can confirm that my indicators visibly plots a line when using OpenTick. It does NOT plot a line when using the simulated data feed.

        But why? It shouldn't make a difference?

        Comment


          #5
          When you run in the sim feed are there any historical bars? If not, you might have to wait 20 bars before you start to see a line.
          RayNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

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