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

Calculate Indicator values from Addon tab

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

    Calculate Indicator values from Addon tab

    Hi,
    I need to get RegressionChannel last values for Bars object.
    This method is inside Tab class (label is used to output data):


    Code:
    void ProcessBars(Bars bars){
    			try{
    				var series = new Series<double>(bars); 
    				lbl.Content += string.Format("\n bars.Count: {0}", bars.Count);
    				var ch = new NinjaTrader.NinjaScript.Indicators.Indicator().RegressionChannel(series, 150, 3);
    				lbl.Content += string.Format("\n ch.Low: {0}", ch.Lower.GetValueAt(0));
    			}catch(Exception ex){
    				lbl.Content += "\n ProcessBars ERROR: \n" + ex.Message + "\n" + ex.StackTrace;	
    			}
    		}
    That's what I get:
    Click image for larger version

Name:	Capture2.PNG
Views:	1
Size:	10.0 KB
ID:	908897

    #2
    Hello Vitaliy141,

    Welcome to the forums!

    A BarsRequest is what would be used to get data within your AddOn, but it currently is not possible to call indicators from within a BarsRequest. This is ultimately a limitation of how a Bars object iterates in an AddOn. We have a feature request tracking interest in using indicators directly in an AddOn and I will submit a vote on your behalf.

    The ticket ID is SFT-1065.

    As with other feature requests, we cannot present an ETA as they are fulfilled based on the development team's schedule and priorities. Upon implementation a description of the feature can be found publicly on the Release Notes page of the help guide. I'll provide a link below.

    Release Notes: https://ninjatrader.com/support/help...ease_notes.htm

    In the meantime, it will be possible to re-implement the indicator within the AddOn so it can be calculated with each iteration from the BarsRequest.

    For the forum's reference, I'll include documentation links for BarsRequest that explains some of the caveats involved. Although somewhat related, my colleague Alan has shared an approach for another client where he has recreated an SMA in an AddOn. Some of his ideas might be useful for creating a solution on your end.

    BarsRequest - https://ninjatrader.com/support/help...arsrequest.htm

    SMA in an AddOn (uses array of doubles) - https://ninjatrader.com/support/foru...7&postcount=12

    Please let me know if you have any additional questions.
    Last edited by NinjaTrader_Jim; 08-25-2021, 07:04 AM.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi Jim,

      any news on that feature?

      BR
      Jan

      Comment


        #4
        Welcome to the forums Jan!

        The feature has not been implemented as of yet.

        You may check the Release Notes page of the Help Guide with each new release to see descriptions of new features implemented.
        JimNinjaTrader Customer Service

        Comment


          #5
          OK, thanks for the fast update.
          So is it possible to develop an indicator then, which accesses the plot data of the other indicators defined in a chart object, or is the access restricted? I'm thinking of getting the references of the indicators through the parent object (the chart window).

          BR
          Jan

          Comment


            #6
            Hello Jan,

            Standard supported procedure would be to instantiate the indicators within the host script and have the host script add everything that is needed. If you an add indicator in the Strategy Builder, you will be able to see how a strategy can add an access an indicator.

            If you want to venture outside of the supported realm, you could loop through indicators in the chart from the ChartControl.Indicators collection, and access the Values array from each indicator to read their plots. However, this would not have the synchronicity that would get from adding indicators within a host script that offers OnBarUpdate (not a BarsRequest.) You would also have to know which plots of an indicator represent each Value in Values.
            Last edited by NinjaTrader_Jim; 08-12-2021, 03:23 PM.
            JimNinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Jim View Post
              Hello Vitaliy141,

              Welcome to the forums!

              A BarsRequest is what would be used to get data within your AddOn, but it currently is not possible to call indicators from within a BarsRequest. This is ultimately a limitation of how a Bars object iterates in an AddOn. We have a feature request tracking interest in using indicators directly in an AddOn and I will submit a vote on your behalf.

              The ticket ID is SFT-1065.

              As with other feature requests, we cannot present an ETA as they are fulfilled based on the development team's schedule and priorities. Upon implementation the ticket ID can be found publicly on the Release Notes page of the help guide. I'll provide a link below.

              Release Notes: https://ninjatrader.com/support/help...ease_notes.htm

              In the meantime, it will be possible to re-implement the indicator within the AddOn so it can be calculated with each iteration from the BarsRequest.

              For the forum's reference, I'll include documentation links for BarsRequest that explains some of the caveats involved. Although somewhat related, my colleague Alan has shared an approach for another client where he has recreated an SMA in an AddOn. Some of his ideas might be useful for creating a solution on your end.

              BarsRequest - https://ninjatrader.com/support/help...arsrequest.htm

              SMA in an AddOn (uses array of doubles) - https://ninjatrader.com/support/foru...7&postcount=12

              Please let me know if you have any additional questions.
              Thank You


              Any update on it sir?

              Comment


                #8
                Welcome to the forums willjohnson123!

                This functionality has not yet been implemented. You may reference the Release Notes page of the Help Guide to check for descriptions of new features that have been implemented with each new release.

                JimNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by jaybedreamin, Today, 05:56 PM
                0 responses
                3 views
                0 likes
                Last Post jaybedreamin  
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                18 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Jon17, Today, 04:33 PM
                0 responses
                1 view
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                6 views
                0 likes
                Last Post Javierw.ok  
                Started by timmbbo, Today, 08:59 AM
                2 responses
                10 views
                0 likes
                Last Post bltdavid  
                Working...
                X