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

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 Brevo, Today, 01:45 AM
          0 responses
          3 views
          0 likes
          Last Post Brevo
          by Brevo
           
          Started by aussugardefender, Today, 01:07 AM
          0 responses
          3 views
          0 likes
          Last Post aussugardefender  
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          239 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Started by TraderG23, 12-08-2023, 07:56 AM
          9 responses
          384 views
          1 like
          Last Post Gavini
          by Gavini
           
          Started by oviejo, Today, 12:28 AM
          0 responses
          6 views
          0 likes
          Last Post oviejo
          by oviejo
           
          Working...
          X