Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to create your own custom class in NT8

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

    How to create your own custom class in NT8

    Here is how to create your own class in NT8.

    1. Create your own custom class
    Code:
    namespace NinjaTrader.NinjaScript.Strategies
    {
         public class Foo
         {
              public bool bar(int num)
              {
                   return num > 0 ? true : false;	
              }
         }
    }
    2. instantiate the object in your indicator / strategy
    Code:
        
    public class TestStrat : Strategy
         {
              private Foo foo = new Foo();
    
              protected override void OnBarUpdate()
              {
                  bool isGreater = foo.bar(CurrentBar);
    	      Print("Testing foo.bar.. " + isGreater);
              }
         }
    }
    Cheers - Westsider

    #2
    Bwa ha ha ha ha ha if Foo bar == true than you are well and truly FUBARed LOL
    cool code too BTW and it came with a joke

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Futurestrader00, Yesterday, 06:14 PM
    1 response
    16 views
    0 likes
    Last Post cincai
    by cincai
     
    Started by ballston, Today, 06:32 AM
    0 responses
    2 views
    0 likes
    Last Post ballston  
    Started by Danila, Today, 04:38 AM
    2 responses
    7 views
    0 likes
    Last Post Danila
    by Danila
     
    Started by sinpeople, Today, 04:38 AM
    0 responses
    7 views
    0 likes
    Last Post sinpeople  
    Started by kiffgj, Today, 04:23 AM
    0 responses
    8 views
    0 likes
    Last Post kiffgj
    by kiffgj
     
    Working...
    X