How do I retrieve the current Instrument in the Trader Grid Instrument Drop Down Box?
In the past I used the code below to get access to the select account:
asChartTraderAccount = Window.GetWindow(ChartControl.Parent).FindFirst("C hartTraderControlAccountSelector") as NinjaTrader.Gui.Tools.AccountSelector;
if (asChartTraderAccount != null)
{
this.Account = asChartTraderAccount.SelectedAccount;
}
Now I am trying to access the Instrument that is selected in the Trader grid, but it does not work:
NinjaTrader.Gui.Tools.InstrumentSelector asInstrumentSelector = null;
asInstrumentSelector = Window.GetWindow(ChartControl.Parent).FindFirst("C hartTraderControlInstrumentSelector") as NinjaTrader.Gui.Tools.InstrumentSelector;
if (asInstrumentSelector != null)
{
Print(asInstrumentSelector.Instrument.MasterInstru ment.Name);
}
How do I get the "Instrument" object for the selection in the Trader grid?
The objective I am doing this is to compare the current instrument for an indicator running on a chart tab to the current selected instrument in the chart trader.
The problem I am facing is that if you have multiple tabs in a chart window, when Ninja Trader loads the first time, I want to be able to differentiate the TABS that are not selected to the TAB that is currently selected.
If there is a better way to determine which tab is currently "under the focus" or active and which ones are in the graph but not currently selected it would also work for me. (actually it would be a better solution)

Comment