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

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 ScottWalsh, Today, 06:52 PM
      4 responses
      32 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      4 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      19 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      6 views
      0 likes
      Last Post cre8able  
      Started by Haiasi, Today, 06:53 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Working...
      X