Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

#include/import ?

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

    #include/import ?

    Howdy,
    Starting to get more into the language (I'm from a C++/Java background). I wanted to know if there is a way I can use includes to move all of my standard utility functions into one easy to update class file rather than trying to remember to copy/paste it between each strategy whenever I find a bug or need to do an update.

    Pretty much what I want to do is:
    Code:
    //Strategy_Utils
    namespace NinjaTrader.Strategy {
      public class Strategy_Utils : Strategy {
        public double util_function() {
          <Standard calculations here>
        }
        protected override void OnBarUpdate() {
          <Do I need to call this?>
        }
      }
    }
    Code:
    //MyStrategy
    namespace NinjaTrader.Strategy {
      public class MyStrategy : Strategy {
        protected override void OnBarUpdate() {
          Strategy_Utils.onBarUpdate();
          double test=Strategy_Utils.util_function();
          EnterLongLimit(DefaultQUantity,test,"test-signal");
        }
      }
    }
    Last edited by DKATyler; 09-09-2012, 02:42 PM.

    #2
    DKA,

    You can use the UserDefinedMethods.cs file. Also note that all files compile into the same assembly so if a method is properly nested using OOP it will be accessible elsewhere.
    Adam P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rbeckmann05, Yesterday, 06:48 PM
    1 response
    12 views
    0 likes
    Last Post bltdavid  
    Started by llanqui, Today, 03:53 AM
    0 responses
    6 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    10 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    15 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Working...
    X