Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add(SMA())

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

    Add(SMA())

    Easy one for ya, I know I've done this before, not working for me now though.

    Making a new indicator, want this new indicator to also plot a few SMA's over the price data. I'm using:

    Add(SMA(PeriodTrendFast));

    in the Initialize() area. Where PeriodTrendFast is a variable already listed in the Variables section. Keeps giving me 1729 1502 and 1503 errors for wrong overloads. Do I need something in the Properties area?

    Help?

    Thanks,

    S

    #2
    Hi Steve, yes if you refer to the public property in your code you would need to add the corresponding parts in the properties section as well, you could see an example in the SampleMaCrossOver strategy.

    Comment


      #3
      Originally posted by stevescott05 View Post
      Easy one for ya, I know I've done this before, not working for me now though.

      Making a new indicator, want this new indicator to also plot a few SMA's over the price data. I'm using:

      Add(SMA(PeriodTrendFast));

      in the Initialize() area. Where PeriodTrendFast is a variable already listed in the Variables section. Keeps giving me 1729 1502 and 1503 errors for wrong overloads. Do I need something in the Properties area?

      Help?

      Thanks,

      S
      I believe you "Add()" indicators to a Strategy, not to another indicator. If you want to call an indicator from another indicator, you just call it with the correct signature.

      It is probably more efficient to create an instance, then call that specific instance when needed. That way you bypass NinjaTrader cycling through all instances, looking for the correct one to call, on every OnBarUpdate(). (Part of the NT magic code automatically added as part of a wrapper). Just think if you had the calling indicator on more than one chart, and had CalculateOnBarClose = false. Eek, a few million calls on some /ES bars?

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      578 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X