Designing a trading strategy from scratch can be time consuming. The debugging process alone could take days, even weeks. However, an easy solution is to take someone else's trading strategy that you find might have some merit, and transform it to your own specifications. Making it do what you want.
The Quantopian website offers the ability to clone stock trading strategies that have been made public by their authors. This way, one can use such strategies as some starting point. At least, these programs are debugged, operational, and might prove to have some code that you could use.
Quantopian is searching for a low drawdown stock trading strategy. Its stated goal being to margin it as high as 6 times. The restriction being a close to zero beta and low volatility portfolio.
The presented strategy is marginally acceptable. Its beta is 0.38 compared to the stated limit of $\pm$ 0.30. Also, the drawdown is higher than wished for. However, there are attenuating circumstances.
Evidently, if you want to margin 6 times, the drawdown figure better be small. Six times a small drawdown near 0.10 (Quantopian's limit), will still be something close to 0.60. Hopefully less, but still, tending to it.
There are other ways of doing this.
For instance, the following strategy can do the job, however, in a different way.
This trading strategy is not mine. People on Quantopian should recognize it. I do not know exactly who the original author is. I do not have its history. All I did was clone it, and started changing parameters to see how it behaved.
I usually go for the pressure points. Not necessarily changing the code, but to see if the trading strategy is scalable for instance. And if so, how much. The only way to find out is to make some tests.
So here is that strategy, which I consider a diamond in the rough, that can do more simply by adding some pressure to it. The first observation being that the strategy can in fact handle the added pressure.
For sure, if you want more profits, you will have to take more risk. It is an understated market axiom. You want more, then you will have to do more. Evidently, all within the restrictions you might set.
I use the following strategy version: https://www.quantopian.com/algorithms/58954885a7d6014540d54cbd (log in free to have access).
This particular trading strategy is a modification of a modification. The last one of which was done by T. W. I made some minor changes. Not in the code, but for some of the parameters.
I wanted to know if it scaled upward well. That was easy to do, I simply raised the initial capital to \$ $\textbf{1,000,000}$. I also wanted to know if it could survive some leverage. Since Quantopian has for intention to leverage some of their systems. Might as well find out how far this one could go.
Test Settings: From 2011-01-03 to 2017-02-02 with \$ $\textbf{1,000,000}$ initial capital.
Those might appear as ordinary numbers, but not quite.
If Quantopian is ready to leverage 6x a less than 10% drawdown strategy. Here is one that is less than 30% and able to generate a much higher output.
Sure it might appear more risky. Maybe, and then again, maybe not. Nonetheless, this is a first draft, a preliminary exploration into what makes this strategy tick.
Here is the strategy's full tear sheet.
# Get backtest object
bt = get_backtest('5895445a1b4cb74460004852')
# Create all tear sheets
bt.create_full_tear_sheet()
Those are impressive numbers. Total, it is a $\textbf{68.97%}$ CAGR over the 6 years trading interval. I know 6 years is not that long, but it still shows what the trading strategy can do.
$\textsf{The returns tear sheet}$ follows as if with a 37 months of out-of-sample data.
bt.create_returns_tear_sheet(live_start_date='2014-1-1')
From its \$ $\textbf{1,000,000}$ debut, the strategy reached \$ $\textbf{87,420,612}$ in six years!
There are reasons for this high level of achievement. And they were built-in the code. All I did was push on the levers, the pressure points of the strategy. I gave it some steriods. Made it follow the equation: $$ A(t) = A(0) + (1+g)^t \cdot n \cdot u \cdot \overline{PT}$$
At anytime, one could have called it quits, and receive the portfolio's net liquidating value.
bt.create_bayesian_tear_sheet(live_start_date='2014-1-1')
This goes to say that if you have a working trading strategy, it can do more. And it is easy to push for more. I hope, this does illustrate my point.
Any trading strategy can be expressed as: $$ A(t) = A(0) + n \cdot u \cdot \overline{PT}$$ All I did was add some pressure: $$ A(t) = A(0) + (1+g)^t \cdot n \cdot u \cdot \overline{PT}$$
And, it was sufficient to achieve more. All that was required was to have $g>0$. You can find all this stuff, and more, in my latest book: http://www.amazon.com/dp/B01MYCRVEG
Hope it helps.