If I have multiple charts with different symbols open and add it the button via a indicator to each chart - if I click on a button on one of the charts it will prompt a message saying that the calling thread cannot access this object because a different thread owns it.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
adding button to chart trader
Collapse
X
-
adding button to chart trader
when adding a button to chart trader - if I have a button click that changes the font, background, etc I know that I need to use a dispatcher to update the properties.
If I have multiple charts with different symbols open and add it the button via a indicator to each chart - if I click on a button on one of the charts it will prompt a message saying that the calling thread cannot access this object because a different thread owns it.Tags: None
-
Hello WHICKED,
An indicator would by default, only be able to access the chart it is applied to.
When clicking the button, what code is being run that is causing the error?
Are you certain clicking the button is when the error appears, and not when the button is added to the WPF?Chelsea B.NinjaTrader Customer Service
-
Yes, it will add the buttons to the chart trader on each chart - but if I press a button it will pop up that dialog box.
A behavior that I have observed is the buttons work on the last chart trader the buttons are applied on, but on any of the other chart traders when pressing on a button it will error when a button is pressed.
All the buttons are labeled the same name and each as the same button click name function. There is also the method to perform actions by looking up the button name by the wpf property name.
Comment
-
Hello WHICKED,
To confirm, you comment out all code in the click handler event method, the error still occurs? Meaning, it is not the code in the method, it's the button click itself, is this correct?
If the error does not occur when the code is commented out, then this means the code that was commented out is causing the error.
Debug the script and find the specific line of code causing the error.
Are you following the code in the reference sample for adding buttons? (regions 'Use case #5: Custom chart trader buttons')
https://ninjatrader.com/support/help...ui)-modifi.htm
I would recommend you use the code in the reference sample to start with something that works. Then replace the logic to suit your needs.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
633 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
364 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
567 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
568 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment