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

access instrument selector

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

    access instrument selector

    In an indicator, I have to use OnRender() to determine which instrument is selected.


    With

    Code:
    gAccountSelector = Window.GetWindow(ChartControl.Parent).FindFirst("C hartTraderControlAccountSelector") as NinjaTrader.Gui.Tools.AccountSelector;
    gAccount = gAccountSelector.SelectedAccount;

    Do I access an account.



    Code:
    NinjaTrader.Gui.Tools.InstrumentSelector instrumentSelector = (Window.GetWindow(ChartControl.Parent).FindFirst(" ChartTraderControlInstrumentSelector") as NinjaTrader.Gui.Tools.InstrumentSelector);

    I tried this way to access the InstrumentSelector.
    But it does not work.

    How can I determine the current setting of the instrument?​

    #2
    Hello 1001111,

    You can use the following to access the instrument in the chart trader:

    Code:
    ChartControl.Dispatcher.InvokeAsync(()=>{
        NinjaTrader.Gui.Chart.ChartTrader chartTraderControl =Window.GetWindow(ChartControl.Parent).FindFirst(" ChartWindowChartTraderControl") as NinjaTrader.Gui.Chart.ChartTrader;
        Print(chartTraderControl.Instrument);
    });

    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank you. That helped me alot.

      Comment


        #4
        Try using OwnerChart,

        Code:
        ChartControl.Dispatcher.InvokeAsync(() =>
        {
            Print(ChartControl.OwnerChart.ChartTrader.Instrument);
        });​

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by swjake, Today, 12:04 PM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by kevinenergy, Today, 12:01 PM
        0 responses
        4 views
        0 likes
        Last Post kevinenergy  
        Started by ETFVoyageur, 05-07-2024, 07:05 PM
        8 responses
        60 views
        0 likes
        Last Post ETFVoyageur  
        Started by Taddypole, 04-26-2024, 02:47 PM
        8 responses
        73 views
        0 likes
        Last Post eDanny
        by eDanny
         
        Started by quicksandatl, Today, 11:11 AM
        2 responses
        9 views
        0 likes
        Last Post quicksandatl  
        Working...
        X