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 TraderBCL, Today, 04:38 AM
      3 responses
      23 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by WeyldFalcon, 08-07-2020, 06:13 AM
      11 responses
      1,423 views
      0 likes
      Last Post jculp
      by jculp
       
      Started by RubenCazorla, Today, 09:07 AM
      0 responses
      4 views
      0 likes
      Last Post RubenCazorla  
      Started by BarzTrading, Today, 07:25 AM
      2 responses
      29 views
      1 like
      Last Post BarzTrading  
      Started by devatechnologies, 04-14-2024, 02:58 PM
      3 responses
      21 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X