Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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.JesseNinjaTrader Customer Service
-
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:
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.JesseNinjaTrader Customer Service
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 DayTradingDEMON, Today, 09:28 AM
|
2 responses
15 views
0 likes
|
Last Post Today, 09:56 AM | ||
Started by Stanfillirenfro, Today, 07:23 AM
|
6 responses
23 views
0 likes
|
Last Post Today, 09:55 AM | ||
Started by navyguy06, Today, 09:28 AM
|
1 response
6 views
0 likes
|
Last Post Today, 09:54 AM | ||
Started by cmtjoancolmenero, Yesterday, 03:58 PM
|
8 responses
32 views
0 likes
|
Last Post Today, 09:34 AM | ||
Started by helpwanted, Today, 03:06 AM
|
2 responses
22 views
0 likes
|
Last Post Today, 09:30 AM |
Comment