Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Splitting up parts of code.

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

    Splitting up parts of code.

    Goodmorning NT.

    I am seeking some advice or a point in a direction.

    I have been coding for quite some time on some differant strategies, chart traders, indicators etc..
    some of it i have built with abstract classes even though it is not recomanded, i took inspiration in this excample.
    Contribute to archReactor04/NT8Scripts development by creating an account on GitHub.



    however i now feel that i am very dependant on the main part as 100% everything points to this.

    so i was thinking, is there a recomanded way to split large and complex scripts up ?

    i like that with the abnstract class i have my strategies small and very simple with only the actual strategy logic, added indicators etc.
    and everything else is in the abstract class and can be re-used in all strategies.

    but i would like the posiblity to split some parts of the abstract class out so that it can be used from differant abstract classes.


    example.
    I have a Filters function,
    this filters function have many inputs to select from and indicators to add as needed.
    would it be posible to split this out in a seperate file So this can be used from differant projects or differant abstract classes ?

    I could easily just split it out in a indicator but the problem with this is then i would loose the input selections when adding the strategy and lose the optimize the the inputs together with the strategy inputs.
    Last edited by donto; 11-23-2024, 02:20 AM.
    Donto
    NinjaTrader Ecosystem Vendor - otrading.dk

    #2
    Hello donto,

    You can try using standard C# classes or indicators depending on what you need to do however that will depend on how you made your abstract class. We generally can't provide any suggestions relating to using abstract classes so now that you have that whatever you develop will require testing to make sure it works correctly.

    Comment


      #3
      Hello Jesse

      It is not a requirement to run the abstract classes, so if there is another smart way of splitting them up i will try that instead.
      do you by chance have an example of splitting it up as standard classes ?

      My issue with creating it as indicators is that it would require me to anyway create all the inputs in my strategies to the parse to the indicators, i would need to add the same code to all strategies to be able to optimize on all the inputs to the differant indicators and strategies.



      Donto
      NinjaTrader Ecosystem Vendor - otrading.dk

      Comment


        #4
        Hello donto,

        I don't have any specific examples of that, you would mainly learn that type of coding style by learning in external C# tutorials. You can use standard C# coding features in NinjaScript.

        In general it would be expected for you to have to recreate user inputs in each new script you make as that is a class level portion of the script, that is not something which can be offloaded into other classes and still have the property grid work normally.

        Comment


          #5
          Hello Jesse
          I found these examples from NT,


          one thing is seeing a whole lot of examples that dont really relate to the usecases i would see or use.
          Another is seeing it actual being used in the same content as i would use it.

          after going through this example i see now how i could implement this and make my functions avalible for all my strategies.

          thank you vey much for the input.


          Donto
          NinjaTrader Ecosystem Vendor - otrading.dk

          Comment

          Latest Posts

          Collapse

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