Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

My trivial indicator

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

    My trivial indicator

    I don't know C#, so, I'm sure I am going to ask a stupid question. But, I basically wanted to create my first trivial indicator, to just draw a solid line at price of 1.0. I used the wizard, which created a shell of an indicator. For the Plot, it defaulted to Close[0] which I just put 1.0. Not seeing any line at price = 1.0. Any ideas what stupid thing I'm missing? Here is the script:

    namespace NinjaTrader.Indicator
    {
    /// <summary>
    /// Custom Lines Indicator
    /// </summary>
    [Description("Custom Lines Indicator")]
    public class CustomLinesIndicator : Indicator
    {
    #region Variables
    // Wizard generated variables
    private int period = 20; // Default setting for Period
    // 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, "Plot0"));
    CalculateOnBarClose = true;
    Overlay = false;
    PriceTypeSupported = true;
    }

    /// <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.
    Plot0.Set(1.0);
    }

    }
    }

    #2
    Speedie6,

    Instead of this -> Plot0.Set(1.0);

    Try - > Value.Set(1.0); or Values[0].Set(1.0);

    RJay
    RJay
    NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

    Comment


      #3
      Originally posted by rt6176 View Post
      Instead of this -> Plot0.Set(1.0);

      Try - > Value.Set(1.0); or Values[0].Set(1.0);
      I will. I guess I need to read in more detail on the classes, because I don't really know what values I'm plugging where.

      Comment

      Latest Posts

      Collapse

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