Going live Monday 23rd

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.

Do you mean writing your own algorithm into an existing platform, or writing a platform for yourself? If you're going to write a platform, I'd strongly suggest looking over the architecture of jsystemtrader - Google Code and jbooktrader - Google Code. You should also try making a few strategies under NinjaTrader, get a feel for how they've designed things.

A few major points to think about:

1. Everything's asynchronous. So, you don't ask for a price then wait for it back, you ask for a price and tell the API where to send it once it has arrived. This means that you're not blocking other bits of your system waiting for a response. Takes a while to get your head around, though.
2. Do you want to maintain state? For example, if the application crashes, do you want to be able to restart it and it loads where it was from a file/database? I've personally gone with not for now, as it's easier for me to just flatten the account and start again, but it'll be in a later revision.
3. Your system loses its data feed for 5 minutes. What happens next? 10 minutes? 15? I'm currently looking at having the contract manager put good-after-time orders in to close, and have it move them forwards as data comes in, so in case of a break in connectivity the position auto-closes.
4. What's your interface going to be? Graphical interfaces are popular, but if you're running it as a "fire-and-forget" application, you may want to consider designing it to work from the command line. More intricate options could include a web interface, RMI/RPC interface, or an instant messaging interface (but that's a security minefield).


Oh, today's screwup; was changing the order system around to use good-til-date orders with a very short lifespan (1 minute), instead of fill-or-kill (because IB don't actually support fill-or-kill for forex, even if the paper trading version allows it). Managed to have it as 1 minute from start of bar... and of course I'm using 1 minute bars.

Oops.

Edit: Oh, and I'll be releasing my platform code towards the end of the month, any major hiccups depending.
 
Last edited:
I expect I'll probably start off by writing my own algorithm for somebody else platform.

If I'm quite honest I've not given much serious thought to it yet other than to decide that it could be a worthwhile venture (in the sense that it would be interesting, challenging and, if I'm lucky, financially rewarding).

My first step would be to create an algorithm, thoughroughly back test it, forward test it and then get it to work successfully with a live data feed before finally getting it to comunicate with a broker...long road ahead:LOL:

Have you any suggestions for sources of historical data? I'm trying to find a source (or better yet, sources) with output similar to yahoo's daily historical data but on a 1 minute time frame. Idealy I'd like to have 2 or more sources of data for the major forex pairs but for now one source and one pair would be a start:whistling
 
I expect I'll probably start off by writing my own algorithm for somebody else platform.

If I'm quite honest I've not given much serious thought to it yet other than to decide that it could be a worthwhile venture (in the sense that it would be interesting, challenging and, if I'm lucky, financially rewarding).

My first step would be to create an algorithm, thoughroughly back test it, forward test it and then get it to work successfully with a live data feed before finally getting it to comunicate with a broker...long road ahead:LOL:

Have you any suggestions for sources of historical data? I'm trying to find a source (or better yet, sources) with output similar to yahoo's daily historical data but on a 1 minute time frame. Idealy I'd like to have 2 or more sources of data for the major forex pairs but for now one source and one pair would be a start:whistling

I've heard good things about IQFeed and OpenTick. OpenTick is cheap/free, but mixed quality and not currently taking new applications. I started with BarChart.com, but their data apppears to have holes in it and there's no high/low values on minute bars. Interactive Brokers give you backdata at minute intervals from at least the start of the year, for free, if you get an account with them, but requires a minimum deposit of $10,000 or equivalent.
 
I've heard good things about IQFeed and OpenTick. OpenTick is cheap/free, but mixed quality and not currently taking new applications. I started with BarChart.com, but their data apppears to have holes in it and there's no high/low values on minute bars. Interactive Brokers give you backdata at minute intervals from at least the start of the year, for free, if you get an account with them, but requires a minimum deposit of $10,000 or equivalent.

Thanks for that. IB data is going to be out of the question but the others sound like they could be good places to start.

Thanks.
 
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?

Good luck.

My advice - remove all other internet distractions other than the chart, and your broker screen - forums, facebook, youtube etc. Just don't visit them while you are working, otherwise you will be distracted.

If your system is robust enough, you will succeed.

Mine is. I'm at the stage where all i need to do is (as much as possible) remove all emotion/worry/hesitiation from my trading. Because, i KNOW that what i do works consistently well enough, I have proved this with time, experience and performance, while paper trading and live trading. All i need to do now is follow my simple rules, and pull the trigger when X or Y happens, to enter and exit.
I still get doubts, worry, hesitate panic from time to time, but my performance shows me that this is not justified. I'm working on becoming more robotic, or colder in my mindset when in trades, so that I do not make the experience any more stressful than it needs to be, thus hopefully helping to "optimise" my pip gains performance also.
 
Good luck.

My advice - remove all other internet distractions other than the chart, and your broker screen - forums, facebook, youtube etc. Just don't visit them while you are working, otherwise you will be distracted.

If your system is robust enough, you will succeed.

Mine is. I'm at the stage where all i need to do is (as much as possible) remove all emotion/worry/hesitiation from my trading. Because, i KNOW that what i do works consistently well enough, I have proved this with time, experience and performance, while paper trading and live trading. All i need to do now is follow my simple rules, and pull the trigger when X or Y happens, to enter and exit.
I still get doubts, worry, hesitate panic from time to time, but my performance shows me that this is not justified. I'm working on becoming more robotic, or colder in my mindset when in trades, so that I do not make the experience any more stressful than it needs to be, thus hopefully helping to "optimise" my pip gains performance also.

One of the major advantages of having coded my own trading platform is that there is no hesitation, no distraction, just an automated rule-following system. I find out it's traded when it sends me a text message confirming the final trade price.
 
Boom!

Wow, today's trade wrapup really shows how much I screwed up overnight.

Okay, trades without a fill price didn't execute. I've looked up some approximate prices for the trades, and they look good, so... yeah, that was painful.

What's really interesting is the EUR/NZD at 16:49-17:36; I traded manually along with that one, and made 3 pips. Difference is, I used limit orders, the trading platform uses market orders.

I now have 15 NZD, minus about £2.40 commission, and a general uncertainty what to do with them.

Oh, and I was watching the USD/CAD trade at 16:50 too; that rather well demonstrated why this is a stop-less system, as it bounced off something like 1.0090, 46 pips down, before finished a "mere" 13 pips down.

Still, screwups aside, 28 pips on the day, which I think is a convincing vote of confidence for my system's ability to overcome my ability to shoot myself in the foot.
 

Attachments

  • 02072008.xls
    108.5 KB · Views: 222
For those of you tracking the currency markets, you may have just seen they've all headed off in random directions. My system appears to have more or less exploded violently; I'm waiting for it to come to a stop before I assess the damage, but it ain't looking pretty.

I'll give you a quick rundown of the day so far. Added EUR/USD and GBP/USD to the currency pairs it trades, just to see how they do. There was a GBP/USD trade earlier today, and that lost money, but given it's not set up for GBP/USD that's not a big surprise.

So, I'm sitting around, thinking this is quite quiet, and a trade pops up. Then another. And another. Suddenly it's got trades in for all 5 currency pairs it tracks. Look at the currency markets, and they're basically exploding. Not good at all.

Where we are currently. Of the currencies it regularly trades, it's lost 7 pips USD/CAD and closed out. EUR/AUD has lost 74 pips and is still in the market. EUR/NZD has lost 80-ish pips and is still in the market.

Of the added pair, EUR/USD closed while I was typing, for a 106 pip loss, and GBP/USD _just_ closed for 17 pip loss.

I'll go more into detail on what next at the end of the day's wrapup.
 
Sorry to hear that rnicoll. Sounds messy. Thanks for keeping us updated though, it'll be interesting to hear exactly what went wrong.
 
Sorry to hear that rnicoll. Sounds messy. Thanks for keeping us updated though, it'll be interesting to hear exactly what went wrong.

Interesting bit is, today is not where it went wrong. The issue is not the loss; they're bad, but not catastrophic. The problem is that it should have been making more over the last few days, in order to counter losses on this scale.

Removing the pairs that should never have been there, it finished the day 271 points down. Now, that sounds bad, however keep in mind it's about 5 day's profit. So, as long as this doesn't happen more than about 1 day in 7, it's still good.

Looking over the chart, I'm thinking that if I can get the silly thing to detect massive swings and cut its losses early, as opposed to when the market is likely to swing back around again, it should be okay.

I'll be away a few days, need to rewrite a bunch of stuff...
 
Okay. I had some numbers wrong. VERY WRONG. It's not catastrophic, but it's going to be more than a couple of days.

However, I have a rather nice example strategy for the curious, even if it is broken. Given I've been wanting to show people what the platform looks like for a while, code's attached. This is the version that's been running this week, and human directed may even make money.

Right, release notes:

1. There aren't any instructions because I don't want people using it without looking through the code. It's there to give a running start to anyone who wants to write their own strategy engine, not be a complete solution by any means.
2. You'll need HSQLDB for the database and Interactive Broker's API ( Application Programming Interfaces ) if you want to compile it. For the unit tests, you'll need http://www.junit.org/ . I may have left it asking for JCommon and JFreeChart; you don't need either, I never got around to adding charting tools.
3. I don't want patches. The code is FAR too in flux for them to be useful. Structural feedback would be appreciated, though.
4. Note the license is GPL version 2. Not 2 or above, 2. I normally go for more permissive licenses than GPL, but don't want this used directly against me. GPL 3 is far too nit picky for my tastes though.

I'd appreciate a yell here or by PM if you find the code useful, so I know it's worth writing up docs and releasing later versions.

As for my system... I need to rework bits of it, and it needs about 3 months backtesting before it goes live, it looks like. I'm going to keep at it, but for now I need to catch up with other projects that haven't been getting my full attention. I'll start a new thread when I've got major news.

Edit: Not 3 months backtesting, 3 months forward testing.
 

Attachments

  • Forex Quant-04072008.zip
    108.4 KB · Views: 119
Last edited:
I will have a look at your engine over the next few weeks (when I get back from holiday). I am just starting out on my own work; seeing someone else getting their own house in order is inspiring.

I am going for python and C++ for performance critical bits (if this ever gets important). An important consideration for me is the availability of good mathematical libraries to help with statistical calculation and optimization.

Look forward to talking more about this...
 
I will have a look at your engine over the next few weeks (when I get back from holiday). I am just starting out on my own work; seeing someone else getting their own house in order is inspiring.

I am going for python and C++ for performance critical bits (if this ever gets important). An important consideration for me is the availability of good mathematical libraries to help with statistical calculation and optimization.

Look forward to talking more about this...

I rather hijacked someone else's thread, over at http://www.trade2win.com/boards/forex-discussion/34038-can-mechanical-forex-systems-work.html - that's probably your best place to continue reading.

Give me a PM when you're about to start looking over my engine, it's getting rather heavily reworked for a new strategy right now, and I'll post the updated version somewhere useful.
 
Top