Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving Average off Open, High, Low

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

    Moving Average off Open, High, Low

    Still learning the coding process...

    Can anyone help me figure out why this is plotting one line? I'm trying to plot three -- one on the highs, one on the open, one on the low.

    As is, the indicator traces one line.

    Thanks.

    ----------------------------------------------------------------------
    #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>
    protectedoverridevoid Initialize()
    {
    Add(
    new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "High"));
    PriceType = PriceType.High;
    //Indicator will use high prices for calculations
    Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Open"));
    PriceType = PriceType.Open;
    //Indicator will use open prices for calculations
    Add(new Plot(Color.FromKnownColor(KnownColor.DarkViolet), PlotStyle.Line, "Low"));
    PriceType = PriceType.Low;
    //Indicator will use low prices for calculations
    CalculateOnBarClose = true;
    Overlay =
    true;
    }
    ///<summary>
    /// Called on each bar update event (incoming tick)
    ///</summary>
    protectedoverridevoid OnBarUpdate()
    {
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.

    High.Set(EMA(High,
    34)[0]);
    Open.Set(EMA(Open,
    34)[0]);
    Low.Set(EMA(Low,
    34)[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 High
    {
    get { return Values[0]; }
    }
    [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 Open
    {
    get { return Values[1]; }
    }
    [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 Low
    {
    get { return Values[2]; }
    }
    #endregion

    #2
    JWash,

    In your properties, you cannot use those names as those are reserved words. Please use names different than Open, High, Low.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks, Josh. I appreciate your help.

      Comment

      Latest Posts

      Collapse

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