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

How to color MACD bars if length exceeds prior bar

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

    How to color MACD bars if length exceeds prior bar

    I am trying to make the MACD a histogram (easy) but recolor each bar depending on whether it is longer than the prior bar (greater value if above zero or lesser value when MACD is below zero)

    I tried copying the Ninja MACD into a new code window then copying and pasting the original coloring where I set up the conditions, but nothing prints on the chart but it did compile.
    The colors I picked are just temporary to see it worked.

    I am attaching a screenshot at the very end of how I did it on tradestation. Its a nice visual telling at a glance all you need--the signal line is the red line.

    HTML Code:
    #region Using declarations
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.Indicator;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Strategy;
    #endregion
    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Indicator
    {
    /// <summary>
    /// MACD current bar color depends on length compared to prior histogram bar
    /// </summary>
    [Description("MACD current bar color depends on length compared to prior histogram bar")]
    public class MACDhistogramBarRecolor : Indicator
    {
    #region Variables
    private int fast = 8;
    private int slow = 18;
    private int smooth = 9;
    private DataSeries fastEma;
    private DataSeries slowEma;
    #endregion
    /// <summary>
    /// This method is used to configure the strategy and is called once before any strategy method is called.
    /// </summary>
    protected override void Initialize()
    {
    Add(new Plot(Color.Green, "Macd"));
    Add(new Plot(Color.DarkViolet, "Avg"));
    Add(new Plot(new Pen(Color.Navy, 2), PlotStyle.Bar, "Diff"));
    Add(new Line(Color.Blue, 0, "Zero line"));
     
    fastEma = new DataSeries(this);
    slowEma = new DataSeries(this);
    }
    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    if (CurrentBar == 0)
    {
    fastEma.Set(Input[0]);
    slowEma.Set(Input[0]);
    Value.Set(0);
    Avg.Set(0);
    Diff.Set(0);
    }
    else
    {
    fastEma.Set((2.0 / (1 + Fast)) * Input[0] + (1 - (2.0 / (1 + Fast))) * fastEma[1]);
    slowEma.Set((2.0 / (1 + Slow)) * Input[0] + (1 - (2.0 / (1 + Slow))) * slowEma[1]);
    double macd = fastEma[0] - slowEma[0];
    double macdAvg = (2.0 / (1 + Smooth)) * macd + (1 - (2.0 / (1 + Smooth))) * Avg[1];
     
    Value.Set(macd);
    Avg.Set(macdAvg);
    Diff.Set(macd - macdAvg);
     
    // Condition set 1
    if ( MACD(8, 18, 9)[0] > MACD(8, 18, 9)[1])
    Add(new Plot(new Pen(Color.Aqua, 2), PlotStyle.Bar, "MACD"));
    {
    }
    // Condition set 2
    if ( MACD(8, 18, 9)[0] < MACD(8, 18, 9)[1])
    Add(new Plot(new Pen(Color.Navy, 2), PlotStyle.Bar, "MACD"));
     
    //Condition set 3
    if (MACD(8, 18, 9)[0]>0) 
    Add(new Plot(new Pen(Color.DarkCyan, 2), PlotStyle.Bar, "MACD"));
     
    //Condition set4
    if (MACD(8, 18, 9)[0]<0) 
    Add(new Plot(new Pen(Color.Silver, 2), PlotStyle.Bar, "MACD"));
    } 
     
     
    {
    }
     
    }
    #region Properties
    /// <summary>
    /// </summary>
    [Browsable(false)]
    [XmlIgnore()]
    public DataSeries Avg
    {
    get { return Values[1]; }
    }
    /// <summary>
    /// </summary>
    [Browsable(false)]
    [XmlIgnore()]
    public DataSeries Default
    {
    get { return Values[0]; }
    }
     
    /// <summary>
    /// </summary>
    [Browsable(false)]
    [XmlIgnore()]
    public DataSeries Diff
    {
    get { return Values[2]; }
    }
    /// <summary>
    /// </summary>
    [Description("Number of bars for fast EMA")]
    [Category("Parameters")]
    public int Fast
    {
    get { return fast; }
    set { fast = Math.Max(1, value); }
    }
    /// <summary>
    /// </summary>
    [Description("Number of bars for slow EMA")]
    [Category("Parameters")]
    public int Slow
    {
    get { return slow; }
    set { slow = Math.Max(1, value); }
    }
    /// <summary>
    /// </summary>
    [Description("Number of bars for smoothing")]
    [Category("Parameters")]
    public int Smooth
    {
    get { return smooth; }
    set { smooth = Math.Max(1, value); }
    }
    #endregion
    }
    }
    #region NinjaScript generated code. Neither change nor remove.
    // This namespace holds all indicators and is required. Do not change it.
    namespace NinjaTrader.Indicator
    {
    public partial class Indicator : IndicatorBase
    {
    private MACDhistogramBarRecolor[] cacheMACDhistogramBarRecolor = null;
    private static MACDhistogramBarRecolor checkMACDhistogramBarRecolor = new MACDhistogramBarRecolor();
    /// <summary>
    /// MACD current bar color depends on length compared to prior histogram bar
    /// </summary>
    /// <returns></returns>
    public MACDhistogramBarRecolor MACDhistogramBarRecolor(int fast, int slow, int smooth)
    {
    return MACDhistogramBarRecolor(Input, fast, slow, smooth);
    }
    /// <summary>
    /// MACD current bar color depends on length compared to prior histogram bar
    /// </summary>
    /// <returns></returns>
    public MACDhistogramBarRecolor MACDhistogramBarRecolor(Data.IDataSeries input, int fast, int slow, int smooth)
    {
    checkMACDhistogramBarRecolor.Fast = fast;
    fast = checkMACDhistogramBarRecolor.Fast;
    checkMACDhistogramBarRecolor.Slow = slow;
    slow = checkMACDhistogramBarRecolor.Slow;
    checkMACDhistogramBarRecolor.Smooth = smooth;
    smooth = checkMACDhistogramBarRecolor.Smooth;
    if (cacheMACDhistogramBarRecolor != null)
    for (int idx = 0; idx < cacheMACDhistogramBarRecolor.Length; idx++)
    if (cacheMACDhistogramBarRecolor[idx].Fast == fast && cacheMACDhistogramBarRecolor[idx].Slow == slow && cacheMACDhistogramBarRecolor[idx].Smooth == smooth && cacheMACDhistogramBarRecolor[idx].EqualsInput(input))
    return cacheMACDhistogramBarRecolor[idx];
    MACDhistogramBarRecolor indicator = new MACDhistogramBarRecolor();
    indicator.BarsRequired = BarsRequired;
    indicator.CalculateOnBarClose = CalculateOnBarClose;
    indicator.Input = input;
    indicator.Fast = fast;
    indicator.Slow = slow;
    indicator.Smooth = smooth;
    indicator.SetUp();
    MACDhistogramBarRecolor[] tmp = new MACDhistogramBarRecolor[cacheMACDhistogramBarRecolor == null ? 1 : cacheMACDhistogramBarRecolor.Length + 1];
    if (cacheMACDhistogramBarRecolor != null)
    cacheMACDhistogramBarRecolor.CopyTo(tmp, 0);
    tmp[tmp.Length - 1] = indicator;
    cacheMACDhistogramBarRecolor = tmp;
    Indicators.Add(indicator);
    return indicator;
    }
    }
    }
    // This namespace holds all market analyzer column definitions and is required. Do not change it.
    namespace NinjaTrader.MarketAnalyzer
    {
    public partial class Column : ColumnBase
    {
    /// <summary>
    /// MACD current bar color depends on length compared to prior histogram bar
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public Indicator.MACDhistogramBarRecolor MACDhistogramBarRecolor(int fast, int slow, int smooth)
    {
    return _indicator.MACDhistogramBarRecolor(Input, fast, slow, smooth);
    }
    /// <summary>
    /// MACD current bar color depends on length compared to prior histogram bar
    /// </summary>
    /// <returns></returns>
    public Indicator.MACDhistogramBarRecolor MACDhistogramBarRecolor(Data.IDataSeries input, int fast, int slow, int smooth)
    {
    return _indicator.MACDhistogramBarRecolor(input, fast, slow, smooth);
    }
    }
    }
    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
    public partial class Strategy : StrategyBase
    {
    /// <summary>
    /// MACD current bar color depends on length compared to prior histogram bar
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public Indicator.MACDhistogramBarRecolor MACDhistogramBarRecolor(int fast, int slow, int smooth)
    {
    return _indicator.MACDhistogramBarRecolor(Input, fast, slow, smooth);
    }
    /// <summary>
    /// MACD current bar color depends on length compared to prior histogram bar
    /// </summary>
    /// <returns></returns>
    public Indicator.MACDhistogramBarRecolor MACDhistogramBarRecolor(Data.IDataSeries input, int fast, int slow, int smooth)
    {
    if (InInitialize && input == null)
    throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
    return _indicator.MACDhistogramBarRecolor(input, fast, slow, smooth);
    }
    }
    }
    #endregion
    Attached Files
    Last edited by simpletrades; 08-06-2009, 09:09 AM.

    #2
    Originally posted by simpletrades View Post
    Code:
    [COLOR=Red]// here you'll need to add a plot object for each different color bar you'd like[/COLOR]
    Add(new Plot(Color.Green, "Macd"));
    Add(new Plot(Color.DarkViolet, "Avg"));
    Add(new Plot(new Pen(Color.Navy, 2), PlotStyle.Bar, "Diff"));
    Add(new Line(Color.Blue, 0, "Zero line"));
    [COLOR=Red]// if you wanted another plot named "UpBar" you could add the following line
    Add(new Plot(new Pen(Color.RoyalBlue, 1), PlotStyle.Bar, "UpBar"));[/COLOR]
    
    [COLOR=Red]// this is where the plot values are set[/COLOR]
    Value.Set(macd);
    Avg.Set(macdAvg);
    Diff.Set(macd - macdAvg);
     
    // Condition set 1
    [COLOR=Red]// Adding plots needs to be done in Initialize(), not here in OnBarUpdate(). // This is where you set the value of the plot.
    // I'm not exactly sure what this condition means, but it looks like MACD > MACD one bar ago, thus we'll set UpBar to the current value.[/COLOR]
    if ( MACD(8, 18, 9)[0] > MACD(8, 18, 9)[1])
    {
        [COLOR=Red]UpBar.Set(MACD(8, 18, 9)[0]);[/COLOR]
    }
    
    [COLOR=Red]// for if MACD is falling
    if (MACD(8, 18, 9)[0] < MACD(8, 18, 9)[1])
    {
        // need to add an associated plot for this statement to work
        DownBar.Set(MACD(8, 18, 9)[0]);
    }[/COLOR]
    Please see the above changes/comments I've made in red. Basically, to do what you're trying to do, you'll need to create a new plot for each color bar you want to use. From what I can tell, you'll need four different bar plots, one for rising MACD above zero line, one for falling MACD above the zero line, and both for below the zero line.

    Then, you can set the values of those bars in your condition sets depending on rising/falling and above/below zero line.

    Let us know if you have any more questions.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Austin View Post
      Please see the above changes/comments I've made in red. Basically, to do what you're trying to do, you'll need to create a new plot for each color bar you want to use. From what I can tell, you'll need four different bar plots, one for rising MACD above zero line, one for falling MACD above the zero line, and both for below the zero line.

      Then, you can set the values of those bars in your condition sets depending on rising/falling and above/below zero line.

      Let us know if you have any more questions.
      Thanks. I'll play around with it.
      I know that '//' eliminates a line from being read just like on tradestation, but how do i make whole sections of several lines invisible?
      On tradestation it was '{' at the beginning and '}' at the end but here it looks like those are used already in another way.

      Comment


        #4
        I've always found the second to right-most button in the code editor window to be the easiest/most efficient way to comment many lines at once. It has five little lines on it and is titled "Comment selection". To use it, just highlight all the code you want commented out and click the button. To uncomment the code, just click the right-most button.

        I've attached a small picture of what I'm talking about. In the picture, I've highlighted some code, and then as soon as I hit the comment button, the editor will place a // in front of each line I've selected.

        Another option would be to place a /* in front of the code you want commented and a */ at the end.
        Code:
        /*
        this
        comment
        can
        span
        multiple
        lines
        */
        
        //this comment is a single line
        Attached Files
        AustinNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Austin View Post
          Please see the above changes/comments I've made in red. Basically, to do what you're trying to do, you'll need to create a new plot for each color bar you want to use. From what I can tell, you'll need four different bar plots, one for rising MACD above zero line, one for falling MACD above the zero line, and both for below the zero line.

          Then, you can set the values of those bars in your condition sets depending on rising/falling and above/below zero line.

          Let us know if you have any more questions.
          I incorporated your notes and changes in my script.
          I didnt add any for MACD below zero yet because the error message for Upbar and Downbar say 'doesnt exist in the current context' with line numbers relating to the condition 1 and 2 areas.
          I need to add them as variables, I think, but am trying to guess how.
          Dont know why my post is printing a mix of blue and black test.
          Also, I just noticed sometimes lines begin with '///' not just '//' Why?

          HTML Code:
          #region Using declarations
          using System;
          using System.ComponentModel;
          using System.Diagnostics;
          using System.Drawing;
          using System.Drawing.Drawing2D;
          using System.Xml.Serialization;
          using NinjaTrader.Cbi;
          using NinjaTrader.Data;
          using NinjaTrader.Indicator;
          using NinjaTrader.Gui.Chart;
          using NinjaTrader.Strategy;
          #endregion
          // This namespace holds all strategies and is required. Do not change it.
          namespace NinjaTrader.Indicator
          {
          /// <summary>
          /// MACD current bar color depends on length compared to prior histogram bar
          /// </summary>
          [Description("MACD current bar color depends on length compared to prior histogram bar")]
          public class MACDhistogramBarRecolor : Indicator
          {
          #region Variables
          private int fast = 8;
          private int slow = 18;
          private int smooth = 9;
          private DataSeries fastEma;
          private DataSeries slowEma;
          #endregion
          /// <summary>
          /// This method is used to configure the strategy and is called once before any strategy method is called.
          /// </summary>
          protected override void Initialize()
          {
          //****** here you'll need to add a plot object for each different color bar you'd like
          Add(new Plot(Color.Green, "Macd"));
          Add(new Plot(Color.DarkViolet, "Avg"));
          Add(new Plot(new Pen(Color.Navy, 2), PlotStyle.Bar, "Diff"));
          Add(new Line(Color.Blue, 0, "Zero line"));
          //******if you wanted another plot named "UpBar" you could add the following line:
          //*****Add(new Plot(new Pen(Color.RoyalBlue, 1), PlotStyle.Bar, "UpBar"));
          Add(new Plot(new Pen(Color.RoyalBlue, 1), PlotStyle.Bar, "UpBar"));
          Add(new Plot(new Pen(Color.Black, 1), PlotStyle.Bar, "DownBar"));
           
          fastEma = new DataSeries(this);
          slowEma = new DataSeries(this);
          }
          /// <summary>
          /// Called on each bar update event (incoming tick)
          /// </summary>
          protected override void OnBarUpdate()
          {
          if (CurrentBar == 0)
          {
          fastEma.Set(Input[0]);
          slowEma.Set(Input[0]);
          Value.Set(0);
          Avg.Set(0);
          Diff.Set(0);
          }
          else
          {
          fastEma.Set((2.0 / (1 + Fast)) * Input[0] + (1 - (2.0 / (1 + Fast))) * fastEma[1]);
          slowEma.Set((2.0 / (1 + Slow)) * Input[0] + (1 - (2.0 / (1 + Slow))) * slowEma[1]);
          double macd = fastEma[0] - slowEma[0];
          double macdAvg = (2.0 / (1 + Smooth)) * macd + (1 - (2.0 / (1 + Smooth))) * Avg[1];
           
          //***** this is where the plot values are set
          Value.Set(macd);
          Avg.Set(macdAvg);
          Diff.Set(macd - macdAvg);
           
          // Condition set 1
          //***** Adding plots needs to be done in Initialize(), not here in OnBarUpdate().
          //***** This is where you set the value of the plot.
          //***** I'm not exactly sure what this condition means, but it looks like MACD > MACD one bar ago,
          //**** thus we'll set UpBar to the current value.
           
          if ( MACD(8, 18, 9)[0] > MACD(8, 18, 9)[1])
          Add(new Plot(new Pen(Color.Aqua, 2), PlotStyle.Bar, "MACD"));
          {
          UpBar.Set(MACD(8, 18, 9)[0]); 
          }
          // Condition set 2
          //***** for if MACD is falling
          if ( MACD(8, 18, 9)[0] < MACD(8, 18, 9)[1])
          Add(new Plot(new Pen(Color.Navy, 2), PlotStyle.Bar, "MACD"));
          {
          //*** need to add an associated plot for this statement to work
          DownBar.Set(MACD(8, 18, 9)[0]);
          }
           
          //Condition set 3
          if (MACD(8, 18, 9)[0]>0) 
          Add(new Plot(new Pen(Color.DarkCyan, 2), PlotStyle.Bar, "MACD"));
           
          //Condition set4
          if (MACD(8, 18, 9)[0]<0) 
          Add(new Plot(new Pen(Color.Silver, 2), PlotStyle.Bar, "MACD"));
          } 
           
           
          {
          }
           
          }
          #region Properties
          /// <summary>
          /// </summary>
          [Browsable(false)]
          [XmlIgnore()]
          public DataSeries Avg
          {
          get { return Values[1]; }
          }
          /// <summary>
          /// </summary>
          [Browsable(false)]
          [XmlIgnore()]
          public DataSeries Default
          {
          get { return Values[0]; }
          }
           
          /// <summary>
          /// </summary>
          [Browsable(false)]
          [XmlIgnore()]
          public DataSeries Diff
          {
          get { return Values[2]; }
          }
          /// <summary>
          /// </summary>
          [Description("Number of bars for fast EMA")]
          [Category("Parameters")]
          public int Fast
          {
          get { return fast; }
          set { fast = Math.Max(1, value); }
          }
          /// <summary>
          /// </summary>
          [Description("Number of bars for slow EMA")]
          [Category("Parameters")]
          public int Slow
          {
          get { return slow; }
          set { slow = Math.Max(1, value); }
          }
          /// <summary>
          /// </summary>
          [Description("Number of bars for smoothing")]
          [Category("Parameters")]
          public int Smooth
          {
          get { return smooth; }
          set { smooth = Math.Max(1, value); }
          }
          #endregion
          }
          }
          #region NinjaScript generated code. Neither change nor remove.
          // This namespace holds all indicators and is required. Do not change it.
          namespace NinjaTrader.Indicator
          {
          public partial class Indicator : IndicatorBase
          {
          private MACDhistogramBarRecolor[] cacheMACDhistogramBarRecolor = null;
          private static MACDhistogramBarRecolor checkMACDhistogramBarRecolor = new MACDhistogramBarRecolor();
          /// <summary>
          /// MACD current bar color depends on length compared to prior histogram bar
          /// </summary>
          /// <returns></returns>
          public MACDhistogramBarRecolor MACDhistogramBarRecolor(int fast, int slow, int smooth)
          {
          return MACDhistogramBarRecolor(Input, fast, slow, smooth);
          }
          /// <summary>
          /// MACD current bar color depends on length compared to prior histogram bar
          /// </summary>
          /// <returns></returns>
          public MACDhistogramBarRecolor MACDhistogramBarRecolor(Data.IDataSeries input, int fast, int slow, int smooth)
          {
          checkMACDhistogramBarRecolor.Fast = fast;
          fast = checkMACDhistogramBarRecolor.Fast;
          checkMACDhistogramBarRecolor.Slow = slow;
          slow = checkMACDhistogramBarRecolor.Slow;
          checkMACDhistogramBarRecolor.Smooth = smooth;
          smooth = checkMACDhistogramBarRecolor.Smooth;
          if (cacheMACDhistogramBarRecolor != null)
          for (int idx = 0; idx < cacheMACDhistogramBarRecolor.Length; idx++)
          if (cacheMACDhistogramBarRecolor[idx].Fast == fast && cacheMACDhistogramBarRecolor[idx].Slow == slow && cacheMACDhistogramBarRecolor[idx].Smooth == smooth && cacheMACDhistogramBarRecolor[idx].EqualsInput(input))
          return cacheMACDhistogramBarRecolor[idx];
          MACDhistogramBarRecolor indicator = new MACDhistogramBarRecolor();
          indicator.BarsRequired = BarsRequired;
          indicator.CalculateOnBarClose = CalculateOnBarClose;
          indicator.Input = input;
          indicator.Fast = fast;
          indicator.Slow = slow;
          indicator.Smooth = smooth;
          indicator.SetUp();
          MACDhistogramBarRecolor[] tmp = new MACDhistogramBarRecolor[cacheMACDhistogramBarRecolor == null ? 1 : cacheMACDhistogramBarRecolor.Length + 1];
          if (cacheMACDhistogramBarRecolor != null)
          cacheMACDhistogramBarRecolor.CopyTo(tmp, 0);
          tmp[tmp.Length - 1] = indicator;
          cacheMACDhistogramBarRecolor = tmp;
          Indicators.Add(indicator);
          return indicator;
          }
          }
          }
          // This namespace holds all market analyzer column definitions and is required. Do not change it.
          namespace NinjaTrader.MarketAnalyzer
          {
          public partial class Column : ColumnBase
          {
          /// <summary>
          /// MACD current bar color depends on length compared to prior histogram bar
          /// </summary>
          /// <returns></returns>
          [Gui.Design.WizardCondition("Indicator")]
          public Indicator.MACDhistogramBarRecolor MACDhistogramBarRecolor(int fast, int slow, int smooth)
          {
          return _indicator.MACDhistogramBarRecolor(Input, fast, slow, smooth);
          }
          /// <summary>
          /// MACD current bar color depends on length compared to prior histogram bar
          /// </summary>
          /// <returns></returns>
          public Indicator.MACDhistogramBarRecolor MACDhistogramBarRecolor(Data.IDataSeries input, int fast, int slow, int smooth)
          {
          return _indicator.MACDhistogramBarRecolor(input, fast, slow, smooth);
          }
          }
          }
          // This namespace holds all strategies and is required. Do not change it.
          namespace NinjaTrader.Strategy
          {
          public partial class Strategy : StrategyBase
          {
          /// <summary>
          /// MACD current bar color depends on length compared to prior histogram bar
          /// </summary>
          /// <returns></returns>
          [Gui.Design.WizardCondition("Indicator")]
          public Indicator.MACDhistogramBarRecolor MACDhistogramBarRecolor(int fast, int slow, int smooth)
          {
          return _indicator.MACDhistogramBarRecolor(Input, fast, slow, smooth);
          }
          /// <summary>
          /// MACD current bar color depends on length compared to prior histogram bar
          /// </summary>
          /// <returns></returns>
          public Indicator.MACDhistogramBarRecolor MACDhistogramBarRecolor(Data.IDataSeries input, int fast, int slow, int smooth)
          {
          if (InInitialize && input == null)
          throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
          return _indicator.MACDhistogramBarRecolor(input, fast, slow, smooth);
          }
          }
          }
          #endregion
          Last edited by simpletrades; 08-06-2009, 09:47 PM.

          Comment


            #6
            When you create a Plot you need to also add the necessary lines into the Properties region of your code. Look at how your other plots are correlated to a plot in the Properties region. You need to make another for UpBar.

            // and /// are the same thing. They are just comment lines.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              When you create a Plot you need to also add the necessary lines into the Properties region of your code. Look at how your other plots are correlated to a plot in the Properties region. You need to make another for UpBar.

              // and /// are the same thing. They are just comment lines.
              I added this in variables because properties had private xx in variables too
              private Color UpBar = Color.Lime;

              I added this in properties
              [Category("Visual")]private Color UpBar
              {
              get{return UpBar;}
              set {UpBar=value;}
              }

              Now the error reads that the Indicator already contains a definition for 'UpBar'

              Comment


                #8
                simpleTrades,

                You will need to be mindful of which upBar and UpBar are capitalized and not capitalized.

                Please see this tip: http://www.ninjatrader-support2.com/...ead.php?t=4977
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by GLFX005, Today, 03:23 AM
                0 responses
                1 view
                0 likes
                Last Post GLFX005
                by GLFX005
                 
                Started by XXtrader, Yesterday, 11:30 PM
                2 responses
                11 views
                0 likes
                Last Post XXtrader  
                Started by Waxavi, Today, 02:10 AM
                0 responses
                6 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by TradeForge, Today, 02:09 AM
                0 responses
                13 views
                0 likes
                Last Post TradeForge  
                Started by Waxavi, Today, 02:00 AM
                0 responses
                3 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Working...
                X