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

Indicator in an Indicator

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

    Indicator in an Indicator

    If I have an indicator that I have created for visual purposes say not a price overlay, but I need the data I am recording in the plot, is there any special way to pull that indicator into a different indicator that I want to be a price overlay for calculation purposes? I know we are just dealing with classes here, but its not clear to me how to instantiate it and how to make sure it gets the same onBarUpdate calls as the indicator its going into. If there is a reference on this I am happy to read it, I searched and could not find anything. Thanks

    #2
    Hello ErikY,

    There would not be anything special needed here, when calling an indicator from another indicator it would not be visual and would just be to retrieve the value. You would call your indicator in the same way that you would a system indicator. For example the bollinger has a Plot and it is called like this:
    Code:
    double upperValue = Bollinger(2, 20).Upper[0];
    That would be done from OnBarUpdate where you wanted to use the indicator.

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

    Comment


      #3
      I see, so no need to initialize it or anything, just call the indicator. I will play around with it, thanks.

      Comment


        #4
        Hello ErikY,

        Right, Indicators specifically have an internal cache system so you never actually need to use the "new" keyword to create them. That's the code that gets added at the bottom of the indicator file for reference here. This is different from normal C# programming where you would have to use the new keyword to create an object.


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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ETFVoyageur, 05-07-2024, 07:05 PM
        17 responses
        133 views
        0 likes
        Last Post ETFVoyageur  
        Started by ETFVoyageur, Yesterday, 10:13 PM
        1 response
        7 views
        0 likes
        Last Post ETFVoyageur  
        Started by somethingcomplex, Yesterday, 10:36 PM
        0 responses
        7 views
        0 likes
        Last Post somethingcomplex  
        Started by sofortune, 05-10-2024, 10:28 AM
        5 responses
        22 views
        0 likes
        Last Post sofortune  
        Started by guyonabuffalo, Yesterday, 10:01 PM
        0 responses
        4 views
        0 likes
        Last Post guyonabuffalo  
        Working...
        X