• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 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.
    Last edited by NinjaTrader_Jim; 12-22-2017, 08:03 AM.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by chnh1, Yesterday, 11:51 PM
    0 responses
    4 views
    0 likes
    Last Post chnh1
    by chnh1
     
    Started by Jasper99, Yesterday, 10:29 PM
    0 responses
    10 views
    0 likes
    Last Post Jasper99  
    Started by Jasper99, Yesterday, 09:50 PM
    0 responses
    2 views
    0 likes
    Last Post Jasper99  
    Started by StevenNelson, Yesterday, 05:57 PM
    0 responses
    5 views
    0 likes
    Last Post StevenNelson  
    Started by srbdoc, Yesterday, 03:59 PM
    1 response
    15 views
    0 likes
    Last Post NinjaTrader_EricB  
    Working...
    X