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

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 wzgy0920, 04-20-2024, 06:09 PM
      2 responses
      26 views
      0 likes
      Last Post wzgy0920  
      Started by wzgy0920, 02-22-2024, 01:11 AM
      5 responses
      32 views
      0 likes
      Last Post wzgy0920  
      Started by wzgy0920, Yesterday, 09:53 PM
      2 responses
      49 views
      0 likes
      Last Post wzgy0920  
      Started by Kensonprib, 04-28-2021, 10:11 AM
      5 responses
      192 views
      0 likes
      Last Post Hasadafa  
      Started by GussJ, 03-04-2020, 03:11 PM
      11 responses
      3,234 views
      0 likes
      Last Post xiinteractive  
      Working...
      X