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 frankthearm, Today, 09:08 AM
      8 responses
      32 views
      0 likes
      Last Post frankthearm  
      Started by NRITV, Today, 01:15 PM
      2 responses
      9 views
      0 likes
      Last Post NRITV
      by NRITV
       
      Started by maybeimnotrader, Yesterday, 05:46 PM
      5 responses
      26 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by quantismo, Yesterday, 05:13 PM
      2 responses
      20 views
      0 likes
      Last Post quantismo  
      Started by adeelshahzad, Today, 03:54 AM
      5 responses
      33 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X