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

Creating a custom class

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

    Creating a custom class

    This is not really something for NT8 but any advise would be apprecaited or maybe sample code exists?

    If, in namespace NinjaTrader.NinjaScript.Strategies, I create

    public class myClass
    {
    public int x;
    public iny y;
    }

    where do I put this

    myClass mc = new myClass();

    so I can use in my code?



    #2
    Hello dibDab,

    Thanks for your post.

    As NinjaScript is just C#, you can use classes and other C# types just like any other C# application. NT8 uses .net 4.8 and can compile standard .net 4.8 code in addition to supporting dll references. NinjaTrader doesn't generally document standard C# concepts as these are best documented with MSDN or other tutorial websites.

    You could do a Google search for something like 'Creating custom classes C#' to research more information and examples about this topic. When searching this, a couple results I found are linked below.

    Learn what is class in object-oriented programming. Learn how to define classes and create objects in C#.


    https://docs.microsoft.com/en-us/dot.../types/classes

    Partial classes can also be used. Below is a link to an example.
    https://ninjatrader.com/support/foru...ow#post1142340

    Please let me know if I may assist further.


    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    Last edited by NinjaTrader_BrandonH; 02-14-2023, 11:54 AM.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      ok thanks, where can I get OpenInterestDaily

      https://ninjatraderecosystem.com/use...nterest-daily/ gets page note found

      Comment


        #4
        Hello dibDab,

        Thanks for your note.

        It seems that the OpenInterestDaily script has been removed from the Ecosystem User App Share. I have removed the link from my previous post since this script no longer exists.

        You could view the sample script shared by my colleague Jim on this help guide page instead which demonstrates using a custom class: https://ninjatrader.com/support/foru...49#post1175949

        Please let me know if I may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by JoMoon2024, Today, 06:56 AM
        0 responses
        6 views
        0 likes
        Last Post JoMoon2024  
        Started by Haiasi, 04-25-2024, 06:53 PM
        2 responses
        17 views
        0 likes
        Last Post Massinisa  
        Started by Creamers, Today, 05:32 AM
        0 responses
        5 views
        0 likes
        Last Post Creamers  
        Started by Segwin, 05-07-2018, 02:15 PM
        12 responses
        1,786 views
        0 likes
        Last Post Leafcutter  
        Started by poplagelu, Today, 05:00 AM
        0 responses
        3 views
        0 likes
        Last Post poplagelu  
        Working...
        X