Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ninjatrader classes

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

    ninjatrader classes

    I was wondering if within an indicator if I can import my own custom classes.
    I have been programming my indicator with different options but I have many methods with methodologies

    Volume analysis
    Trend analysis
    Time analysis
    Price analysis

    I want to compartimentalize each analysis. would I have to create independent classes and import them into ninjatrader?

    #2
    Hello,

    Thank you for the post.

    When using NinjaScript you can follow the standard C# structure in regard to how you design your item. If you would like to create additional files that hold classes you can. The files would need to be located in the Addon folder if they are just files containing misc classes so they can be compiled.

    You can see the following post for an example of a static class in an addon, this is just one example of creating an additional file as a helper: http://ninjatrader.com/support/forum...24&postcount=3

    I would suggest testing some C# structure in your NinjaScript editor to see how your ideas all translate when used in the platform.

    I look forward to being of further assistance.

    Comment


      #3
      It took a while for me to realize you had given me what I asked for a long while back.
      For me, a Machine language programmer, my thinking had been to ask for #include files
      to use with the compiler to control structure and size of files. This is much better, It just
      takes me a while because my programming mind is set in its old way of thinking.

      Comment


        #4
        I see how the addons go now before I start programming If I take out parameters in my main ninjascript and place it into the addon will it appear in my indicator if I choose to use this addon? I want to modularize my indicator so if they want an indicator that includes volume analysis I can add the addon and the parameters will appear in my indicator

        Comment


          #5
          Hello,

          Thank you for the reply.

          I am not certain what you mean, do you mean if you take out the public properties of the indicator?

          You can create various structures in .cs files that are in the Addon folder not to be confused with the Addon NinjaScript type. If you are just creating some type of structure (a class for example) this can reside in the addons folder.

          What is in that file is up to you and what your syntax needs. One item you could look into would be to create an interface if that is what you are referring to. This is something you could test to see if it works for your use case. I would also suggest reviewing some of the common C# concepts regarding inheritance on MSDN for further education on this subject. https://docs.microsoft.com/en-us/dot...ords/interface



          I look forward to being of further assistance.

          Comment


            #6
            OK I understand.

            My next question is how do I pass the session information to my add on I am missing these constraints

            Time
            Close
            Volume
            Draw
            GetCurrentBid ()
            GetCurrentAsk()

            Comment


              #7
              Hello ballboy11,

              I would suggest downloading and importing the AddOn Framework NInjaScript Basic file at the link below, for which you can use as a reference example for how to pull Time, Close, Volume, etc.


              Please let us know if you need further assistance.
              Alan P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              635 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              364 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              106 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              567 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              570 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X