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

Indicator Plotting Problem

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

    Indicator Plotting Problem

    I coded an oscillator that changes colors when different values are reached. There is a "digital" option to not plot the actual value, just colored bars corresponding with the value of the oscillator. This option only works on the second one if I have two of the indicator on the same chart. If I only have one indicator on the chart it only plots the color for the highest value. Any Ideas?
    Attached Files
    Last edited by xav1029; 07-20-2009, 03:54 PM.

    #2
    xav1029,

    Unfortunately we would not know how you have coded your indicator and would not be able to advise.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      protected override void Initialize()
      {
      CalculateOnBarClose = true;
      Overlay = false;
      PriceTypeSupported = false;


      Add(new Plot(new Pen(Color.Green,1), PlotStyle.Bar, "StrongBuyP"));
      Add(new Plot(new Pen(Color.PaleGreen,1), PlotStyle.Bar, "WeakBuyP"));
      Add(new Plot(new Pen(Color.Red,1), PlotStyle.Bar, "StrongSellP"));
      Add(new Plot(new Pen(Color.LightCoral,1), PlotStyle.Bar, "WeakSellP"));
      Add(new Plot(new Pen(Color.LightGray,1), PlotStyle.Bar, "Flat"));
      }


      .....


      if(digital == true)
      {
      if (plotval > strongBuy)
      {
      StrongBuyP.Set(1);
      }

      else if(plotval > weakBuy && plotval <= strongBuy)
      {
      WeakBuyP.Set(1);
      }

      else if(plotval > weakSell && plotval <= weakBuy)
      {
      Flat.Set(1);
      }

      else if(plotval > strongSell && plotval <= weakSell)
      {
      WeakSellP.Set(1);
      }

      else
      {
      StrongSellP.Set(1);
      }
      }

      Comment


        #4
        xav1029,

        Unfortunately I am not sure what I am looking at in terms of your screenshots. What behavior are you looking for? Do you have a screenshot of it not doing what it is suppose to do?
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          In first image: Indicator with digital = false. It works perfect.

          Second Image: Indicator with digital = true. The only plot is strong buy, however everything else shows up in data panel.

          Third Image: Same indicator loaded twice on the same chart both with digital = true. The first one only plots strong buy, the second plots everything.
          Attached Files

          Comment


            #6
            second image
            Attached Files

            Comment


              #7
              third image.
              Attached Files

              Comment


                #8
                xav1029, it would be helpful to also review the 'Properties' section of your code, as I'm not sure if you've assigned the Values series correctly to your Plot structure. Also: are any errors showing up in the Log tab as you apply the indicator to the chart?
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  [Description("")]
                  [Category("Parameters")]
                  public double WeakBuy
                  {
                  get { return weakBuy; }
                  set { weakBuy = Math.Max(0, value); }
                  }

                  [Description("")]
                  [Category("Parameters")]
                  public double StrongSell
                  {
                  get { return strongSell; }
                  set { strongSell = Math.Max(-10, value); }
                  }

                  [Description("")]
                  [Category("Parameters")]
                  public double WeakSell
                  {
                  get { return weakSell; }
                  set { weakSell = Math.Max(-10, value); }
                  }

                  [Description("")]
                  [Category("Parameters")]
                  public double StrongBuy
                  {
                  get { return strongBuy; }
                  set { strongBuy = Math.Max(0, value); }
                  }


                  [Description("Fast Periods")]
                  [Category("Parameters")]
                  public int Fast
                  {
                  get { return fast; }
                  set { fast = Math.Max(0, value); }
                  }

                  [Description("Slow Periods")]
                  [Category("Parameters")]
                  public int Slow
                  {
                  get { return slow; }
                  set { slow = Math.Max(0, value); }
                  }



                  [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 StrongBuyP
                  {
                  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 WeakBuyP
                  {
                  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 StrongSellP
                  {
                  get { return Values[2]; }
                  }

                  [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 WeakSellP
                  {
                  get { return Values[3]; }
                  }

                  [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 Flat
                  {
                  get { return Values[4]; }
                  }

                  [Description("Digital if true")]
                  [Category("Parameters")]
                  public bool Digital
                  {
                  get { return digital; }
                  set { digital = value; }
                  }


                  [Description("Moving Average Type")]
                  [Category("Parameters")]
                  public NinjaTrader.Indicator.MAV.MAType SlowMAType
                  {
                  get { return mA1Type; }
                  set { mA1Type = value; }
                  }

                  [Description("Moving Average Type")]
                  [Category("Parameters")]
                  public NinjaTrader.Indicator.MAV.MAType FastMAType
                  {
                  get { return mA2Type; }
                  set { mA2Type = value; }
                  }

                  Comment


                    #10
                    Please check your Control Center logs for errors.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      There are no errors in the log. It is very annoying. The data is there, it just doesn't visually show up in the chart unless I have two loaded on the same chart. Then it only appears on the second one. It worked fine on another computer though. Maybe need to reinstall?

                      Comment


                        #12
                        Please try that.
                        Josh P.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by bortz, 11-06-2023, 08:04 AM
                        47 responses
                        1,603 views
                        0 likes
                        Last Post aligator  
                        Started by jaybedreamin, Today, 05:56 PM
                        0 responses
                        8 views
                        0 likes
                        Last Post jaybedreamin  
                        Started by DJ888, 04-16-2024, 06:09 PM
                        6 responses
                        18 views
                        0 likes
                        Last Post DJ888
                        by DJ888
                         
                        Started by Jon17, Today, 04:33 PM
                        0 responses
                        4 views
                        0 likes
                        Last Post Jon17
                        by Jon17
                         
                        Started by Javierw.ok, Today, 04:12 PM
                        0 responses
                        12 views
                        0 likes
                        Last Post Javierw.ok  
                        Working...
                        X