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 zstheorist, Today, 07:52 PM
    0 responses
    3 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    149 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Started by mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    33 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    5 views
    0 likes
    Last Post tkaboris  
    Working...
    X