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 judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      59 views
      0 likes
      Last Post DynamicTest  
      Started by ScottWalsh, Today, 06:52 PM
      4 responses
      36 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      7 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      21 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      10 views
      0 likes
      Last Post cre8able  
      Working...
      X