Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Chart refresh
Collapse
X
-
Hello,
Thank you for the post.
In NT8 it is not suggested to try and invalidate any control, this is due to the multithreading in the platform. You can create crash situations if you do try to invalidate controls.
Instead, you have a couple of options, to inform the chart that a refresh may be needed, ForceRefresh is suggested:
To immediately repaint a chart, you would need to cause one of the actions listed on the ForceRefresh page. The only action that can be directly invoked would be to add a dummy drawing object and then immediately remove it. You can use the Draw. methods to draw a Dot as an example, the dot can be transparent not scaled at a price of 0, and then the next line of code can be its removal. This would be useful for a case that requires a update which is out of event, for example, a button press.
I look forward to being of further assistance.
-
Hello,
Correct. The object being added and removed is only a step to cause the refresh, because the chart is looking for an object to be removed this would cause a refresh.
The syntax could be as simple as the following:
Generally, the suggestion is to allow the platform to control rendering for performance reasons, in cases where you need to force a refresh it would still be suggested to allow the platform to manage the rate in which that is refreshed (ForceRefresh()). That doesn't always cover all cases and when an immediate reload is needed removing an object will cause the chart to update as this is a platform event.Code:Draw.Dot(this, "dummy_dot", false, 0, 0, Brushes.Transparent); RemoveDrawObject("dummy_dot");
Please note that this is not a solution when updates are needed frequently, this would be a good solution for a button press as an example. If you are going to be using this from OnRender or something that is called frequently, this can actually reduce performance and lead to longer refresh times. If your concept requires that this is called frequently, I would revert back to just allowing the chart to control the refresh as there is no safe way to invalidate the panel.
Please let me know if I may be of further assistance.
Comment
-
ninjo,
There is not a documented way to reload NinjaScript programmatically. You could likely use SendKeys to invoke F5 which would reload NinjaScript, but you should be careful with that method as you could run into further issues where it is called recursively. This is general C# and would be outside any support we could provide.Josh G.NinjaTrader Customer Service
Comment
-
I got it with a simple code but I need to update a "NinjaScriptProperty" value with this chart update.
I am setting in the button function with the F5 Sendkey, but doesnt work. The initial value of the "NinjaScriptProperty" occur
Its possible to modify a "NinjaScriptProperty" property like with I change in the Indicator window?
Thank you for the support JoshG
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
49 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
126 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
67 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment