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 Tim-c, Today, 03:54 AM
          0 responses
          3 views
          0 likes
          Last Post Tim-c
          by Tim-c
           
          Started by FrancisMorro, Today, 03:24 AM
          0 responses
          2 views
          0 likes
          Last Post FrancisMorro  
          Started by Segwin, 05-07-2018, 02:15 PM
          10 responses
          1,771 views
          0 likes
          Last Post Leafcutter  
          Started by Rapine Heihei, 04-23-2024, 07:51 PM
          2 responses
          31 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by Shansen, 08-30-2019, 10:18 PM
          24 responses
          945 views
          0 likes
          Last Post spwizard  
          Working...
          X