Open indicator prefs

I could have sworn I had an example of how to open the indicator prefs panel via code but cannot find it. Anyone ?

1 Like

I dig some digging on this and, as far as I can tell, it’s not possible to open the NT preferences windows directly from code. I’m sure you could rig up your own dialog using the property grid though. Take a look at this sample project, it might provide some clues.

So I played around with this a little more and I have to rescind my “it’s not possible” comment. Turns out it is possible, and here’s how I did it:

		bool _indicatorSelectorIsOpen = false;
		bool _wantIndicatorSelectorOpen = true;
        protected override void OnBarUpdate()
        {
			if(!_indicatorSelectorIsOpen && _wantIndicatorSelectorOpen)
				ShowIndicatorProperties();

			_wantIndicatorSelectorOpen = false;
        }

		private void ShowIndicatorProperties()
		{
            ChartControl.Dispatcher.InvokeAsync(() =>
            {
                IndicatorSelector iSel = new IndicatorSelector(ChartControl, ChartControl.Indicators, this);
                iSel.Closed += ISel_Closed;
				_indicatorSelectorIsOpen = true;
                iSel.ShowDialog();
            });
        }
        private void ISel_Closed(object sender, EventArgs e)
        {
            _indicatorSelectorIsOpen = false;
        }
1 Like

Thanks, but this method seems to unload all any other indicators that are on the chart

I did find ChartControl.OnIndicatorsHotKey() which replicates the hot key assignment. It doesn’t open from the calling indicator however.

1 Like

That’s strange. When I run the code I see all attached indicators in the dialog, with the calling indicator pre-selected. If I change the 3rd argument from “this” to “null” I still get all the attached indicators, but without the pre-selection. In order to show only the current indicator I have to change the second argument to:

new List<IndicatorRenderBase>() { this }

Sounds like something else must be going wrong in your setup. Not sure what it could be.

SelectorToolTip

Well, I figured 1 of the 2 problems . Missing indicator names, all the indicators had this code:

	public override string DisplayName
	{ 
		get { if  (State == State.SetDefaults) return "My Name"; else  return "";  }	  
	}

Under normal circumstances this works fine and the Indicator Names always populate in the regular Indicator panel but I guess calling IndicatorSelector, runs after SetDefaults. So they’re blank.

The second issue, where all the indicators on the chart unload when the panel is closed(clicking apply or cancel). I have no idea.