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 cmoran13, 04-16-2026, 01:02 PM
      0 responses
      36 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      23 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      162 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      96 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      152 views
      2 likes
      Last Post CaptainJack  
      Working...
      X