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

Where to put your helper class

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

    Where to put your helper class

    Assume I have quite some just generic C# help classes shared among indicators and strategies. Where do you put them to avoid duplicate copies with maintenance nightmare?

    A related question is, how can one make use of all the nice features in C#??

    For example I have a helper class called waveState that's something like :

    PHP Code:
     public class WaveST
            
    {
                public 
    Pt P1P2P3P4P5;
                public 
    Boolean bull;
                public 
    Boolean meaty;
                public List<
    PtBumps;
                public 
    Cwave cw;
                public 
    Boolean inLTF;

                public 
    void Draw(int crBoolean eColor c) ... 
    I can't even reference DrawLine in this code without causing something like 'can't reference outer class etc etc.

    So how shall one go about solving this type of issues, and how would you implement really useful helper classes without stuffing everything into userdefinemethods?

    #2
    balancenv, unfortunately what we could support here is working with the UserDefinedMethods options available (split per strategy and indicators). I leave this open so the community could chime in with their thoughts.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by balancenv View Post
      Assume I have quite some just generic C# help classes shared among indicators and strategies. Where do you put them to avoid duplicate copies with maintenance nightmare?

      A related question is, how can one make use of all the nice features in C#??

      For example I have a helper class called waveState that's something like :

      PHP Code:
       public class WaveST
              
      {
                  public 
      Pt P1P2P3P4P5;
                  public 
      Boolean bull;
                  public 
      Boolean meaty;
                  public List<
      PtBumps;
                  public 
      Cwave cw;
                  public 
      Boolean inLTF;
       
                  public 
      void Draw(int crBoolean eColor c) ... 
      I can't even reference DrawLine in this code without causing something like 'can't reference outer class etc etc.

      So how shall one go about solving this type of issues, and how would you implement really useful helper classes without stuffing everything into userdefinemethods?
      If you want to use NT Indicator methods in your helper class, then make the class inherit from the Indicator class.

      Otherwise, make it a partial class of Indicator.

      Comment


        #4
        Thanks for the note. But I can't do that because there'll be thousands of instances of those wave state objects and indicator is just too heavy to carry...

        I figure out a solution is to include the indicator as a data member in these helper class to gain access its methods.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by fx.practic, 10-15-2013, 12:53 AM
        5 responses
        5,404 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by Shai Samuel, 07-02-2022, 02:46 PM
        4 responses
        95 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by DJ888, Yesterday, 10:57 PM
        0 responses
        7 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by MacDad, 02-25-2024, 11:48 PM
        7 responses
        159 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Yesterday, 09:29 PM
        0 responses
        8 views
        0 likes
        Last Post Belfortbucks  
        Working...
        X