A small matter of programming

Gratulations :) I spent the last months working on something similar, albeit more visual. FInally (.NET 4.0 beta 2 out) things start falling into place ;) The framework works, I now have a basic T&S and DOM window, order management is coming next week ;)

This is an interesting trip to take ;)
 
Gratulations :) I spent the last months working on something similar, albeit more visual. FInally (.NET 4.0 beta 2 out) things start falling into place ;) The framework works, I now have a basic T&S and DOM window, order management is coming next week ;)

This is an interesting trip to take ;)

I'm assuming C# as a language if you're .Net based? How are you finding it? With Windows 7 out I'm considering moving from Linux to Windows as an OS (especially as finding Linux compatible software is a nightmare), and C# would be a fairly obvious leap to make at the same time...
 
Well, I MAY Not be the best person to ask as I started with C# before it was publicly known and was widelay acknoledged as expert.

I love it ;) Seriously - it is a great system. THe LANGUAGE is very nice, in front of java (real properties, the stuff they do with generics is lightyears before java, and function pointers / LINQ is really innovative).

Add to that a really good runtime (NOT pointing fingers at Java NOW - they took long enough - more in the direction of other legacy langauges like Visual Basic) and really nice frameworks and - i like it.

It is hugh, though. MS adds some really nice stuff. I just get into WPF for my user interface - vector / XML based (similar approach to HTML, just a LOT more powerfull) - and am extremely burdened (lots to learn) and thrilled.

If you try going .NET go 4.0 beta 2 - by the time you have something to give away, it is final, and the beta is well supported by microsoft ;)

I personally like it. Visual Studio is a worthy ide to add (not saying the best, jsut saying it is not the weak point in the line anymore with 2010).

Try it out ;)

And talking of Windows 7 - another love point for me. I took Vista because "well, yeah". It was "nice", but mostly it was not XP (standard look - ugly in my eyes). Windows 7 I really like. ESPECIALLY if you go .NET 4.0 and use the new shell integration API you can really do some nice stuff.
 
Well, I MAY Not be the best person to ask as I started with C# before it was publicly known and was widelay acknoledged as expert.

I love it ;) Seriously - it is a great system. THe LANGUAGE is very nice, in front of java (real properties, the stuff they do with generics is lightyears before java, and function pointers / LINQ is really innovative).

Add to that a really good runtime (NOT pointing fingers at Java NOW - they took long enough - more in the direction of other legacy langauges like Visual Basic) and really nice frameworks and - i like it.

It is hugh, though. MS adds some really nice stuff. I just get into WPF for my user interface - vector / XML based (similar approach to HTML, just a LOT more powerfull) - and am extremely burdened (lots to learn) and thrilled.

If you try going .NET go 4.0 beta 2 - by the time you have something to give away, it is final, and the beta is well supported by microsoft ;)

I personally like it. Visual Studio is a worthy ide to add (not saying the best, jsut saying it is not the weak point in the line anymore with 2010).

Try it out ;)

And talking of Windows 7 - another love point for me. I took Vista because "well, yeah". It was "nice", but mostly it was not XP (standard look - ugly in my eyes). Windows 7 I really like. ESPECIALLY if you go .NET 4.0 and use the new shell integration API you can really do some nice stuff.

To be honest, will probably go with Mono initially; until I have this reliably working, I don't want to be sinking too much money in to it, and ensuring cross-platform compatibility is still a useful feature to have. Also, as I have it mostly working in Java, initial port will mostly involve just translating as directly to C# as I can, and then I'll worry about nice language features later.

Still, good to hear it's a good idea! :)
 
Position tracking done, a lot of the error handling code is in too. UI needs rewriting from scratch (may just get pushed back until I've moved to C#). Half the stuff I want for the strategy isn't written, but given I'll have to stop doing public releases once it's nearing completion that's no bad thing.

Think tomorrow I'll try hacking away at some more of the problems listed in my notes, and see if I can get backtesting to work again...
 
UI tip: on C# USE WPF AND .NET 4.0 ;) Seriously ;) I did a DOM and a T&S with it the last 2 days. Both still have performance problems, but I know how to fix them.... just fighting the XMAL syntax.

Both are "model C# file" and "visual XAML file", with NO (!) link between them - yo can change the look, even the color highlighting without touching the C#.

Performance is tricky - on my T&S so far due to the extensive scrolling. THat being said, I know how to push the lines to the graphics card so they dont get redawrn (4.0 feature) but just rerendered.... and that will kick it.

I am MADLY in love with WPF by now ;) SO much better than all the rest.
 
NetTecture, you're beginning to scare me... Gave in to the need for a usable UI, so here's the before and after images. Before:
foxquant_old.png


After:
foxquant_new.png


Error messages are because it's the weekend, so I can only test with the demo version o my broker's software (not the live version) :(
 
This morning's test trades attached. As always, these are done on Interactive Broker's paper trading platform. In short... 25.5 pips up, 3/3 trades profitable. I'm amazed, frankly.

The execution code is showing some serious stability issues, though. Mostly it needs a whole bunch of code to handle reverting to flat in case of a problem.
 

Attachments

  • trades-20091102.xls
    6.5 KB · Views: 242
The rest of Monday's tests did not go so well, alas. Anyway, moving on from getting tangled into whether tests of a half-complete system work...

The trading engine now double checks orders have successfully canceled before it re-enters the market, when changing direction. This means it's at least a lot closer to producing the correct effects when it trades. Trade reporting for public consumption is partially in place now; more details on that when it's ready.

Next step is to go back over the pricing code, have it produce correct values at all times (it was originally designed just to ensure the execution code works), then more user interface work. I also want to put in place code to block going long/short more than once on a single currency, at any point in time. This is another risk management tool, so it can't end up essentially doubling up on losses.
 
Last changes for this week have involved re-writing the pricing code to use fixed precision numbers instead of floating point. The idea is that as the precision on prices doesn't change, representing prices with numerical values that can change precision doesn't make a lot of sense. This simplifies the strategy and indicator code by no longer requiring them to do nearly as much work to round values correctly, although it moves complexity out to the interface code that receives in prices and sends out orders (as it needs to do a conversion step each way).

So far, this mostly seems to have worked, but has a lot of edge issues. Plan for Monday is to go over the calculation code in detail and ensure all the values are coming out correctly at each stage.
 
May I ask how you encode prices now? Especially given that some stuff may not round to "ticks" (moving averages may fall between) and so it may introduce rounding errors ;)
 
May I ask how you encode prices now? Especially given that some stuff may not round to "ticks" (moving averages may fall between) and so it may introduce rounding errors ;)

I'm only using fixed point for prices,not numbers derived from them. So the values come in, are converted to a number of ticks, passed to the strategy, which then passes them along to the indicator. For something like SMA it sums the prices while keeping them as fixed point, but converts across to double for the division step. It rounds back into a valid price for using the SMA directly, but keeps the value as floating point if it's to be reused by other indicators (Bollinger Bands or similar).
 
Slowly converting it over to Windows. Got the build environment working, got the basic version to run, but it seems to be hanging! *sigh*

Next I need to sort a good development environment under Windows and see if I can figure out what's going on..
 
You use Java, right? Any Java IDE should work - Netbeans, Eclipse are supposedly good ;)

If you would be using C#, I would strongly force you to move to Visual Studio 2010 (note: you can compile against non-beta .NET 3.5 with it - it is just a much better developer environment).
 
You use Java, right? Any Java IDE should work - Netbeans, Eclipse are supposedly good ;)

If you would be using C#, I would strongly force you to move to Visual Studio 2010 (note: you can compile against non-beta .NET 3.5 with it - it is just a much better developer environment).

Got it running. Yeah, moving to Netbeans is the next step, just slowly learning the tool chain (and going from command-line development to an IDE is a bit of a shock).

The pre-start data import now runs from IQFeed, and is SO much faster it's wonderful. Interactive Brokers provide a historical data feed of a sort (but it's designed as a minimal thing, not a proper data feed), and it takes about 20 seconds to read in the data for a symbol. With IQFeed it's sub-second. Much easier.

As the code is stabilising, and it's getting closer to trading correctly, now seems a good time to mention you can follow the trades on Twitter: http://twitter.com/FoxQuant
 
I am now the proud owner of a netbook (Samsung n510) which I'll be using as my trading platform for now. That way it can stay with me and I can check on it during the day while it trades. Need to get some fairly critical bits of code done, though (such as ensuring it won't re-enter the market after it hits the stop-loss, until the market stabilises), but at least should get some more testing done next week.
 
Spent most of today hammering out bugs in the threading system. There's a lot (a LOT) of black magic going on in the code, to keep performance real time. All sorts of stuff with buffers and dropping data if it can't handle it fast enough, etc.

Turns out, IQFeed can feed data FAR too fast into the database thread, if I'm using InnoDB tables for MySQL. My code wasn't telling me this, so I was losing 90% of the data that was incoming. It now actually tells me when this stuff breaks. Also turns out the buffers were FAR too optimistically small. It's possible for a lot of data to end up in the buffer before the database thread wakes up to handle it (about 5,000 entries), so bigger buffers all 'round.

End result is the code's a lot faster. Hoping to get it up and running on the netbook later tonight, but am a bit ill so might just get an early night and wrestle it tomorrow instead.
 
The code is fairly much feature complete in the trading strategy, now. It's also now bug-complete, from the looks of things! Too much development work over weekends (when it's hard to test stuff). A few more UI controls to go in still, but it's nice to have the bulk of the work out of the way...

Updated screenshot for the curious:
foxquant.png
 
I swear I have the worst timing for my tests. Started it up just in time for the GBP/USD to spike upwards and lose another $115 (fortunately just virtual).

Some UI errors (the cancel, order placement and transmit distance displays all assume a valid bid/ask is in the system), and it doesn't seem to be re-entering the market at all after a trade now.

Keeps me busy...
 
Top