Deadline June

Networking unknown unknowns

Back on the networking issues with the IB / NinjaTrader / internet issue still not put to bed.

I have to connect the trading Windows 7 workstation to talk to IB directly via the DSL modem (not router) and cut out my LAN entirely.

On the modem after saving my existing config, I'll do a full factory reset and then just set up the basics to get online, without any firewalls or DOS filtering or any other trickery the modem offers. I want to end up with just me, the modem then the Internet with no firewalls or "intelligence" in the way.

Then I'll be back to basics and I can test NinjaTrader and IB again and see if it works. I don't think it will. If it does though, then one step at a time, I add things back in - modem config, then test again, then the gateway machine and LAN and test again, then iptables firewall, and so on.

My guess is that NinjaTrader won't work even when connected direct to the modem.

The latest theory from a networking mailing list I'm on is that BT is throttling my broadband connection.

So if this doesn't work, the next step is to try the workstation from someone else's LAN. If that works, then it depends who their ISP is, although hopefully whatever I'll be closer to an answer. If it still doesn't work, then I need to try IB and NinjaTrader from someone else's computer if possible and see if that works.

If all of that fails, then it must be NinjaTrader. What a slow, painful process - but it looks like the only way to go. Probably less work than switching ISP.
 
Re: More backtesting hell and damnation

This time it's stop orders.

I thought for a long time that I was incapable of writing a system whose exit strategy was based on trailing stops. There would always be a few instruments in the portfolio which just lost money wholesale. So badly that I just dropped it automatically.

Trend systems use trailing stops, and no profit targets. Are you saying you weren't able to code it, or that when you did you didn't get good results?
 
re: More backtesting hell and damnation

I coded it and got rubbish results. I didn't research far enough to get any decent results. I just had a trailing stop with 2 parameters - initial stop and delta.

I figured my entries were just rubbish, although an "exit-neutral" strategy of equidistant targets and stops showed a good 55% hit rate. So I mean, rubbish entries for a trailing stop - even if good entries for a profit target.

So I tweaked that and went with it. I figured that the 3 Ducks wasn't a full blown LTTF system anyway and I could get good intermediate results with a profit target.

Tell you the truth, my notes going back to that period are not good - in fact they are non-existant so I'm probably not giving myself the credit I should be for researching it properly. But then maybe I am. It was quite a stressful period.

In the meantime, I dont just look at % hit rate on entries, I have a look at "Max favourable excursion" too, but the jury's still out on that one.
 
Last edited:
Muppetry in Motion

I need to sack myself again.

I don't know how long I was testing out different algorithms with this error, but I had copied the long entry if () clause and edited it to specify the opposite for short entries, but had left a key condition completely unaltered, i.e. completely messing up the short side results for the last dozen backtests or so. Several million computer CPU cycles down the toilet, but at least it explains why I couldn't find anything that build on the promising stuff I was looking at earlier.

While on the subject of errors and ****-ups, Windows 7 and Internet Explorer almost killed my trading workstation last night as I used it to log on to the NHS Direct website which isn't compatible with Firefox (that's the browser I always use on my linux machine).

NinjaTrader was quite happy before that but then it switched into 'unresponsive' mode, not fun with 6 trades on. After managing to shut down Internet Explorer without a Blue Screen of Death or any further errors, I just left it for a while and NnjaTrader came back to life, but all my order had disappeared. At least from NinjaTrader. Since it was 1 in the morning and I was pretty stressed out anyway with a kid with a high fever I forgot to check in Interactive Brokers what had happened to the trades.

Instead of rebooting which would have been the smart move, I just restarted the NinjaTrader strategies and it issued new orders for all the positions. In the morning though I thought I'd developed double-vision overnight. All the orders that had disappeared in NinjaTrader were back again. Fortunately though only one of them had been hit and so I'd reversed, not just closed out due to the new orders that issued last night. Fortunately it was a big spike on GBP/AUD which hit target and then dropped back down again, so the Error Account is up another 10 pips from the time between the overfill and my reaction.
 
Into drawdown in the error account

More damage from late night operations.

BT killed my connection for an hour or so at about half past midnight and when it came back and I had restarted my strategies, I missed a reversal on AUD/CAD.

I'd been long AUD/CAD for 2 days from .9842 with it going nowhere and my system reversed in theory while the internet connection was down, at .9821'5 so I would have taken 20.5 pips hit and gone short, but I didn't.

When checking my system I missed the same error which I've missed before, I should know to look for this. I checked the system on AUD/CAD, saw the position and the two orders but didn't clock that the orders were buys on a long position.

I didn't see anything until 12:20 by which time it was almost too late to do anything, and I dithered and lost the chance of regaining a few pips.

I cancelled the buys but the market was down to .9787 by the time I killed the long position - dithering thinking I'd catch a retrace. So I lost an extra 34.5 pips on the position after the original 20.5 my system would have taken.

Plus of course I completely missed the reverse trade because I thought it would retrace and I'd get in short higher. Instead of climbing higher, the market carried on dropped way past the exit on the missed trade at .9778'5, so I missed out on 43 pips there.

So my error account is down 77.5 pips @125000. Practically a thousand bucks, or half my skiing holiday! Verdammte Scheisse!

Edit: just in case anyone reading thinks, hell NinjaTrader is a pile of crap, it's actually my fault not NinjaTrader. I can't let NinjaTrader adjust the position when I start up each system, so I have to make sure that it's all OK myself. Each system is only aware of itself, so if I have 2 systems on GBP/USD and one is long and one is short, I can't let the system tell NinjaTrader to fix its position in the market - the least problem with that is a waste of commissions and at worst I hate to think - plus it wouldn't save me any time checking up on the positions and orders either.

What I need is an overview system which doesn't trade but just check the other systems and their positions and orders. This can apparently be done in NinjaTrader but they dont support it. i.e. I have to code against an undocumented API to get the Account info, and then the position and orders info from the Account, and then do a sanity check.
 
Last edited:
Re: Into drawdown in the error account

More damage from late night operations.

BT killed my connection for an hour or so at about half past midnight and when it came back and I had restarted my strategies, I missed a reversal on AUD/CAD.

I'd been long AUD/CAD for 2 days from .9842 with it going nowhere and my system reversed in theory while the internet connection was down, at .9821'5 so I would have taken 20.5 pips hit and gone short, but I didn't.

When checking my system I missed the same error which I've missed before, I should know to look for this. I checked the system on AUD/CAD, saw the position and the two orders but didn't clock that the orders were buys on a long position.

I didn't see anything until 12:20 by which time it was almost too late to do anything, and I dithered and lost the chance of regaining a few pips.

I cancelled the buys but the market was down to .9787 by the time I killed the long position - dithering thinking I'd catch a retrace. So I lost an extra 34.5 pips on the position after the original 20.5 my system would have taken.

Plus of course I completely missed the reverse trade because I thought it would retrace and I'd get in short higher. Instead of climbing higher, the market carried on dropped way past the exit on the missed trade at .9778'5, so I missed out on 43 pips there.

So my error account is down 77.5 pips @125000. Practically a thousand bucks, or half my skiing holiday! Verdammte Scheisse!

Edit: just in case anyone reading thinks, hell NinjaTrader is a pile of crap, it's actually my fault not NinjaTrader. I can't let NinjaTrader adjust the position when I start up each system, so I have to make sure that it's all OK myself. Each system is only aware of itself, so if I have 2 systems on GBP/USD and one is long and one is short, I can't let the system tell NinjaTrader to fix its position in the market - the least problem with that is a waste of commissions and at worst I hate to think - plus it wouldn't save me any time checking up on the positions and orders either.

What I need is an overview system which doesn't trade but just check the other systems and their positions and orders. This can apparently be done in NinjaTrader but they dont support it. i.e. I have to code against an undocumented API to get the Account info, and then the position and orders info from the Account, and then do a sanity check.

It might be a good idea to get a server hosted elsewhere to run it. Run the same system on a demo account on your own pc, and check the positions match up regularly.
 
Yikes. Adam, either you've been very unlucky or your system is too complex, whether requiring too many resources or using too many variables (or perhaps dealing too frequently)?
 
very unlucky? possibly. time will tell on that one.

system too complex? no, not at all. it's quite simple really. OK it's not a plain vanilla MA cross-over but it's not that far from it. I think I'd give it 7 out of 10 for simplicity.

too many resources? no, just BT Broadband is the resource I'm over-reliant on.

using too many variables? no, also. There's an algorithm for identifying turning points, and 2 MAs. And that's it, pretty much.

dealing too frequently? haven't tried deliberately to reduce the frequency because it all seems to work which is rare enough.

The problem is that the checking is 100% manual. Or rather, visual. I check all the markets, one by one looking for the NinjaTrader bugs in the data and verifying that any positions have a protecting stop and a target. I should check long positions have a the stop below and for short, above, but it's a fine detail and on 20 markets it's easy to forget to check. Losing a $ grand makes it more likely I'll check better next time :)
 
Re: Networking unknown unknowns

Back on the networking issues with the IB / NinjaTrader / internet issue still not put to bed.

I have to connect the trading Windows 7 workstation to talk to IB directly via the DSL modem (not router) and cut out my LAN entirely.

On the modem after saving my existing config, I'll do a full factory reset and then just set up the basics to get online, without any firewalls or DOS filtering or any other trickery the modem offers. I want to end up with just me, the modem then the Internet with no firewalls or "intelligence" in the way.

Then I'll be back to basics and I can test NinjaTrader and IB again and see if it works. I don't think it will. If it does though, then one step at a time, I add things back in - modem config, then test again, then the gateway machine and LAN and test again, then iptables firewall, and so on.

My guess is that NinjaTrader won't work even when connected direct to the modem.


Didn't work. Same error messages. Just wondering who will let me use their LAN - it's not a laptop so I won't be able to walk into an internet cafe with it, or at least I'd need a power socket and room my PC & screen on the coffee table.
 
NinjaTrader 7 General Release - no more beta, or perhaps I shouldn't be so optimistic

So far though so good.

The killer bug that they introduced in NT7-release candidate 1 which their support team was completely unable to reproduce has mysteriously vanished in the final release version 1.

The one thing that NinjaTrader are good at is making their users feel uncertain about the stability of their product. Give it a couple of weeks and if it's still gone I'll be satisfied.

In a show of total over-optimism I also checked the NinjaTrader - Interactive Brokers connectivity bug that neither NinjaTrader nor Interactive Brokers will admit is their problem and it's still there.

On Friday I was reading up about Amitrader and Neoticker with a view to trialling one of them this week because NinjaTrader had become unusable due to the killer bug just coming back again and again - normally it would only appear once or twice a day. So just as NinjaTrader reached the point of me uninstalling it, they released the new version and the bug was gone. Sunday evening restart was a dream, no crashes, no errors, no reloads required. Yesterday was fine too. So apart from the connectivity bug, NinjaTrader is running smoothly. At this rate I might get something done this week instead of sitting here stroking NinjaTrader and mopping its brow.
 
Forex data

I just discovered that I had tick data from back to 1998 for AUD/JPY, CHF/JPY and GBP/CHF which I hadn't loaded from DTC.

It takes about 4 hours to load each instrument so now it's done (and now I have a "stable" version of NinjaTrader) I'm going to do a back-up of it all.

I should also be able to load up data from a Russian site forexite.com via Forex Tester.com who claim that it's the best free data available because it's just from one source and not integrated with the ticks from multiple other providers. Sounds good in principle but my guess is that it's actually not as representative of the whole forex market as you might want. A couple of backtests on it will show whether it's any good. The attraction is that they have data back to 2001 for EUR/CAD and other crosses and also if it proves more similar to IB data than DTC, then I'm onto something useful.
 
The show goes on.

I see Travis is inspecting an EOD trading system on Collective2 called TurningPoints, which is what my main system is called. I wonder what my system would be like tested on EOD data on all those traded markets. I can't test it straight away because I haven't checked that the old continuous contracts that I did back in Feb last are still on my hard drive, let alone actually useable.

I'll put that down on the list of things to do.

The Turning Points system is working moderately OK at the moment. It made a monthly equity high on Tuesday at £37K in the aftermath of Friday's US unemployment data.

That day got so stressful so quickly with the NinjaTrader bug killing my ability to trade. About an hour before non-farm payrolls was due, I had just got all my systems back online but I had missed the start of the hourly bar when Turning Points makes its entries, so I was checking through the logs to see what trades I had just missed and the system claimed contrary to what it actually had done that this time it was long since the night before.

Like Sorceror's Apprentice that I am, I started messing around trying to get in to the EUR/USD market to take the last few pips profit left on the table below the limit profit target. Of course the first time I tried, the market crept down instead and hit my chicken stop. When I saw that at about 15 mins before the data was due to come out, it had gone back up again to where I'd entered and the profit target was still sitting there, that the system had automatically entered thinking it was long.

So I tried again, only this time NinjaTrader died on me, I restarted everything and now the system decided that it had hit its target and was flat. And I was long and the profit target sell order was still in place just above the market. By a stroke of luck I thought I could make a few pips more because the market was stepping upwards nicely on the 5 min chart, and then non-farm payrolls came out and the next thing I knew I exited at 60 ticks profit.

Thankfully because I was caned for 40 pips on USD/JPY and got whipsawed for 40 and 40 on CHF/JPY.

Shame I hadn't gone short CAD/CHF which fell 200 pips that hour.

What annoyed me more though was the next stunt that NinjaTrader pulled and I couldn't work out why it did it but that was the old version so I've decided not to worry about it - basically NinjaTrader crashed again and on the restart after missing another hourly bar ticking over, the system decided that yes, that was actually a turning point for several markets. So I had theoretical entries at the 15:00 bar Open in six markets and it was now half an hour later and they were all retracing like bungee jumpers. I decided to give it two hours to retrace before I put anything on and saved myself a few hundred dollars, although a couple of markets never looked back.

So that was Friday - too much going on to bother working out how much it cost me and where my equity in my account would be now if I had a stable trading platform and the ability to stop myself playing under the guise of getting the systems running.

I figure there's something about the Turning Points reaction to big bars that can be modified profitably, but I haven't worked out what. Just putting in a mechanism to make it hold off entering a position after a massive move sounds crass - it might be profitable. Definitely backtestable. But I think there is something eluding me about the whole thing. Maybe it would work better on tick-based bars rather than hourly bars - although I don't trust IB's throttling and compression algorithm on their data feed to let me use that reliable, even if I could test it.
 
Backups

Finally took my head out of the sand and did a backup of my historical data to a removable harddrive over USB. Took long enough despite being 23 Gig. It ran for 72 hours. Either the USB port I am using is one of the slow obsolete ones on the machine or I should use a different method to copy it over - maybe zipping it first will help.

For some reason NinjaTrader decided to go with some kind of hybrid file-based database. The database directory contains over 2 million files.

That's mostly down to tick data from DTC no doubt.

Anyway, backup done for this month. I should be doing this on the last weekend of every month - that's the intention anyhow despite this being the first I've done since getting the PC back in May.
 
Re: NinjaTrader 7 General Release - no more beta, or perhaps I shouldn't be so optimi

So far though so good.

The killer bug that they introduced in NT7-release candidate 1 which their support team was completely unable to reproduce has mysteriously vanished in the final release version 1.

The bug is back.

This is bad. It's not as bad as Friday when I couldn't get things running properly, but it's bad as in a big disappointment that the last 3 days without the bug were just a fluke.

I think that NinjaTrader 7 is just a can of worms.

I'm now going to do 3 things:

(1) re-open the forum thread at NinjaTrader which they closed and marked as "old beta thread" - if they don't look like they're going to find the bug, I'll tell them to get the vaseline out, to make it less painful for them when I give them back their license
(2) evaluate Amibroker and
(3) evaluate Neoticker.
 
Backtesting against last price, running live against bid/ask

The spread on the GBP/CHF caught me out yesterday after stopping and starting NinjaTrader.

I was short GBP/CHF and I had my profit target at 1.5475. Earlier, it had dropped to that level and the bid traded at 75, but the ask never did although it was only 3 pips and the market rose again.

On re-initialization, NinjaTrader fed the historical data through the trading system and the low for the bar was 1.5475 so it decided I'd hit my target and closed the position.

The market retraced to 1.5515 by the time I stopped and started NinjaTrader, so I had to close the position. Otherwise I'd still be short.

I think this happens about once every couple of weeks, or about 1 every 100 trades. I think I just have to ignore it because I'm always going to be testing against last and not bid/ask.
 
Re: Backups

Finally took my head out of the sand and did a backup of my historical data to a removable harddrive over USB. Took long enough despite being 23 Gig. It ran for 72 hours. Either the USB port I am using is one of the slow obsolete ones on the machine or I should use a different method to copy it over - maybe zipping it first will help.

What you could consider (I don't know if you already do this) is having a separate PC on which you run your robot. You can then access this PC either directly or remotely from another machine, using TeamViewer (which is free). It's then easy to copy files between the two machines, so that's one element of backup taken care of.
 
Re: Networking unknown unknowns

.....
The latest theory from a networking mailing list I'm on is that BT is throttling my broadband connection.

So if this doesn't work, the next step is to try the workstation from someone else's LAN. If that works, then it depends who their ISP is, although hopefully whatever I'll be closer to an answer.

....

Probably less work than switching ISP.

I took my computer around to a friend's house and plugged in to their ISP - O2 - and ran up IB and NinjaTrader. No networking issues. No "connection broken panic" from NinjaTrader or IB.

I took the computer back home and ran it all up again and tried it again - "connection broken panic".

So, what does that mean?

First of all, NnjaTrader said the error must be with IB's connectivity because it works for everyone else and they even reviewed the code in their IB connection module and decided it couldn't be a fault with NinjaTrader.

Secondly, InteractiveBrokers asked me to check whether I get the same errors when I load up the charts in IB. I don't. They only appear when I load up NinjaTrader charts. IB then saw that there are a huge number of IB errors saying "Invalid date format" in the logs. So IB concluded that NinjaTrader is making bad data requests and this is causing the IB server to disconnect. That sounded implausible, I mean, why disconnect? Aren't error messages enough? This is their support statement on the issue:

Base on the log file, it appear that Ninja Trader was submitting invalid historical data request periodically. It is feasible that connection between TWS and NT immediately due to countless invalid request from Ninja Trader.
For further investigation, I strongly recommend that you connect TWS and Ninja Trader, however do not request any information in NT yet. Increasingly, request one contract at a time until receiving the disconnection message again. It is feasible that the core issue is only related to one of the existing contracts.

These guys are Swiss, hence the bad English.

So, now that I have discovered that NinjaTrader will connect without problem to IB on O2, it invalidates what IB are saying.

However it still doesn't mean IB is the problem.

What I have tested so far means shows that the problem is that IB is unable to make a robust 24*7 connection via my BT broadband. Sometimes it can, sometimes it can't.

It's not my LAN or my software or my hardware because I've swopped it all out and tried it on different machines with different modems and different configurations. Actually went and bought a new modem for the purpose.

The best theory then is that BT Broadband are doing 'profile shaping' or bandwidth throttling on my connection which accounts for the periodic nature of the fault. So my traffic is passing through one of the BT servers where they are intentionally dropping packets to reduce my bandwidth. In normal circumstances, the Internet Protocol error correction process should make this invisible to the user, but in this case there is something else wrong on my network pathway across the internet to IB's server farm that is killing the error correction process.

But why just me? Why doesn't anyone else get this problem? There must be thousands of people using IB and NinjaTrader, but I'm the only one reporting it.

I have work-around for this bug, but I also have another bug with NinjaTrader with the work-around where the loading of data hangs. I think this may be the same network problem.

So I need a different ISP.

I should be able to prove this theory by checking where on the network pathway BT Broadband is dropping my packets, and where the error correction packets are going missing.
 
Networking known unknowns

Now asked BT direct if they are throttling my connection and they said no.

I checked my usage and it's about 15Gigs a month which doesn't put me on their radar as far as punitive throttling is concerned. Apparently P2P and other file sharing stuff goes way beyond that sort of usage.

But this doesn't let BT off the hook yet. BT could be throttling my packets (poor little ****ers) just as part of the routine management of the broadband down my street.

Apart from approaching IB Support again and licking their boots to get some kind of attention from them, I can try to identify the hosts on my network pathway to their server which is failing when I get these historical data server disconnects. That means spending 10 mins with ping trying to find the point of failure at 8 o'clock every evening.

Even then I have no idea whether it would be under BT's control, and if it were, whether they'd do anything about it.
 
Where's that system gone!?!?

I'm having trouble getting the Auld Three Duckees system to work.

After way too long polishing turds, I thought I'd go back to basics and resurrect the original 3Ducks that I traded for a month in September.

I have a slight problem though. I can't find it. It looks like I have edited the original system script beyond recognition and the back-up I thought I had is actually not the original either.

So I have a directory full of excel spreadsheets of results but no system.

Logically I should be able to re-invent it but this is no way to work. I thought I had a completely foolproof back-up method storing the data on two machines and removable media - but as someone said, when designing something completely fool-proof, never underestimate the ingenuity of complete fools.

I must be close to the original system though because my current incarnation is hopeless on short trades. Or was it long trades that it was hopeless at? ****!

Just bought Oxygene by Jean-Michel Jarre. What a classic.
i-1802.jpg
 
Last edited:
Top