• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

R Statistics Program Integration / Interoperability

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

    R Statistics Program Integration / Interoperability

    Hi,

    Can NT team add a feature that integrates or interoperates with R program suite natively with NT?

    That would be an invaluable asset to NT capability.

    Can it be done on NT8 or would it have to be next major release if considered?

    #2
    Hello ericson,

    Just to make sure we are on the same page, you refer to the R Project for Statistical Computing at the link below, correct?
    https://www.r-project.org/
    JasonNinjaTrader Customer Service

    Comment


      #3
      Correct. Im using R.net to interoperate, but it can be difficult to utilize and is limited.

      Comment


        #4
        Hello ericson, and thank you for your question.

        While this is normally outside the scope of the support we provide, I am leaving this thread up so the community can weigh in. I will also try to provide some resources myself which should help you get started.

        First, the publicly available link to the third party R.Net platform I believe we are discussing is here, please review this link and let me know if this is incorrect.

        http://rdotnet.codeplex.com/

        Since it will be useful for general education and will allow us to answer other user's questions quickly, I am preparing an add-on which uses C#'s DllImport methods to lazily load symbols from a dll during runtime. While this will load from kernel32.dll , the code I provide should be adaptable to the third party R.Net product, and I will use their code as a test case for the code I provide. Direct support for their product will not be available in the add-on I provide.

        Should you desire the services of a NinjaScript consultant for a complete end to end solution, please let us know.

        I will return to this thread when I have more information.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Yes that is the correct resource. More specifically this one.

          https://github.com/jmp75/rdotnet

          I have it running in NT8. The issue is not being able to run more than one R.net engine instance, ie two or more indicators running it simultaneously. I need r.net to to able to run multiple, separate instances for each implementation in indicators.

          Here are some more resources about the issue, but it is beyond my programming skills to solve.

          http://agusrdz.blogspot.com/2015/11/...instances.html

          http://rdotnet.codeplex.com/discussions/267550

          Thats why im asking NT team to develop a better, perhaps native in application, interop system with R. R would be an extremely valuable expansion for NT.
          Last edited by ericson; 02-21-2017, 03:37 PM.

          Comment


            #6
            I am attaching a simple add-on which loads a .dll file in a lazy fashion. I have also learned from this publicly available stack overflow discussion,

            http://stackoverflow.com/questions/8...ath-at-runtime

            that C# lazily loads .dll files by default. This means that if these things happen in order

            • you start Ninja without the library you'd like to call in your (My) Documents\NinjaTrader 8\bin\Custom folder
            • you programmatically copy the library you'd like to call from into this folder
            • you use DllImport in a fashion similar to that in the attached add-on
            • the very first call to the imported method occurs

            then you will be able to sequentially load .dll files. To sequentially load the same dll twice, simply give it two different names in your filesystem.


            Generally speaking, the attached add-on is again intended only to demonstrate how to use DllImport from a NinjaScript Add-On. Its use as anything other than an educational aid is not guaranteed.



            Please let us know if there are any other ways we can help.
            Attached Files
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              I wanted to address this separately.

              The issue is not being able to run more than one R.net engine instance, ie two or more indicators running it simultaneously.
              C# already provides the ability to create critical sections in code (linked documentation publicly available) easily through use of the lock variable. This will ensure that only one instance from one thread is accessing any segment of code at one time. If you restrict all your calls to any R methods to this section, due to C#'s lazy initialization by default mentioned earlier, this will have the effect you described by itself. This help guide page demonstrates using the lock keyword in its sample code.

              http://ninjatrader.com/support/helpG...ount_class.htm
              Jessica P.NinjaTrader Customer Service

              Comment


                #8
                ok thank you!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by rickyblah12, Today, 09:57 AM
                0 responses
                4 views
                0 likes
                Last Post rickyblah12  
                Started by pecunianonolet, 11-28-2016, 03:34 AM
                4 responses
                3,135 views
                0 likes
                Last Post NinjaTrader_PaulH  
                Started by contrax, Today, 08:20 AM
                2 responses
                12 views
                0 likes
                Last Post contrax
                by contrax
                 
                Started by brownsfan019, Today, 07:54 AM
                1 response
                9 views
                0 likes
                Last Post NinjaTrader_ChristopherJ  
                Started by Amitabha, Today, 04:50 AM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_Marco  
                Working...
                X