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 techgetgame, Yesterday, 11:42 PM
    0 responses
    8 views
    0 likes
    Last Post techgetgame  
    Started by sephichapdson, Yesterday, 11:36 PM
    0 responses
    2 views
    0 likes
    Last Post sephichapdson  
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,613 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Yesterday, 05:56 PM
    0 responses
    10 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    20 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Working...
    X