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

Retrieve indicator values via reflection (NT7 and/or NT8)?

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

    Retrieve indicator values via reflection (NT7 and/or NT8)?

    Hi,

    I have a 3rd-party indicator that paints a line, and is available for both NT7 and NT8. The value of the line for a given bar appears in the Data Box. However, the indicator is not visible to NinjaScript. The type appears not to exist. I can however loop through the indicators on the chart and find it by name. What I'm wondering is, does anyone know of an approach to reading the data series of the indicator? My first thought was that perhaps reflection would allow on to get "inside" the indicator.

    Very much a related question is, how does the data box identify the public data series and retrieve its value if the indicator otherwise can't be instantiated from within NinjaScript?

    Thanks,

    Gordon

    #2
    Hello grose,

    If you can find the indicator by using the Indicators collection in the ChartControl then you could use the GetValue on any public plots it has. https://ninjatrader.com/support/help...htsub=getvalue

    Based on the description it sounds like the developer has intentionally deleted the generated code in their indicators which would prevent it from being used by code. A possible reason for that to be done is that the indicator does not produce signals. Indicators like the Swing are a good example of indicators that don't produce signals, while it does have a plot the logic goes back in time and re writes the plot as needed therefore it cannot be used as a signal. Your custom indicator may fall into that category, if you try to retrieve values and get junk values or never see the signals being looked for its very likely doing something similar.

    I would suggest to also reach out to the vendor of that item and see if they programmed it in a way which would not be valid for signals in general. That question may save some time in case the indicator just flat out cannot be used for signals in any relevant way and is strictly visual.

    The databox uses internal code however its very likely just using the indicators Values collection and GetValueAt on those series.



    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse (and community),

      I wanted to circle back on this one. A related scenario is, when I have an indicator that plots a value and displays a value in the data box, but which does not expose the relevant data series to NinjaScript (the indicator has no public constructor), I'm able to pass the indicator to the MAX function with a period of 1 and still get the data values. In fact, I've seen MAX cleverly pick up a named data series vs. Values[0] to correctly return the value shown on the chart and data box. My question is, what is MAX looking at in order to be able to find and retrieve values from this data series when the indicator class itself can not be instantiated directly (no public constructor). Even if unsupported, how would I be able to do the same?

      Gordon

      Comment


        #4
        Hello grose,

        All indicators have an overload which can take another indicator as input. That uses the generated code at the bottom of the indicator file to take an ISeries<double> input as one of its constructors. The MAX has that code so it can take other indicators as input. When an indicator is not visible to NinjaScript that means it has no generated code at the bottom of the file which generates the constructors that are used to call the indicator in code. Developers can intentionally delete that data which would prevent you from using it in code but that will not affect the indicator being supplied to another indicator in the GUI.

        For this indicator you would need to contact the developer and ask that they check if the code has the generated code at the bottom of the file so it can be used in NinjaScript, that would be the only way to be able to use that indicator in code so you can create an instance of the indicator. If they have not intentionally removed the code and say that it can be used you should be able to use the strategy builder to select the indicator in a condition and then click View Code to get the code to use the indicator.



        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by futtrader, 04-21-2024, 01:50 AM
        6 responses
        57 views
        0 likes
        Last Post futtrader  
        Started by sgordet, Today, 11:48 AM
        0 responses
        1 view
        0 likes
        Last Post sgordet
        by sgordet
         
        Started by Trader146, Today, 11:41 AM
        0 responses
        3 views
        0 likes
        Last Post Trader146  
        Started by jpapa, 04-23-2024, 07:22 AM
        2 responses
        18 views
        0 likes
        Last Post rene69851  
        Started by funk10101, Today, 11:35 AM
        0 responses
        1 view
        0 likes
        Last Post funk10101  
        Working...
        X