Announcement

Collapse
No announcement yet.

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.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    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.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        52 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        130 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        70 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        43 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        47 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X