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

Using Local Variables for Permanent Storage of Exported DataSeries

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

    #16
    aviat72,

    C# passes class variables as copy of the variable and structures as a copy of the content. But, you could easily check that. Define a test dataseries, pass it from the hosted indicator to the hosting indicator and try a modification of the dataseries variable in the hosting indicator. Then check if the modification is visible in the hosted indicator.
    In C/C++ I would simply check the address value of the concerning variable, but I don't know how to do that in C#.

    An alternative would be to use a method with ref/out-parameters. That approach passes variable-references for sure.

    Regards
    Ralph

    Comment


      #17
      Ralph:

      Thanks for your suggestions. I will either write custom export functions or pass a ref in. The ref solution is not the safest but as long as I know what I am doing.

      Since NT only exposes your own code in to Visual Studio it is not the easiest debugging environment where to figure out which object you are viewing in the debugger. I was working with a fairly complex setup and not a simple dedicated example. I guess some print statements with a unique object identifier would have helped.

      Comment


        #18
        aviat72,

        I think, this issue is quite simple because C# specifies that every class instance is passes by reference (no matter what NT supports), and a dataseries is a class (opposed to a structure) as far as I know.

        Since I am paranoid, I tend to double-check approaches I do apply first time. That was the reason to propose the test with the modification of the passed dataseries.

        Passing variables by Property is an efficient approach.

        Regards
        Ralph

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        21 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        10 views
        0 likes
        Last Post cre8able  
        Working...
        X