View Full Version : More than 100 subsequent events?
heech
04-22-2009, 12:26 AM
Hi,
I'm trying something a little kooky for more efficient back-testing purposes... it basically involves placing multiple orders within the same bar.
As a result, I'm ending up with this:
4/21/2009 11:16:06 PM Strategy Error on calling the 'OnOrderUpdate' method for strategy 'ProtectDownMulti': More than 100 subsequent user events
...? What's a user event? I should probably have about 20 stop orders queued up (on the same bar) at this point, not 100. What's the fundamental constraint here?
NinjaTrader_Dierk
04-22-2009, 12:39 AM
User event = NinjaScript method call
> 100 stacked NinjaScript method calls would be invoked. This is an indication, that there could be something wrong with your code, probably a infinite recursion.
heech
04-22-2009, 12:44 AM
User event = NinjaScript method call
> 100 stacked NinjaScript method calls would be invoked. This is an indication, that there could be something wrong with your code, probably a infinite recursion.
Dierk,
Thanks, I'll take a closer look at what I'm doing.
But can you give me an idea of how I could generate a "stacked" call? Would it have to be within the OnOrderUpdate or OnExecution methods, like where I'm submitting additional orders?
NinjaTrader_Dierk
04-22-2009, 12:49 AM
Sample:
- NT calls A
- A triggers some order(s)
- which then triggers B
- B then triggers some order(s)
- which then triggers A
A, B = NinjaScript methods
This is just a sample. Your scenario would be very different. Bottom line is: As NT calls a NinjaScript method, your logic in that method would trigger more than 100 additional direct NinjaScript method before actually control would be returned to NT.
heech
04-22-2009, 12:54 AM
Dierk,
Thanks, I'll take a closer look at what I'm doing.
But can you give me an idea of how I could generate a "stacked" call? Would it have to be within the OnOrderUpdate or OnExecution methods, like where I'm submitting additional orders?
Oh I bet I can guess what I'm doing.
I have probably 30-60 orders sitting on the same BarsInProgress value. And of course, each order can generate multiple events for OnOrderUpdate (pendingsubmit, submitted, accepted, etc...). And it's probably this combination that can push me over the 100 limit.
Does that sound reasonable as a possibility...?
NinjaTrader_Dierk
04-22-2009, 12:59 AM
I see. I'll change that limit to 1000. Pls fire me again a mail so I could provide you a custom build.
NinjaTrader_Dierk
04-22-2009, 01:01 AM
Actually even better: there is the undocumented .MaxProcessedEvents property which you could set in Initialize() to your liking.
heech
04-22-2009, 12:52 PM
Actually even better: there is the undocumented .MaxProcessedEvents property which you could set in Initialize() to your liking.
Beautiful, that did it.
Now I can test probably 20x faster than I had been...