Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Compiled Class

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

    Compiled Class

    Hello

    I have made a collection class for my use, which is pretty similar to the way DataSeries work.

    so to initialize the collection, just like a dataseries i run :

    MyDS ds = new MyDS(this);

    This works great as long as my class is in .cs form.

    Unfortunately, once i export into a compiled class, this does not work anymore.

    Code:
      Argument   '1': cannot convert from 'NinjaTrader.Strategy.StratTest' to   'NinjaTrader.Strategy.Strategy' 
      The best   overloaded method match for   'ZUtils.MyDS.MyDS(NinjaTrader.Strategy.Strategy)'   has some invalid arguments
    I'm guessing this is considered Advanced Programming and is probably not supported. I'm hoping someone around here would know what changes once the code is in a compiled assembly.


    edit: off course i've added the using directive, and referenced the dll file, and restarted NT7

    #2
    Hi zark.be,

    You've checked most things here. You should also make sure you have placed the dll in documents\bin\custom and that you do not have the source file in the NinjaTrader directories at the same time as the dll.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      All that is okay,and the class works fine UNLESS i try to pass the strategy as a parameter.
      If i modify the class to not use the strategy, then it's working fine. (But i need it to sync, just like your DataSeries class)

      Comment


        #4
        This deals more with C# so will fall outside our scope of support. Hopefully some community members can assist here.

        I'm not sure why it would work differently in an assembly compared to source. One thing you may consider is saving a copy of the source code to generate new wrappers.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Hi zark.be,

          In principle what you are doing should work. There is no problem in using custom compiled assembiles with your other NT code. I would need to know a bit more before I could say what is going on but a quick thing to try is to include your parametes for the strategy when accessing it and to check the names and how the startegy is being instantiated. I know this is a bit vague but I hope this helps.

          Comment


            #6
            I think it's due to the fact that the compiled version of "Strategy" changes after every recompile (because NT merges all of the .cs files to create the Strategy class to compile).

            And my compiled MyDS references a "previous" version of the Strategy class.

            Since c# uses strong versioning, it rejects the class.

            I looked around but didn't find an Interface object for Strategy. So I guess I'm screwed.

            I tryed changing my constructor to use Object instead of Strategy, and then later casting it, but again it rejects it.
            I think i'm on the right path, i'll probably have to use some sort of runtime linking or something that would allow a "soft versioning" (based only on the name and not on the version)

            Comment


              #7
              Okay i was right.

              What i found out though is that the Strategy class extends another class called StrategyBase.

              So i rechanged my constructor to MyDS(StrategyBase s) and use StrategyBase instead of Strategy, and that now works properly ...
              Now i'll have to check if the same dll works on another NT ...

              edit: compiled dll on 1000.6 , sent it to another machine running 1000.2 and running fine.

              Guess this is solved.

              You guys should really extract an interface though.
              Last edited by zark.be; 06-21-2011, 09:37 AM.

              Comment


                #8
                Glad you are making progress, Zark. Thank you for sharing your solutions on this here.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  Interesting. Thanks for sharing.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by sjsj2732, Yesterday, 04:31 AM
                  0 responses
                  31 views
                  0 likes
                  Last Post sjsj2732  
                  Started by NullPointStrategies, 03-13-2026, 05:17 AM
                  0 responses
                  286 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  283 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  133 views
                  1 like
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  91 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Working...
                  X