Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trouble with Indicator

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

    Trouble with Indicator

    Hi,
    I have been busy creating a indicator that plats two lines that run in parrell but constantly moving accroding to the set criteriea. For some reason i have missed something in the coding and would like assistance. The code is working well but only generating one line not two as it should as well as the signals appear to be getting mixed up. I am using NT7 so as you can see from the coding i have built in a BarsArray , which appears to be in the right sequence. Here is a snapshot of all the solid items in the indicator. I assume it is something small that i have missed placed, but i cannot seem to get it right. Thanks in advance.

    protectedoverridevoid Initialize()
    Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "Plot0"));
    Add(
    new Plot(Color.FromKnownColor(KnownColor.Blue), PlotStyle.Line, "Plot1"));
    protectedoverridevoid OnBarUpdate()
    { if (CurrentBar < Period) return;
    if (BarsInProgress != 0)
    return;
    double average = SMA(Close, Period)[0];
    Plot0.Set((SMA(BarsArray[
    1],timeperiod)[1] / SMA(timeperiod)[1]*1000)+28);
    Plot1.Set((SMA(BarsArray[
    1],timeperiod)[1] / SMA(timeperiod)[1]*1000)-28);
    }


    #2
    Hi,

    Did you add the second plot (Plot1) so the bottom of the file ? You should have something like this

    Code:
            [Browsable(false)]    
            [XmlIgnore()]      
            public DataSeries Plot0
            {
                get { return Values[0]; }
            }
            [Browsable(false)]   
            [XmlIgnore()]        
            public DataSeries Plot1
            {
                get { return Values[1]; }
            }
    Also, you may want to add prints and check the dialog box to ensure they're both being create properly.

    Always keep the "LOG" tab open for random, unexpected errors.

    hope this helps.
    mrlogik
    NinjaTrader Ecosystem Vendor - Purelogik Trading

    Comment


      #3
      Thanks,
      I thought it was something small. I missed changing the second Values[0] to Values[1].

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      636 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      366 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      107 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      568 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      571 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X