--EV
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How can I interrupt NT?
Collapse
X
-
How can I interrupt NT?
If I have a bug in my custom indicator and get into an infinite loop, how can I regain control (other than to use Task Manager to kill NT)?
--EVTags: None
-
I'm not sure how widespread the need is, and therefore how important the request is, but it sure would be nice to honor some hot key in that case.
My best guess is that this happens rarely enough that this suggestion is useful, but fairly low priority.
--EV
Comment
-
Not sure of your 'infinite loop' scenario: are you testing an indicator or in trading mode?Originally posted by ETFVoyageur View PostIf I have a bug in my custom indicator and get into an infinite loop, how can I regain control (other than to use Task Manager to kill NT)?
--EV
I havent implemented this, but I think you could monitor for changes to a txt file each bar update, and and have the indicator stop if the file has 'quit' as the last entry etc ... something like monitoring the ATI port as well ... internally if in a loop would the calculated value be exactly the same for muliple bars in a row == stop / kill
NT guys: anything else on these thoughts?... of course if the indicator is totally frozen due to .NET framework issues you are SOL.
JonLast edited by Trader.Jon; 02-19-2011, 01:37 PM.
Comment
-
I was testing a new one. I introduced a a bug such that a loop counter was getting incremented by something that evaluated to zero. Since I had not changed much code it was not too hard to pin down.
This, by the way, was another case of the evils of Print being buffered whether you like it or not. I had a Print statement inside that loop, but due to buffered printing never saw any output. If I had seen it, the problem would have been instantly obvious.
I sure hope that they offer an unbuffered form of printing in the future for developers to use when debugging.
-- EVLast edited by ETFVoyageur; 02-20-2011, 02:14 AM.
Comment
-
I don't believe it is a buffering issue, but one of threading/synchronization.Originally posted by ETFVoyageur View PostI was testing a new one. I introduced a a bug such that a loop counter was getting incremented by something that evaluated to zero. Since I had not changed much code it was not too hard to pin down.
This, by the way, was another case of the evils of Print being buffered whether you like it or not. I had a Print statement inside that loop, but due to buffered printing never saw any output. If I had seen it, the problem would have been instantly obvious.
I sure hope that they offer an unbuffered form of printing in the future for developers to use when debugging.
-- Bob
This doesn't print to the console window until it returns from OnBarUpdate, and this code borders on 'infinite loop'.
I changed count to 200000000 and have been waiting 40 minutes for NT to respond. I'm sure it will, it just might take a few more hours at this pace. (I just gave up).
I'm not sure how to synchronize yet in this C#/.net stuff.
From my experience elsewhere, OnBarUpdate is basically a callback function. Anything you update elsewhere in the main program (NT output window) won't happen until you return to the main thread.
For the console window to update, you have to relinquish control of your code.. some programming languages allow this (example Oracle Forms, with the synchronize; command).. the synchronize command allows Oracle Forms to go off and do things like repaint the screen, but then return back to where the code left off. I'm not finding that so far in C#/.net/ninja.
So therefore, if you wrote your own code to output to YOUR created window, you would see it in 'real time' instead of what you refer to as 'buffered'.
I guess another term for this is an event handler.
Code:protected override void OnBarUpdate() { if (Historical) return; int count = 200000; if (BarsInProgress != 0) return; for (int i = 1; i <= count; i++) { Print ( i + " Closes[0][0] =" + Closes[0][0] + " Times[0][0]=" + Times[0][0]); //Print ( " Closes[1][0] =" + Closes[1][0] + " Times[1][0]=" + Times[1][0]); Print ( i + " High[1] = " + High[1] + " Low[1] = " + Low[1] ); }
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
581 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
338 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 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
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment