Most trading strategies you find online are of questionable value. So if you’re going to put your money into it, we suggest you build and test it yourself.
Thankfully, building your own strategy doesn’t have to be a daunting task — we provide tools to do just that — and outline 6 steps you can follow to build your own strategy that you can have confidence in.
Data or Ideas?
Profitable strategies can come from a variety of sources. Most algorithmic traders break it into idea-first and data-first strategies.
Idea-first strategies starts with a hypothesis about what might be profitable. For example, you might wonder if some indicator can be applied to a given stock or currency or if there’s a way to profit on cognitive biases. So you go ahead, get the data and test your idea.
Data-first strategies start with the data and try to extract potentially profitable patterns from the data which then form your hypothesis. These can be found using black-box models (e.g. machine learning) or oddball patterns you observe in the market, even if you can’t explain why they work.
Gregory Zuckerman explains this type of thinking while asking an executive at the famous quant fund Renaissance Technologies about signals they’d trade. As long as they had the statistics to back it up, they’d trade such strange signals as “volume divided by price change three days earlier;” it doesn’t matter if they have a story about why that works or not, just go for it.
Which is better?
Well, that’s hard to say — traders have had a lot of success with both approaches. The data-first approach is often more mathematically challenging, but that doesn’t mean it’s going to be more profitable. I agree with systematic trader and author Rob Carver when he writes, “consistently profitable trading comes out of careful research, done by thoughtful and knowledgeable people, who seek to understand where their profits come from. The loss-making systematic trading I’ve seen has often been the result of haphazard data mining…That experience, combined with my preference for things I can trust and understand, means I favor the ideas-first method.”
Test a Simple Version of Your Strategy
Now you have some idea, so you need to go test it to see if it really holds up. I suggest starting simple, without a lot of fancy position sizing, use of stop losses, checking correlations, and so forth — unless these are key parts of your idea! Just try to test the simplest version you can to see if there’s some potential.
You’re not looking for a world-beating backtest at this point, you just want to know whether or not there’s some potential in the signal you’re trying to exploit. Does it seem to do better in a bear market or bull market? What about high volatility regimes vs low volatility?
If there’s an edge in some situations, you might have something you can build and work with!
Add the Bells and Whistles
Assuming you’ve got a trading signal that piques your interest, you can start adding in some of the key components that a live strategy is going to need. You’re going to want to work with position sizing and risk management to avoid blowing up, add stops/targets to get out of trades, and add filters or other signals to restrict entry into a trade during periods where your model will perform at its best.
Optimize your Parameters
A lot of traders get into trouble by over-fitting their strategies. They jump on a signal and keep tweaking parameters until they get a model with an astronomical return. Lured in by the promise of riches, they don’t realize that their model is incredibly fragile and doomed to failure.
The green line is over-fit to the data. It’s going to show great stats, but looking more closely, it’s clear that it is going to struggle with new data (image from Wikipedia).
While there are no hard and fast rules to avoid over-fitting, it’s a good idea to limit the number of parameters in your model and the number of runs you try.
Too many parameters allow you to play with a lot of combinations to find that combination that is “just right” and looks great in a backtest, but doesn’t generalize to your trading account. Each set of parameters requires a new run, so if you find yourself running “My Retire-Next-Year Strategy #149285” then it’s safe to say you should give it a break and try a new idea.
Out-of-Sample Testing
Let’s say you have 20 years of historical data available — most novice traders are going to fit their strategy on all 20 years, then go and trade. A better approach is to split between test and training data, so you optimize your parameters on the first 15 years, then test the results on the last 5 years. The first 15 years are your in-sample data while the last 5 years comprise your out-of-sample data. This helps prevent over-fitting as discussed above because you should be able to see how much your strategy’s performance degrades during the out-of-sample test.
Some degradation is expected, so your in-sample test should have higher returns and better risk metrics than your out-of-sample test. But if in-sample is amazing and out-of-sample is horrendous, then you’ve probably over-fit your data and need to go back to the drawing board.
A lot more can be said about proper testing and optimization (we’ll go into details in future posts). One of the best techniques to use is walk forward optimization. This is where you optimize on a small, subset of in-sample data (e.g. 1 year) then run a test on the next subset of your data for out of sample testing. You can do this with a lot of different parameters and keep the top 30% every time and see what survives. This requires a lot of data and discipline, but is widely considered the gold-standard approach.
Sanity Check
Congrats if your strategy has made it this far! Look closely at those returns though, do you really believe they’re possible in practice?
Carver argues that a single-instrument strategy should produce a realistic Sharpe Ratio of 0.3. You can get higher Sharpe Ratios using proper money and risk management as well as a broader portfolio of instruments, but if all of that gets well above 1, then you’re probably traipsing into fantasy land.
If you want to hold onto this strategy, then it may be prudent to paper trade for a bit while gathering more data to see if it performs the way you expected.
Go Trade!
Now you should have a clearly defined, optimized, and well tested trading system that provides attractive yet reasonable returns. Looks like it’s time to trade it!
Some people build custom dashboards, spreadsheets, and all sorts of infrastructure to manage and trade their own portfolio. An easier solution would be to work with a system that will provide you automated alerts when your time to trade has come up. Even better would be one that enables you to also quickly test a variety of ideas in an easy, no-code framework like this one here.