View Full Version : Ninja dumping all position strategies upon reconnect
01-24-2005, 02:16 AM
Good Morning -
I've been using NinjaTrader for a while now, with some success - I enjoy the fact that I can pick an entry and exit and then sit on a stock for days or weeks, waiting for the stock to hit my price, knowing that the Ninjas will jump into action when it does hit.
This morning, unfortunately, I hit a relatively large problem (similar to my previous problems). As you know, IB automatically logs out on a daily basis, and so every morning, I need to reconnect. Usually, this is not a problem. I start up IB, wait, start up Ninja, wait, and then connect - all is usually OK.
However, if the connection doesn't happen exactly as required, ALL position strategies are dumped. This is very frustrating, as I have to spend the next half hour or so setting them up again from scratch - in addition, those stocks in IB which already have stops/limits have new stops/limits put in - meaning I have to close the existing ones.
I tried closing both programs again and then re-starting them as before, but once the dump happened, all strategies seem to be unrecoverable.
Any advice on either how to avoid this, or how to get the strategies back once they have been dumped (i.e. how to do some kind of rollback?).
01-24-2005, 03:29 AM
Strategies are synchronized upon every connection. They become unrecoverable if either of the following conditions are true -
- Orders that belonged to the strategy are missing
- Orders that belonged to the strategy are partially filled
If the above conditions are true, the integrity of the strategy is lost therefore can't be recovered.
01-24-2005, 04:59 AM
Hi Ray -
Actually, they become unrecoverable also if there is a glitch when the reconnect happens. This has happened to me a few times if I am not VERY careful about the reconnect order.
One thing that I'm going to do is put in a more powerful PC so that (hopefully!) this glitch does not happen as much.
However, there should be a way to "go back" to before the reconnect, and try to reconnect again. That is, once Ninja decides that the strategies are unrecoverable, it has made up it's mind and (it seems) they can never be recovered. This is not always the case - sometimes there was just a problem with the reconnect. There should be a way to rollback, try the reconnect again, with (hopefully) better luck this time.
I know that this may be asking a lot (and perhaps upgrading my PC will do the trick), but I have observed this behavior and handling it may make Ninja a stronger product.
01-26-2005, 10:06 AM
I noticed a case today that NT should have caught (or I think perhaps it should catch). I trade equites and I pushed my leverage to almost 4 today. This is twice what IB allows overnight. I got distracted close to closing and did not liquidate in time. IB's computer liquidated my account down to a leverage of 2. IB (for some reason) does not delete any lingering positions associated with the liquidated stocks. NT did not notice the stocks were gone and of course none of the associated orders were deleted so it apparently assummed that nothing happened. I thought this was a little strange so I figured I would just restart TWS and NT and see if NT would do something to account for orders in place without any associated positions. NT started up and found the orders and reconstructed the associated strategies but it did not notice that there were no positions associated with the stratigies.
Ok I can see that reconstructing stratigies and their associated orders would be an extremelly complex job but I agree with some of the recommendations that instead of just elliminating (or in this case above not elliminating) stratigies it would be GREAT if NT simply flagged the strategy as invalid and record the reason in the log. That way we could simply investigate the problem and correct it ourselves. The details of what capapbility the user had to recover a strategy would of course need to be decided by the NT programmers but at the very least PLEASE do not just elliminate the strategy or keep a bogus one alive without some sort of screen signal that flags the strategy as invalid.
Thanks For Listening
01-26-2005, 10:34 AM
A strategy is not bogus if you don't have a position to support it. A strategy is independant of an actual position. For most of us, our strategy size directly reflects our account position size. However, the flexibility inthe strategy approach allows one to run multiple strategies on the same market. For instance, you could have 5 contracts in your account. One strategy manages 3 of 5 contracts while a second is managing 2 of 5. Therefore, you could have 2 long in your account with a strategy managing them. This could bea day trade. You then decide to scalp short 2 contracts at which time your actual account position is flat but NT is managing 2 opposing strategies. This is of course an advanced usage model of NT.
Hope that it makese sense.
01-26-2005, 02:20 PM
I do understand your description of having one strategy controlling 2 positions and the other strategy controlling 3 positions totalling 5 contracts. But WHAT IF some magic demon snuck in the back door and stole 2 of your positions leaving you with a strategy that was not connected to the stolen positions. The demon even confused matters more by leaving a trail of orders. This is my definition of a bogus (aka false) strategy. It IS connected to actual existing orders it's just that the actual thing the orders control is missing. IB did this to me by liqidating positions and leaving the associated orders intact (dirty guys).
I really am not criticizing NT, bogus is just a dumb word I use to describe the situation I found myself in.
All I really need is for NT to let me know when a strategy does not have a complete logical chain from strategy through the orders to the final position(s). Above all I do not want NT to simply erradicate the strategy leaving only a log entry. This method of notifying the user of a problem is transparent and is easily overlooked since one must remember to look at the log. I need the strategy flagged on the screen to let me know that I have a problem with the strategy and that it is up to me to do something about it. You can keep the strategy from being activated, just flag it red or something, maybe just flag it red and say look in the log.
Again it would aid me greatly to simply flag a strategy (aka position strategy) that is in the condition of "incompleteness" in that it is missing an order(s) or the order(s) are not connected to their associated positions or any other condition that the NT programmers detect. I wrapped this condition up into the unfortunate word "bogus" when I should have simply described what it was I needed.
Hopefully this is something you could program since it really would help me out tremendously.
Maybe instead of all the above you could simply detect when the log contains some entry that contains a strategy error and simply pop-up a warning dialog? Even this simple soultion would be of great benefit to us equity traders who load NT up with 40 tickers and several strategies controlling several positions for each ticker. It is very easy tooverlook the fact that a strategy failed to reconstruct on startup.
Maybe another solution (actually I like this one the best)is to simply highlight the menu bar (file, tools, view help +-) red if ANYTHING bad appears in the log, like a broker disconnect or the strategy problem etc. As a user we can see the color red in the menu bar and we will know enoght to go look in the log to see what is wrong. Maybe even put an audible alarm sound in associated with the red alarm. Give us a small button that will clear (reset) the alarm until the next bad thing is entered into the log. This solution is better than a pop-up warning because I shrink the control center using the +- menu and it would be highly visible on the desktop. Also if you use a pop-up you will find that if NT is really bogged down with numerous errors you may find the program generating hundreds of pop-ups one after the other which will prevent the user from accessing the log.