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

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 Graci117, Today, 09:02 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by ETFVoyageur, Today, 07:55 PM
      0 responses
      7 views
      0 likes
      Last Post ETFVoyageur  
      Started by janio973, Today, 07:24 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by aligator, 01-06-2022, 12:14 PM
      4 responses
      248 views
      0 likes
      Last Post john_44573  
      Started by reynoldsn, Today, 05:56 PM
      0 responses
      15 views
      0 likes
      Last Post reynoldsn  
      Working...
      X