Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custome Indicator Issue: Simple assignment issue

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

    Custome Indicator Issue: Simple assignment issue

    I am puzzled why the code below in the indicator won't show on the chart when I use a DataSeries variable called AD to set a value, but if I set my new indicator (AdMA) to a hard coded value, it shows on the chart. I also know that AD has values, because it shows on the chart (Values[0]). My new one is Values[1]).

    protected override void Initialize()
    {
    Add(new Plot(Color.Green, PlotStyle.Line, "AD"));
    Add(new Plot(Color.YellowGreen, PlotStyle.Line, "AdMa"));
    //dsAD = new DataSeries(this);
    }
    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    double dBuff = 0;
    int i=0;

    AD.Set((CurrentBar == 0 ? 0 : AD[1]) + (High[0] != Low[0] ? (((Close[0] - Low[0]) - (High[0] - Close[0])) / (High[0] - Low[0])) * Volume[0] : 0));


    for (i = 0; i < period; i++)
    {
    dBuff = dBuff + AD[i]; // ISSUE!!!!
    }

    AdMa.Set(0, dBuff);
    }

    public DataSeries AD
    {
    get { return Values[0]; }
    }

    public DataSeries AdMa
    {
    get { return Values[1]; }
    }

    #2
    Do you see any errors in the log? Most likely run into this issue here -

    Comment


      #3
      Thank you. That was the issue!

      Originally posted by NinjaTrader_Bertrand View Post
      Do you see any errors in the log? Most likely run into this issue here -

      http://www.ninjatrader-support2.com/...ead.php?t=3170

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      161 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      310 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      245 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      350 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X