Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

One indicator change the properties of another Indicator

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

  • NinjaTrader_ChelseaB
    replied
    To All,

    Just an update to this thread.

    The example in Post #2 is using undocumented code and not officially supported by NinjaTrader.

    Further, we advise not invalidating the chart and instead calling ForceRefresh() to prevent deadlocks.

    From the help guide:
    "Warning: Excessive calls to ForceRefresh() and OnRender() can carry an impact on general application performance. You should only call ForceRefresh() if the chart truly needs to be visually updated. It is NOT recommended to invalidate the chart control directly as this could cause issues with threading which result in dead locks."

    Leave a comment:


  • Sim22
    replied
    Thank you Chelsea

    I understand, however often forum members do not tag threads properly which makes searching very time consuming.

    I know your resources are strapped for time esp. since, as you say, NT8 is still fairly new. I just thought a general depository would be good where useful code could be dumped for reuse. I think it would save you guys/gals time in the long run from answering fragmented questions and save us hours from attempting to piece those fragmented snippets together

    Thanks for your help all the same!

    Simon.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Sim22,

    Our code examples are written as we get inquiries and need an example to demonstrate.

    NinjaTrader 8 Beta is fairly new and at this time there are not many samples written by support. However the samples written are posted publicly to the forum and I would recommend searching the forum for posts along the interested topic.

    It is possible to trigger a chart to invalidate from an addon using the chart control.

    Code:
    foreach (Window window in Globals.AllWindows)
    {
    	NTWindow w = (NTWindow)window;
    	window.Dispatcher.BeginInvoke(new Action(() =>
    	{
    		if (!w.Caption.Contains("Chart"))
    			return;
    
    		TabControl tc = w.FindFirst("ChartWindowTabControl") as TabControl;
    		if (tc == null)
    			return;
    
    		foreach (TabItem ti in tc.Items)
    		{
    			ChartControl tabChartControl = (ti.Content as ChartTab).ChartControl;
    			if (ti.IsSelected)
    				tabChartControl.InvalidateVisual();						
    		}
    	}));
    }

    Leave a comment:


  • Sim22
    replied
    Originally posted by cutzpr View Post
    Is it possible for one indicator to change the properties of another indicator? Essentially I want to create Buttons on the chart that enable me to toggle on and off another indicators visible property.
    Hello cutzpr,

    I have made an Addon from Jesse's original Addon to set IsVisible true/false.

    Some superfluous code have not been removed and is provided 'as-is'.

    I have actually learned a lot from this particular example, so thanks for posting.

    I have a question for the NT team: Is it possible to add a code snippet to refresh the chart when the 'IsVisible' button is clicked.

    I tried:

    Code:
                selectedIndicator.OwnerChartControl.InvalidateVisual();
    However, it produced an exception.

    Chelsea, is it actually possible to have access to more code examples, especially interaction between xaml and C#?

    Any code examples like this are priceless.

    Thank you.
    Attached Files

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello cutzpr,

    This should be possible to do.

    You will need to grab the chart and list the indicators and then find a property to set using undocumented code.

    An example of this is attached.

    This example uses undocumented code and is not officially supported by NinjaTrader Support.
    Attached Files
    Last edited by NinjaTrader_ChelseaB; 05-11-2021, 11:21 AM.

    Leave a comment:


  • One indicator change the properties of another Indicator

    Is it possible for one indicator to change the properties of another indicator? Essentially I want to create Buttons on the chart that enable me to toggle on and off another indicators visible property.

Latest Posts

Collapse

Topics Statistics Last Post
Started by Skifree, Today, 03:41 AM
1 response
4 views
0 likes
Last Post Skifree
by Skifree
 
Started by usazencort, Today, 01:16 AM
0 responses
1 view
0 likes
Last Post usazencort  
Started by kaywai, 09-01-2023, 08:44 PM
5 responses
603 views
0 likes
Last Post NinjaTrader_Jason  
Started by xiinteractive, 04-09-2024, 08:08 AM
6 responses
23 views
0 likes
Last Post xiinteractive  
Started by Pattontje, Yesterday, 02:10 PM
2 responses
23 views
0 likes
Last Post Pattontje  
Working...
X