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

Accessing Indicator info from a strategy

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

    Accessing Indicator info from a strategy

    Hi. I have the Bollinger Band Squeeze (BBS) Indicator that I downloaded from this forum. It has public properties that I assume can be accessed from a strategy.

    How can I access the BBS indicatator from a strategy?

    Do I have to insert the indicator on the same chart as the strategy and somehow write code in the strategy to discover the instance of the BBS indicator on the same chart? Or do I new an instance of the BBS indicator from within the strategy and somehow configure it to run on the DataSeries?

    Thank you.
    Brillo

    #2
    Brillo, there's no need to run the indicator on the chart to access and use it in your strategy, it would work like accessing regular system indicators in strategies, just call it in the strategy code.

    If you want to use dataseries that are not plots, please review this reference sample for properly exposing those -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Brillo, there's no need to run the indicator on the chart to access and use it in your strategy, it would work like accessing regular system indicators in strategies, just call it in the strategy code.

      If you want to use dataseries that are not plots, please review this reference sample for properly exposing those -

      http://www.ninjatrader-support2.com/...ead.php?t=4991
      Thank you Bert.
      Is there any example around of how to do this? I know C# very well and I'm not looking for instructions on that. I'm just not sure how to use an indicator object from within a strategy. I assume I make a reference to it as a member variable and construct the instance within the strategy's Initialize() method. But what to do next? Shouldn't it be bound to a BarsObject so it knows what DataSeries to perform it's calculations on?
      Thanks,
      Tim

      Comment


        #4
        Tim, correct you can either specifiy which BarsArray to use or call the indicator in the needed BarsInProgress context - http://www.ninjatrader-support.com/H...struments.html
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          Tim, correct you can either specifiy which BarsArray to use or call the indicator in the needed BarsInProgress context - http://www.ninjatrader-support.com/H...struments.html
          Yes I've read this section of the NinjaScript reference. I understand the examples of using the indicator methods. But I don't have an indicator method; I have an indicator object. Do I need to wrap the object in an indicator method? If so, how? The object has state but a method doesn't. How can that work? The indicator I'm trying to use the the BBS ( squeeze ) indicator. I got it from these forums. Is there some example of using that in a strategy?

          Comment


            #6
            I'm not aware of a specific example for this custom indicator - however just type in the indicator name in the editor and then Intellisense should offer you the right syntax to work with. If you create an indicator in NinjaScript, a method is automatically created as well, there's no split up function / indicator concept as in other trading software languages.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Thanks Bert. I figured out how to do it. See my post here: http://www.ninjatrader-support2.com/...692#post116692

              Comment


                #8
                Great Brillo, good job!
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Thank you. I think it would be useful for other newbies to have documentation on this architecture. I've read through the documentation and this part of the indicator is not discussed... or maybe I missed it. I only figured it out because these forums and the people on it ( including you ) are so generous and helpful. But it took more time then it would have had the documentation been better.

                  Comment


                    #10
                    Glad you got it resolved. We are always improving our educational resources. Thank you for the suggestion.
                    Josh P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by cmtjoancolmenero, Yesterday, 03:58 PM
                    3 responses
                    23 views
                    0 likes
                    Last Post cmtjoancolmenero  
                    Started by Brevo, Today, 01:45 AM
                    1 response
                    14 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by rjbtrade1, 11-30-2023, 04:38 PM
                    2 responses
                    72 views
                    0 likes
                    Last Post DavidHP
                    by DavidHP
                     
                    Started by suroot, 04-10-2017, 02:18 AM
                    5 responses
                    3,021 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by Stanfillirenfro, Today, 07:23 AM
                    1 response
                    6 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Working...
                    X