Do you have a sample showcasing how to add a 2nd Account Selector to the Chart Trader?
To be used with the specific strategy loaded on the chart in place of the default Chart Trader Account Selector.
The function should be accessing and selecting account for the specific strategy from the 2nd Chart Trader Account Selector.
I managed to add buttons to a Chart Trader 2nd child grid but can't find insights on adding a 2nd Account Selector control.
namespace NinjaTrader.NinjaScript.Strategies
{
public class ChartTrader2ndAccountSelector : Strategy
{
private NinjaTrader.Gui.Tools.AccountSelector accountSelector;
//.....
protected override void OnStateChange()
{
//.....
if (State == State.SetDefaults)
{
else if (State == State.Historical)
{
if (ChartControl != null)
{
ChartControl.Dispatcher.InvokeAsync(() =>
{
CreateWPFControls();
});
}
}
else if (State == State.Terminated)
{
if (ChartControl != null)
{
ChartControl.Dispatcher.InvokeAsync(() =>
{
DisposeWPFControls();
});
}
//.....
protected void CreateWPFControls()
{
accountSelector = (Window.GetWindow(ChartControl.Parent).FindFirst(" ChartTraderControlAccountSelector") as NinjaTrader.Gui.Tools.AccountSelector);
//...
System.Windows.Controls.Grid.SetColumn(accountSele ctor, 0);
System.Windows.Controls.Grid.SetRow(accountSelecto r, 1);
//...
protected void CreateWPFControls()
{
accountSelector = new AccountSelector();
//...
System.Windows.Controls.Grid.SetColumn(accountSele ctor, 0);
System.Windows.Controls.Grid.SetRow(accountSelecto r, 1);
//...
///.....
This just takes the default chart trader Account selector and superimposes over the default instrument chart trader selector.
accountSelector = (Window.GetWindow(ChartControl.Parent).FindFirst(" ChartTraderControlAccountSelector") as NinjaTrader.Gui.Tools.AccountSelector);
This does not display anything in the new child grid
accountSelector = new AccountSelector();
I'd appreciate just using a NT native Account Selector object over recreating a WPF one.

Comment