Going live Monday 23rd

rnicoll

Established member
Messages
500
Likes
14
I've been working on my first mechanical system for a while now, been coding it against Interactive Broker's API for the last week or so. So far, so good, mostly needs error handling wrapped up now. Also some sort of UI (don't have any way of bringing it to an neat stop yet!). Planning on going live on the 23rd, any major hiccups depending.

1. Wish me luck?
2. Any last minute advice?
 
I've been working on my first mechanical system for a while now, been coding it against Interactive Broker's API for the last week or so. So far, so good, mostly needs error handling wrapped up now. Also some sort of UI (don't have any way of bringing it to an neat stop yet!). Planning on going live on the 23rd, any major hiccups depending.

1. Wish me luck?
2. Any last minute advice?

1. Good luck
2. Make sure you do plenty of testing before trading it on a live account. By testing, I don't mean that you're strategy is profitable, but testing to make sure you've covered all the technical scenarios with the API connection. Possible scenarios include:

- What happens when the connection dies, do your trades keep running?
- When you manage to reconnect, can you still control the trades with the system, or do you have to manually manage them?
- What's your backup plan if you lose connectivity due to failed internet connection or power cut? (I sometimes end up using free wifi in McDonalds! Not great :cry:)
 
Keeping in mind I'll be on hand to watch the system all day...

Loss of connectivity will trigger some sort of "Ack, HELP!" from the system. I'll have IB's phone number to hand, and be able to call them to close out the positions manually. Trades will be placed with stop loss orders as well, just in case.
The system is currently designed to start and end with a flat account. That will change later, but for now it will need flattening if it loses connectivity.
Oh, and I have a UPS incase of power cut :)

Edit:

Actually, the bigger concern is making sure order prices are sane, and dealing with partial fills. Both are giving me major headaches; too generous with the order price and the market will massacre me. Too cautious, the trades won't get through. Partial fills... should the system change price, or just forget the unfilled part. How long should it wait for a complete fill. Etc. etc. etc.
 
Have you tried testing your UPS? I pulled the plug on mine recently only to find that it wasn't powerful enough to supply the volts to my trading server and monitors. Totally screwed up all of my historic data database....one of those things I guess.:-0 I also didn't have my DSL router/wifi plugged into anyway, so lost the internet connection regardless.

As for the issues with the prices, partial fills etc, I guess one of the ways to handle this would be to run a series of backtests and simulate getting different fills, and also check whether the strategy is still profitable with different levels of slippage.

What language/dev tools have you used to create the system?
 
Have you tried testing your UPS? I pulled the plug on mine recently only to find that it wasn't powerful enough to supply the volts to my trading server and monitors. Totally screwed up all of my historic data database....one of those things I guess.:-0 I also didn't have my DSL router/wifi plugged into anyway, so lost the internet connection regardless.

As for the issues with the prices, partial fills etc, I guess one of the ways to handle this would be to run a series of backtests and simulate getting different fills, and also check whether the strategy is still profitable with different levels of slippage.

What language/dev tools have you used to create the system?

The UPS is for my ADSL router, I'll be working from a laptop :)

Been working with Java. Build environment is plain old command line tools (ant, basically), and a subversion repository for version tracking. One of these days I'll learn an IDE, I swear, but not today :LOL:
 
The UPS is for my ADSL router, I'll be working from a laptop :)

Been working with Java. Build environment is plain old command line tools (ant, basically), and a subversion repository for version tracking. One of these days I'll learn an IDE, I swear, but not today :LOL:

Only last week I switched to using an APC 1500 UPS:

APC Smart-UPS 1500VA USB & Serial SUA1500I - PC World Business Online Store UK - Buy The Best Deals Online.

Seem to keep the trading workstation, server and two 24" screens running for 10 minutes. Enough to close everything down gracefully.

I originally starting coding my systems up using VB and C++, but then switched to using NinjaTrader as it has native connections to IB and MBTrading, leaving me a bit more time to spend tweaking/testing the strategies rather than troubleshooting IP sockets.
 
Only last week I switched to using an APC 1500 UPS:

APC Smart-UPS 1500VA USB & Serial SUA1500I - PC World Business Online Store UK - Buy The Best Deals Online.

Seem to keep the trading workstation, server and two 24" screens running for 10 minutes. Enough to close everything down gracefully.

I originally starting coding my systems up using VB and C++, but then switched to using NinjaTrader as it has native connections to IB and MBTrading, leaving me a bit more time to spend tweaking/testing the strategies rather than troubleshooting IP sockets.

I've got a 650VA APC UPS at home (keep in mind, it's for the ADSL router only), but we've got one of the 1500VAs around at work, it's definitely nice kit.

NinjaTrader is nice, but I don't work in Windows most of the time, so coding my own stuff seemed a better solution. Wish they'd release a Mac/Linux version (it's C# based, so should be easy, but nevermind). Meantime, having my own tool chain has a few advantages; for example, I log everything back to a database, building far more detailed activity logs than NinjaTrader does.
 
Blah. Not going to make it. I've got all the code written, but it's not nearly tested enough *sigh* Ah well, I'll have results from running it on an IB paper trading account over the next week, for next weekend, if anyone's interested :)
 
Sure... post away, it's an interesting thread.....there are many who say mechanical trading is pants (probably because they will never have a hope of doing it )...I tend to disagree...i'm pretty sure it's the future. :) with a watchful eye on it !!

cv
 
Sure... post away, it's an interesting thread.....there are many who say mechanical trading is pants (probably because they will never have a hope of doing it )...I tend to disagree...i'm pretty sure it's the future. :) with a watchful eye on it !!

I think a lot of people assume that if mechanical trading can work at all, then it should be possible to produce a system that works across all timescales. My thought is that while this may be theoretically possible, it would require a system dramatically ahead of everyone else with an interest in the market. As it is, I expect any mechanical system I write to become obsolete within a couple of years, and to continually be working on new systems to replace them as they go out of date. Still, if I can make a good, reliable return from this, and it doesn't take up too much time, I think it's good :)
 
I am absolutely convinced that the methodology i'm working on ( 6 years in the making ) will never be obsolete as it involves all the time frames to a greater or lesser degree and this is why I view it as a permanent edge...filtering to reduce the number of signals is the key to it...words like confluent, strength, weakness,time,expectancy....and quite a few very new words as a part of this methodology is unique I believe and deserves it's own language.

I don't programme or code btw.

cv
 
Definitely with you on reducing number of signals. My first thoughts on this more or less was a "kitchen sink" approach. Throw it all in, see what happens.

In short, never got anywhere, took too long to code, and it rapidly became apparent the approach had major flaws. To start with, far too many indicators are basically the same data presented differently, which means that they don't actually work better together; the less statistically accurate versions drag down the overall accuracy, while the number of them mostly eats CPU time.

It's also very tempting, I find, to look for signals that filter out the worst trades, and I quickly discovered that also filtered out so many good trades that overall I made less money.
 
USDCAD week ending 20th June 2008

Before I go to sleep for the night... here's the trades out of NinjaTrader, for my system as implemented in NT. Having been doing more tests, I'm getting stabler results from USDCAD than anything else, so I've used it for this demo.

Anyone want to give me feedback on whether these trades look credible, or is NT being overly optimistic about getting them executed?
 

Attachments

  • USDCADwe20062008.xls
    104 KB · Views: 264
Epic fail.

Backfill handler broke on first startup attempt, and hung the entire order entry system.

Then it turns out I got some of the conditions to trade on, wrong.

And then it turns out the system doesn't handle it at all if a trade fails, including trying to then close out positions it never opened.

I'll be back later. Much later.
 
Okay, not that much later then.

It's unstable, has massive issues in that:

1. It and/or TWS don't stay up for too long at a time.
2. It can't recover from TWS, database or itself quitting.
3. Historical data loading breaks at weekends.

BUT it seems to be working. Got it stable enough to test for most of the last day, trades attached for the curious. Trades are next to their closing trade; any without a closing trade indicates something broke before the trade exited.

For those who can't be bothered with the spreadsheet, it made about 30 trades, for a total of 77 pips profit, over about 36 hours. One trade went wrong, losing 9 pips, and the profit/loss does not take into account trades I had to clear out manually.

I'll be back with results over a longer time period, once it's stabler.
 

Attachments

  • 26062008.xls
    110 KB · Views: 224
Okay. Historical data loading fixed. Recovery, not so much fixed. Also turns out I completely screwed up implementing my strategy, and fell over a much better strategy as a result. Bit weird, I'm going to go with it though. Today has been a bit of a shambles; the data feed died at 5am, and so it was down for 3 hours until I got up and poked it. It traded EUR/NZD about 20 minutes ago, and in my excitement to check how the trade was going I closed the program and had to manually sell the position and restart. Made 20NZD though.

My bug list now reads:

1. Need to check handling of failed trades.
2. Need to maintain state on shutdown.
3. Consider maximum spread limits on trades.
4. Need to be able to recover from connection to trading application closing.
5. Orders are immediate-or-cancel, which IB don't support for Forex, needs to be a short-term good-til-date order.
6. Permanent order ID not logged.
7. Have a time-based stop order maintained by the strategy incase of connection failure.

So, looks like I've got my work cut out for me!
 
Anyone still reading this thread, or should I be quiet?

Trades since Sunday night, attached. I'll discuss them in a second. Been working on the trading system itself, and there's some changes to make it more reliable; primarily, it's now using asymmetric Bollinger Bands to generate entry/exit points, still on minute bars, with confirmation by use of a longer SMA.

Trades are a bit odd. I've been running it on EUR/AUD, EUR/NZD and USD/CAD (all with the same parameters, BTW). The only trade yesterday was EUR/NZD, and I inadvertantly closed the program while checking on the trade progress. Closed it manually for a 2 pip profit, though. Today's been more sensible, with a mix of EUR/AUD and USD/CAD trades, but nothing on EUR/NZD. Generally I'm fairly pleased though, as that's about 50 pips in a little under 48 hours, and frankly Monday's are looking like they're always going to be a little weird.

Edit: Oh, yes, and the system does have a bias towards going "long" at the moment. It's a side-effect of what I've done to the Bollinger bands in the most recent revision. I'm getting a week's data with this version, and will fix it for next week to compare the two.
 

Attachments

  • 01072008.xls
    109 KB · Views: 255
Good to hear I have an audience :)

It made another 6 pips trading USD/CAD before market close. Opened an EUR/NZD position just before 8pm, and... well, it turns out all NZD crosses close for an extra two hours, at least if you're trading with Interactive Brokers. What was a great trade (up 15-ish pips) before market close is now a disaster at -30-ish.

I've now modified the code to not open positions within 55 minutes of market close, and to close out all positions at 4 minutes to the hour. Also finally changed the order system over from using immediate-or-cancel orders that IB don't actually support for Forex, to Good-Till-Date with a very short lifespan.
 
A very interesting thread:) I've been giving some consideration to doing something like this however I'd probably need to expand my ability to code a bit first.
 
Top