NexusFi: Find Your Edge


Home Menu

 





Select window and then tab that indicator is running on


Discussion in NinjaTrader

Updated
    1. trending_up 2,467 views
    2. thumb_up 1 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 b16aln 
London
 
Experience: None
Platform: ninjatrader
Trading: ftse100
Posts: 67 since Sep 2017
Thanks Given: 11
Thanks Received: 23

Hi,

I've also posted this on the NT8 help forum but thought you guys might also know the answer to this.

In a situation where I have multiple windows with multiple tabs open on each window, I am trying to have code within an indicator that will find and focus on the tab with the indicator running then use the SendKey.Wait method.

I am unable to get the tab to become focussed in the first instance.

I am using .Focus() within a dispatcher then checking using .IsFocused however I cannot get IsFocused to become true.

Can anyone suggest the correct use of code to focus on the tab with the indicator running please.I am trying the code below but IsFocussed is still coming out as false.

Thanks for any suggestions
_____________________________________________________________________________________


private NinjaTrader.Gui.Chart.ChartTab chartTab;
private Chart chartWindow;
private System.Windows.Controls.TabItem tabItem;



protected override void OnBarUpdate()
{

ChartControl.Dispatcher.InvokeAsync((Action)(() =>
{

chartWindow = Window.GetWindow(this.ChartControl.Parent) as Chart;
if(chartWindow==null)
{
Print("chartWindow== null");
return;
}

foreach (System.Windows.Controls.TabItem tab in chartWindow.MainTabControl.Items)
if ((tab.Content as ChartTab).ChartControl == ChartControl && tab == chartWindow.MainTabControl.SelectedItem)
tabItem=tab;

if (tabItem == null)
return;

chartTab = tabItem.Content as NinjaTrader.Gui.Chart.ChartTab;
if (chartTab == null)
return;

chartTab.Focus();

Print(chartTab.IsFocused);


}));

}


Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Kraken Becomes First US Digital Asset Bank With Direct F …
Cryptocurrency
CFTC Advances Prediction Markets Regulation -- Chairman …
Prediction Markets & Event Contracts
April FOMC Minutes: Most Divided Fed Since 1992 -- Many …
Traders Hideout
Cboe Files for Near 24x5 Equities Trading -- December 20 …
Traders Hideout
Iran War Prediction Markets: Ceasefire 16%, Ground Invas …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks




Last Updated on March 29, 2020


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts