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

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.
    BertrandNinjaTrader Customer Service

    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 rhyminkevin, Today, 04:58 PM
      3 responses
      48 views
      0 likes
      Last Post Anfedport  
      Started by iceman2018, Today, 05:07 PM
      0 responses
      5 views
      0 likes
      Last Post iceman2018  
      Started by lightsun47, Today, 03:51 PM
      0 responses
      7 views
      0 likes
      Last Post lightsun47  
      Started by 00nevest, Today, 02:27 PM
      1 response
      14 views
      0 likes
      Last Post 00nevest  
      Started by futtrader, 04-21-2024, 01:50 AM
      4 responses
      50 views
      0 likes
      Last Post futtrader  
      Working...
      X