--EV
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
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
-
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
-
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 PhillT, Today, 02:16 PM
|
1 response
1 view
0 likes
|
Last Post Today, 02:29 PM | ||
Started by Kaledus, Today, 01:29 PM
|
3 responses
9 views
0 likes
|
Last Post Today, 02:24 PM | ||
Started by frankthearm, Yesterday, 09:08 AM
|
14 responses
47 views
0 likes
|
Last Post Today, 02:19 PM | ||
Is it possible to have a drawing, such as a line, cycle through different colors?
by gentlebenthebear
Started by gentlebenthebear, Today, 01:30 AM
|
2 responses
13 views
0 likes
|
Last Post Today, 02:05 PM | ||
Started by PaulMohn, Today, 12:36 PM
|
2 responses
17 views
0 likes
|
Last Post
by PaulMohn
Today, 01:48 PM
|
Comment