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

Include common library

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

    Include common library

    I'm trying to separate my code to clean things up from the main file to an external file. Is this possible? See example below:


    common.cs file or dll

    HTML Code:
    private double distanceFromStop(double stopPrice, double marketPrice)
    {
          double distance = 0;                 
          return distance;
     }
    main_strategy.cs

    HTML Code:
    included common.cs
    
    distanceFromStop(11,12);





    #2
    Hello bc24fl,

    Thanks for your post.

    You could create a partial class (Indicator, strategy) for your common methods.

    NinjaTrader_Chelsea demonstrates this using an Add-on and creates the same partial class in all three namespaces: Indicator, Strategy, Add-on. Please see post # 2 here: https://ninjatrader.com/support/foru...ument-backtest
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello bc24fl,

      Please also see this video demonstration of creating a separate dll file that works with multiple indicator and strategy scripts.
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by kevinenergy, 02-17-2023, 12:42 PM
      118 responses
      2,778 views
      1 like
      Last Post kevinenergy  
      Started by briansaul, Today, 05:31 AM
      0 responses
      9 views
      0 likes
      Last Post briansaul  
      Started by traderqz, Yesterday, 12:06 AM
      11 responses
      28 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by PaulMohn, Today, 03:49 AM
      0 responses
      8 views
      0 likes
      Last Post PaulMohn  
      Started by inanazsocial, Today, 01:15 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Jason  
      Working...
      X