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

Exposing variables

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

    Exposing variables

    Hello- I created a custom indicator that takes in a certain instrument for calculations. It's a multi-instrument indicator (2 BIP's). I also have a milti-instrument strategy that calls this indicator. However, I would like to synch up the time frames between the strategy and indicator. In order to do this, I would need to find a way (if one exists) to make the time frame in the indicator an "exposed variable" that can be loaded by the strategy. Is there a way to do this? At the moment I'm doing this manually. Thanks.

    #2
    Hello ciro1963,
    Thanks for your post.

    You can expose values that are not plots by doing something similar to this reference sample:
    https://ninjatrader.com/support/helpGuides/nt7/?exposing_indicator_values_that.htm

    Let me know if I can clarify anything in that sample.
    Last edited by NinjaTrader_JoshG; 01-15-2019, 01:03 PM.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh -Yes I’m already doing this with a different variable. But the period type ( week, day, minute, etc ) that is part of the add statement in my indicator are reserved words I believe. I’m not sure if I can pass this variable from the strategy into the indicator without causing other issues. If there’s a way can you show me a specific example? Thank you
      Last edited by ciro1963; 01-15-2019, 03:46 PM.

      Comment


        #4
        ciro1963,

        You would probably need to store it as a string and expose the string.

        Do you just need to retrieve this information from your indicator inside your strategy? Are you trying to set your strategy to the same BarsPeriod?

        Josh G.NinjaTrader Customer Service

        Comment


          #5
          No I’m trying to set the time period of the indicator from the strategy. It appears that the time period of the indicator is already exposed because if you apply any indicator in a chart you can set the time period externally in the chart dialog box. I just want to get access to it from a strategy

          Comment


            #6
            ciro1963,

            It sounds like you are trying to dynamically add a data series, which is not going to be possible. Have you tried just calling the indicator(s) from inside your strategy using the correct BarsArray of your Add() method?



            This would not allow you to see the indicator on the chart but it would allow your strategy to use the indicator for calculations.

            If you really needed to plot those values on your chart as well you could use the concepts in this reference sample:
            Josh G.NinjaTrader Customer Service

            Comment


              #7
              I found a work around. Thanks Josh.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Haiasi, 04-25-2024, 06:53 PM
              2 responses
              17 views
              0 likes
              Last Post Massinisa  
              Started by Creamers, Today, 05:32 AM
              0 responses
              5 views
              0 likes
              Last Post Creamers  
              Started by Segwin, 05-07-2018, 02:15 PM
              12 responses
              1,786 views
              0 likes
              Last Post Leafcutter  
              Started by poplagelu, Today, 05:00 AM
              0 responses
              3 views
              0 likes
              Last Post poplagelu  
              Started by fx.practic, 10-15-2013, 12:53 AM
              5 responses
              5,408 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Working...
              X