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

SMA(int period)[int barsAgo] curious.

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

    SMA(int period)[int barsAgo] curious.

    Hi,

    I'm making an effort to learn as much syntax as possible so that using API's are a lot easier. Unfortunately, the syntax in API's are very advance and I can't find a single text out that is willing to take the challenge.

    I praise Ninjatrader for providing excellent resources and examples on how to use the API. I found it the easiest to use. I'm not sure if SMA(int period)[int barsAgo] is C# related or just part of NInjascript. I always considered Ninjascript more of an API for C#. Am I correct?

    #2
    Originally posted by BernWillChris View Post
    Hi,

    I'm making an effort to learn as much syntax as possible so that using API's are a lot easier. Unfortunately, the syntax in API's are very advance and I can't find a single text out that is willing to take the challenge.

    I praise Ninjatrader for providing excellent resources and examples on how to use the API. I found it the easiest to use. I'm not sure if SMA(int period)[int barsAgo] is C# related or just part of NInjascript. I always considered Ninjascript more of an API for C#. Am I correct?
    Not quite: NinjaScript is a framework, built on C#.

    Comment


      #3
      Okay!! Is the syntax for SMA Ninjascript specific? And I thought Frameworks and API's are the same. Yikes, it is easy to switch from programming language to another, but each language calling something different can be confusing. I'm assuming that C++ call them libraries, Java call them API's, Python call them Modules, and C# call them Frameworks,
      Last edited by BernWillChris; 08-16-2015, 09:25 AM.

      Comment


        #4
        Originally posted by BernWillChris View Post
        Okay!! Is the syntax for SMA Ninjascript specific? ...
        Yes, and no. The syntax for calling/accessing a class depends on how the constructors of the class are programmed, so ultimately, you are talking standard class semantics from C#.

        What however, the NT framework does with indicators (but not strategies), is to create methods that directly call the class constructors and return the class object, and also to create a cache to hold the objects, as soon as they are loaded. See all that stuff that NT puts in the indicator, with dire warnings to "not touch"?

        So yes, the way of creating instance indicators is NT specific, but it is still just a layer over standard C#, that leverages C#, and takes care of some things for you without you having to think about or code them.
        Last edited by koganam; 08-16-2015, 09:39 AM.

        Comment


          #5
          Thanks!

          I did looked at the SMA code, but didn't see how they were able to add the [] add the end of the function. I will look at it again later. It would be nice if I can figure that out so that I can use that tool in my arsenal to brighten up my code.

          Thanks again.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          2 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          18 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          1 view
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          6 views
          0 likes
          Last Post Javierw.ok  
          Started by timmbbo, Today, 08:59 AM
          2 responses
          10 views
          0 likes
          Last Post bltdavid  
          Working...
          X