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

Attach order placed by Add-On to any indicator on chart programmatically

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

    Attach order placed by Add-On to any indicator on chart programmatically

    Hello,

    I have following steps:
    1 - placing order from add-on - works.
    2 - can find and get properties of any indicator on any chart from add-on - works.
    3 - I would like to attach target limit order to specific 3rd party indicator that is on the chart, while that order was placed from custom add-on. I am able to attach that order to this custom indicator manually, however, would like to do if programmatically (after certain delay once this order is placed - change it to attach to indicator).

    Is it possible even if unsupported?

    Thanks

    #2
    Hello music_p13,

    Thanks for your post.

    You would need to be able to actively read the indicator's plot value after you found the chart and indicator plot that you want to follow.

    You could try accessing the Values collection of found indicators.

    See the help guide documentation for more information:
    Indicators Collection: https://ninjatrader.com/support/help...indicators.htm
    Values: https://ninjatrader.com/support/help...nt8/values.htm

    Also, see the code sample below which may help get you started. The code below demonstrates looping through the indicator collection.

    Code:
    else if (State == State.DataLoaded)
    {
        foreach (var window in NinjaTrader.Core.Globals.AllWindows)
        {
            // check if the found window is a Chart window, if not continue looking
            if (!(window is NinjaTrader.Gui.Chart.Chart)) continue;
    
            window.Dispatcher.InvokeAsync(new Action(() =>
            {
                // try to cast as a Chart, if it fails it will be null
                var foundChart = window as NinjaTrader.Gui.Chart.Chart;
    
                // make sure we found a chart
                if (foundChart == null) return;
    
                // make sure the found chart is the owner window
                if (foundChart != this.Owner as NinjaTrader.Gui.Chart.Chart) return;
    
                // Instantiate indicator collection
                ChartObjectCollection<NinjaTrader.Gui.NinjaScript. IndicatorRenderBase>  indicatorCollection = foundChart.ActiveChartControl.Indicators;
    
                 // Loop through indicators in collection
                 foreach (Indicator indi in indicatorCollection)
                      Print(indi.Name);
    
             }));
    
         }
    }
    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by andrewtrades, Today, 04:57 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by chbruno, Today, 04:10 PM
    0 responses
    3 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    436 views
    0 likes
    Last Post Delerium  
    Started by FAQtrader, Today, 03:35 PM
    0 responses
    7 views
    0 likes
    Last Post FAQtrader  
    Started by rocketman7, Today, 09:41 AM
    5 responses
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X