I'm not able to trap the error in my indicator or in my class...so I'm looking for your review and analysis.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Get unhandled exception error when attempting to move a chart
Collapse
X
-
Get unhandled exception error when attempting to move a chart
I'm converting one of my NT7 classes into NT8...I have the class in an indicator, and that indicator appears to run well (it just renders the string "Hello" to the top-left corner of the chart)...but whenever I attempt to move or resize that chart, an unhandled exception is produced.
I'm not able to trap the error in my indicator or in my class...so I'm looking for your review and analysis.Tags: None
-
I am seeing the same issue consistently using your script -- thank you for reporting this. I will take a closer look at what may be causing the issue, and I'll post back here either with an explanation or an ID number for a report to our development team.Dave I.NinjaTrader Product Management
Comment
-
I believe I see what is causing the issue now, and this may help with sledge's issue, as well. The issue came down to the point at which "renderTarget" was being assigned. I noticed that the issue occurs every time the chart window is "grabbed," whether you are about to move it, resize it, or are simply holding down the mouse button in a way that grabs the chart's edge or the entire window.
It appears that RenderTarget is the object which is null at that particular moment, so assigning RM.renderTarget = RenderTarget at the moment OnRender is called results in no error when bars are being painted, etc., but causes the error when the chart is preparing to move or be resized. This is because of the way that we handle resizing and moving of the chart. Rather than dynamically painting the chart as it is being moved or resized, we are essentially displaying an image representing the state of the chart at the moment the moving or resizing began, then returning to painting as usual afterwards.
To resolve the issue, I moved the assignment of RM.renderTarget into OnStateChange() State.Configure. With this change, the text disappears while the chart is being moved or resized, but immediately reappears afterward, because it is always assigned to the RenderTarget of the chart this way.Last edited by NinjaTrader_DaveI; 10-13-2015, 09:50 AM.Dave I.NinjaTrader Product Management
Comment
-
Hi Dave,
Can you send me a copy of the new indicator with your changes?
I'm attempting to interpret and apply your fix, but the fix not fixing the error.
Comment
-
Hi Dave,
I'm finding that your change hasn't helped solve the problem. Can you take a look at it again?
Comment
-
It's a runtime error only...and it occurs when I move the chart that contains the CustomRenderer indicator.
Here's a screenshot: http://screencast.com/t/wYwmver7r
I've attached the Log contents...it shows there are 3 errors occurring each time I move the chart..
Comment
-
Hello,
I tried the sample and too see this is occurring during the charts movement.
I started by removing all of the try/catch statements from the script to see if the resize was the actual problem event in which was generating an error, after doing this the script is unable to start at all due to a null reference exception. The try catch seems to have allowed the script beyond the point in error, in this case it actually made debugging this more confusing than just not having them.
It appears that where you are setting the RenderTarget combined with where the TextFormat is being defined would be the cause of the error.
I have attached a reworked sample that no longer contains the error but still utilizes your custom class. I also have removed the Try/catch's to ensure there are no runtime errors.
This also makes use of OnRenderTargetChanged(), during the resize the RenderTarget would be destroyed, this allows for creating objects when the target is changed once again.
Please let me know if I may be of further assistance.Attached FilesJesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by algospoke, Yesterday, 06:40 PM
|
2 responses
18 views
0 likes
|
Last Post
by algospoke
Today, 07:04 PM
|
||
Started by ghoul, Today, 06:02 PM
|
3 responses
14 views
0 likes
|
Last Post Today, 06:43 PM | ||
Started by jeronymite, 04-12-2024, 04:26 PM
|
3 responses
44 views
0 likes
|
Last Post
by jeronymite
Yesterday, 10:10 PM
|
||
Started by Barry Milan, Yesterday, 10:35 PM
|
7 responses
20 views
0 likes
|
Last Post Today, 06:16 PM | ||
Started by AttiM, 02-14-2024, 05:20 PM
|
10 responses
180 views
0 likes
|
Last Post
by jeronymite
Today, 06:11 PM
|
Comment