Live data from Hacker News

Show HN: Bateman, a stock trading system I'm working on

github.com

1–10 of 53 posts

Re: Show HN: Bateman, a stock trading system I'm working on

#2
Interesting project. I haven't had the time to look at your project in-depth, but keep in mind most retail traders are at a disadvantage due to routing. Most orders are routed through providers such as Getco or Knight Capital, and often you are not aware of whom your counter-party is. Therefore, any expected P&L may vary by x amount of basis points, due to latency and liquidity.

Re: Show HN: Bateman, a stock trading system I'm working on

#3
" It produces profitable simulated results on historical data"

I understand this is an intellectual exercise, but for those considering going into algorithmic trading, those words are dangerous:

- what transaction fee model is being used? Almost all profitable day trading strategies trade too often that the profits and adverse selection reserve are decimated by commissions and taxes.

- have you tried to approximate the presence of your own trade? For example, if you sell a boatload of google shares, the price will start falling. Even with more liquid issues like AA it doesn't take much (5K shares) to rock the boat.

- Have you considered the spread? It's unprofitable to quote a penny spread on google or other high-dollar names (the SEC tax alone, roughly $25 per $1M sold, doesn't allow for really profitable market making without at least 3 cent spreads.

There are many more questions, and for each question there are hedge funds and prop shops that have lost significant amounts of money, or were driven out of business, due to an oversight.

Re: Show HN: Bateman, a stock trading system I'm working on

#5
This looks interesting, and I'm going to try back testing this.

I would suggest trying out-

1. market neutral positions. Eg- If you go long AAPL, go short XLK ( The tech stock ETF). 2. going long slightly out of the money call options instead of stock. ( If the options are liquid)

I mostly do stat arb, and for back-testing, even I tried Metatrader, Quantopian and several other platforms and didn't think any of them were suitable. FXCM's Strategy Trader is worth taking a look at. It can only trade forex live through FXCM, but you can import CSV data and back test on whatever you import.

Re: Show HN: Bateman, a stock trading system I'm working on

#6
A practice that can improve results in intraday program trades is to only trade with the market, or only trade the direction that coincides with your meta analysis. In this case that might translate into only taking positions on days the market futures are up (above a threshold) pre-market and/or only trading tickers that you expect to rise over a 6-12 month timeframe.

While far from a silver bullet these can help you avoid buying positions when the market is hopeless, or trying to play a statistically losing game. It might be worth testing.

Make sure you include all trading fees and software license costs in your models.

Re: Show HN: Bateman, a stock trading system I'm working on

#8
I've toyed with this kind of thing before and things can look good in simulation, until I incorporated realistic effects of:

- trading commissions & fees - capital gains taxes - currency exchange (for those of us "unamericans")

then all of a sudden blammo, I decided I'm better off putting "investment" cash into my mortgage

Re: Show HN: Bateman, a stock trading system I'm working on

#9
Writing a framework for running trading strategies is certainly an interesting idea. I too am dissatisfied with most commercial platforms due to lack of features and flexibility. Unfortunately, there seems to be a lack of open source code in this sector. Eclipse Trader looked kind of interesting but the project appears to be dormant now. So expanding on this project could fill that gap.

However, from experience developing and testing algorithmic trading systems I can tell you that your strategy probably has some issues in its current form. I haven't looked into the code but from your description it appears you (correct me if I'm wrong): 1.) Pick a stock 2.) Use PSO to figure out the parameters 3.) If profitable, run the strategy on the stock with the optimised parameters

This means you're making a well known error in the system development community which is curve fitting parameters to historical data. This'll look very good in the simulations, but there is a high probablity that it will break down when trading it forward with real money, because it is optimised for the past. This is why there are a couple of widely accepted best practices when it comes to developing and testing trading systems.

First of all, your system should not have or need too many parameters. As a rule of thumb a robust system shouldn't have more than a handful of parameters and it should ideally show profits in simulations without a great deal of optimisation on those. When optimising make sure that the optimised parameter values are robust. This means that changing the value by a small increment only changes the resulting performance of your system by a small margin (somewhat analagous to numerical stability). If the performance changes by a big margin, then those values aren't robust and should be discarded. Furthermore, don't run optimisation on all of your historical data. Instead, optimise on portion of that data (the 'in-sample' data) and then test the optimised parameter values on the more recent data your didn't optimise on (the 'out-of-sample' data) and see if the performance of your system stays the same or breaks down. Another popular approach is 'Walk forward optimisation' [1] which takes the above one step further by repeatedly optimising and forward-testing on your historical data to find robust parameter values.

Some other things to consider: You need to factor in transaction costs, spread and slippage (the difference between the price you enter the order at and the price at which you get the fill). Transaction costs are easy to determine. Spread and slippage only apply when using market orders and can be reduced by trading with limit order if your system isn't negatively affected by this. Trading with market orders in a fast-moving market may incur siginificant slippage and there are predatory HF algos out there making money from screwing you on your execution. To get a better sense of this, it is considered a best practice to run your simulations on a lower timeframe than the one your system is supposed to work on in order to eliminate inaccuracies in the results. Ideally, you run simulations against unfiltered tick-by-tick data and additionally used bid and ask data series to factor in the spread. This may, however, be overkill and not needed for a system that runs on a daily timeframe, but it may make all the difference for a faster system.

[1] http://en.wikipedia.org/wiki/Walk_forward_optimization

Re: Show HN: Bateman, a stock trading system I'm working on

#10
post #2

Interesting project. I haven't had the time to look at your project in-depth, but keep in mind most retail traders are at a disadvantage due to routing. Most orders are routed through providers such as Getco or Knight Capital, and often you are not aware of whom your counter-party is. Therefore, any expected P&L may vary by x amount of basis points, due to latency and liquidity.

alright, I don't know how many "professional" traders there are on HN but I spent a good part of my life doing prop algo-trading on Wallstreet. The assumption that most trading systems are in VBA is perhaps valid for small or retail, but I can tell you that serious algo shops (trading desks, hedgefunds) run clusters of GPU harnessing CUDA with matlab, and R plugins, C++ etc. When/If you try this with real in the real world, you will encounter something called, "slipage" - slipage is the price the trade gets executed vs. where you thought it would be. This is due to various factors like the bid-ask spread, liquidity in that moment, order size, route, vol, etc you got the idea. As you said this is an algo system and in your description you do emphasize the diff between HF and algo. The strategy is simple and could work as any other strategy but any algo system like this needs lots of capital to make a decent profit, and when lots of capital is in question it needs to be redundant when things go haywire - and haywire go they shall. So the key assumption seems to be:

>buy stocks that are going up intraday and sell them higer

to be blunt it seems interesting, and I would encourage you to work on it further because complex systems rarely work right. but also bear in mind that its not any different than a candle stick trading strategy, or ichimoku clouds. The key is how fast you converge to usable parameters (time,money,trades), if you can do this fast the underlying strategy can be a multitude of things, and thats my 2 cents...

Post reply on HN