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

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 Pattontje, Yesterday, 02:10 PM
                  2 responses
                  15 views
                  0 likes
                  Last Post Pattontje  
                  Started by flybuzz, 04-21-2024, 04:07 PM
                  17 responses
                  229 views
                  0 likes
                  Last Post TradingLoss  
                  Started by agclub, 04-21-2024, 08:57 PM
                  3 responses
                  17 views
                  0 likes
                  Last Post TradingLoss  
                  Started by TradingLoss, 04-21-2024, 04:32 PM
                  4 responses
                  44 views
                  2 likes
                  Last Post TradingLoss  
                  Started by cre8able, 04-17-2024, 04:16 PM
                  6 responses
                  57 views
                  0 likes
                  Last Post cre8able  
                  Working...
                  X