![]() |
|
|||||||
| Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
I received an alert + messages in the log this morning...
Quote:
|
|
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
heech,
Where are you submitting orders from? You may be hitting race conditions. Hard to say without isolating out the specific line/block of code that generated this error.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 | |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
Quote:
This is one of the stop orders generated by my strategy (mentioned in the log as well). A race condition in NT order handling code, I assume you mean? It looks like it might be that. |
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Likely race condition. You will need to be mindful of the multi-threaded nature of NinjaTrader.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
Not sure what that means, Josh... in terms of being mindful. Do I need to do anything to synchronize *my* code, or are you saying I should just be aware of/ignore these errors when they pop up?
|
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
There is nothing you can do to synchronize NT being multi-threaded. You have to work with it and be aware of it.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Just curious, is this with IB TWS and if yes, what NT version are you using? Help > About.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#8 | |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
Quote:
I actually think this isn't a race condition, I'm suspecting something else (problems in my code?). I just had another stop order hit, and the same error message popped up... that's pretty bad luck on my part if it's a race condition. I've had three stop orders hit today, and two gave the same error. Note that the two orders that gave errors filled on multiple orders, whereas the stop order that didn't error out filled on a single order. I suspect that's significant. |
|
|
|
|
|
|
#9 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
We cannot evaluate the scenario without seeing exact code. Please post simple as possible code snippet.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#10 | ||
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
Quote:
Not sure what to show you... this is the stop order code. It's only called once at the beginning of day (or when position is entered)... so hours ago from when the error popped up. stopOrder = ExitLongStop(0, true, config.NumShares, holdPrice * stopMultiple, "", ""); holdPrice and stopMultiple are both static numbers from the point of view of this strategy (loaded from my cfg file). I do use OnOrderUpdate, and here's the relevant code for orderstate.filled: Quote:
|
||
|
|
|
|
|
#11 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
And have you isolated out the scenario when you reach these messages? Reproducible at will? What is the code doing right before it happens? The nature of these things is complicated. You need to do it step by step. Keep things very simple. One order at a time. Until you can isolate out exactly what is happening with your code we cannot assist much. Unfortunately we just don't have the bandwidth to be going through everyone's code in depth. What we need to see to further assist is the code you have isolated out (in this instance it may even be best to see the complete code of the isolated case so only show us the code that is absolutely necessary to reproduce), the behavior you think it should be doing, the behavior you are seeing, and all relevant evidence you have showing the contrary.
The key here is that you need to be able to reproduce it and inform us as to the steps to reproduce it and then we can proceed from there.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#12 | |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
Quote:
I think you're barking up the wrong tree here. There's no way that this is remotely related to my code. Your last theory was that this is a race condition in the Ninja Trader order handling code, I don't know how it jumped to my application. No, I have no way of reproducing the error... it isn't even an error generated by the strategy itself, and I have no intention of entering into positions and setting up stop orders just in hopes that I'll get multiple fills, and the platform will throw an alert. And just to be clear, it's not just a "log" message... I actually get a modal MessageBox with the alert (and not generated by my strategy). I think the most likely explanation is that whatever logic is in place (perhaps linked to TDAmeritrade - I take it it's not a common choice for the execution broker) for handling order fulfillment is confusing partial fills with full order fills. |
|
|
|
|
|
|
#13 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
The situation is this:
- This error message pops up when NT receives (for example) a "Filled" state for an order that has generated multiple part fills - In this example, we expect to see multiple "PartFilled" order states to be in sycn with the actuall executions reported in the OnExecution() method - This means that you can't rely on using OnOrderUpdate() with this particular broker since sometimes they may provide all order state changes and sometimes they may not The net result is that we would advise you not to use OnOrderUdpate() when trading through TDA. This occured before with IB (which is why I asked before) but this was an issue on our send that we fixed. I can see from your log info you posted that we really did not receive "PartFilled" states generated from the TDA adapter.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#14 |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
Ray,
That's about what I figured was happening. I'm not too concerned about OnOrderUpdate... if I get you correctly, my use of the function isn't the cause of the alert. You're just warning me about other consequences. I understand I might confuse a partial fill with a full fill, but at the time scales I'm trading at, it really shouldnt' be an issue 99.99% of the time. Regardless, I'll look into OnExecute(). In the mean time... are the Alert messages an issue? If I step away from my desk all day, and all hell breaks loose on the markets and I hit a lot of stop orders... am I going to end up with 50 messageboxes, and do you see that possibly breaking anything (like on-going execution of strategies)? And if *it* is an issue... can I pleasepleaseplase get a patched version of the software that gives me the option to turn off that messagebox alert? |
|
|
|
|
|
#15 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Depending on what the Alert message shows, if its an rejected order, the strategy will terminate immediately, if its some warning then there is the possibility that you can get an unwanted number of message boxes although I don't ever recall a situation where anyone has raised an issue due to an offensive number of message boxes. At this time, these boxes can't be surpressed.
Ray
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Saving strategy "state" | heech | Miscellaneous Support | 6 | 11-19-2008 04:44 PM |
| Unable to match order state to execution | nfeldberg | Strategy Development | 21 | 09-24-2008 12:14 PM |
| the forum can not remember the settings of "Sorted by" and "Sort Order" | clearpicks | Suggestions And Feedback | 1 | 05-23-2008 12:05 PM |
| "unable to connect to level2 server" for E-signal | MikeB | Miscellaneous Support | 8 | 02-03-2006 08:38 AM |
| "Invalid execution data from patssystems" | QuahTrader | Miscellaneous Support | 10 | 03-16-2005 10:46 AM |