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 habeebft, Today, 07:27 AM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_ChristopherS  
          Started by AveryFlynn, Today, 04:57 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Max238, Today, 01:28 AM
          4 responses
          37 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by r68cervera, Today, 05:29 AM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by geddyisodin, Today, 05:20 AM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X