Hello everybody,
I hope I didn't offend you with this rather pessimistic title :)
Unlike a lot of people here, I'm not a trader/economist who is learning to code but rather the opposite.
I am a developer who is learning to trade.
I've been developing a strategy for several months now (using the trading view pinescript and recently in python after discovering QC).
I've came up with a strategy that (to me) looks coherent and functional.
My algo has a winning trade percentage of ~75% after backtesting it on many different markets be it stocks or crypto.
But here is my question:
What's the point of trading in a market where the best strategy would be to buy and hold?
Here are some example:
- AMZN backtest since 2010 Net Profit: 573% Buy & Hold Return: 2403%
- AAPL backtest since 2010 Net Profit: 439% Buy & Hold Return: 1415%
- TSLA backtest since 2010 Net Profit: 1083% Buy & Hold Return: 7444 %
- MSFT backtest since 2010 Net Profit: 119% Buy & Hold Return: 597%
- BTCUSD backtest since 2016 Net Profit: 1506% Buy & Hold Return: 3411%
- LTCUSD backtest since 2016 Net Profit: 203% Buy & Hold Return: 1511%
- ETHUSD backtest since 2016 Net Profit: 25171% Buy & Hold Return: 9893% (the exception to the rule)
Should I consider a strategy that does not outperform the market as invalid?
I hope to learn a lot from you all, Thanks.
Diary Of A Finance Kid
I assume when you say "the market" you are meaning the 4 tech stocks and 3 crypto currencies in that list, in which case that is NOT an accurate reflection of the market. You have also backtested through 10 years of bull market, so naturally buy&hold will succeed.
No algorithm in the world will beat the returns of those stocks and crypto returns in the last 4 years.
Vicostudio
Absolutely, I chose the first 4 tech stocks that came to my mind and these are obviously the ones with the best results, and I did it on purpose.
For the crypto, the backtest is not long enough but I don't have access to older data at the moment.
So that a strategy doesn't outperform this kind of stock is not a point that invalidates it?
What are the key points/numbers on which you can judge the success of an algorithm?
Adam W
> What's the point of trading in a market where the best strategy would be to buy and hold?
This really depends on how you are defining "best". Typically, the goal of trading (and investing in general) is not simply maximize returns, but also to account for potential risks.
If you were to look at the risk-return dynamics of the assets you mentioned (ignoring the cherry-picking for now; as there are plenty of assets that have delivered massive losses during this period) - AAPL has a Sharpe of 0.49, AMZN: 0.02, MSFT: 0.19, TSLA: 0.99. It is possible to argue that "Buy-and-Hold" is actually a very "bad" strategy then, despite the returns. Note: Sharpe is not a very good metric in general for risk, as it penalizes volatility in any direction - but mentioned it to illustrate a point.
> So that a strategy doesn't outperform this kind of stock is not a point that invalidates it?
Exactly, it neither validates nor invalidates it. Suppose we have two strategies for some fixed period of time: Strat A vs Strat B.
Strat A is a Buy-and-Hold returning 100% with a Sharpe of 0.1, while Strat B returns 70% with a Sharpe of 1.0.
Trading Strat A will always result in higher raw returns, but trading Strat B results in a better risk-return profile. This is important when we factor in leverage (or at least, capital allocation). Putting your entire savings into Strat A results in higher returns at the end of the period, but will have larger downswings and maybe even moments where you are nearly bankrupt. Putting your entire savings in Strat B results in lower returns, but a much "smoother" equity curve. The latter is typically more desirable when significant amounts of capital or leverage are at stake.
Main Takeaway
Strategies should not be evaluated on returns alone, but on the overall risk-return dynamics and goals of the trader. Quantifying "risk" is a subjective topic, and more formally we'd have to define a trader's personal utility functions in order to claim "Strat X is better than Strat Y".
Evaluating a strategy based on metrics like Sharpe alone is also insufficient - the current 0.01% interest rate on a riskless savings account might have near infinite Sharpe, but no matter how much we leverage it it'll still nowhere be close to the raw returns of Strat A and Strat B. If one is extremely risk-averse, the savings account looks like the best strategy. If one is extremely risk-seeking, going for Strat A looks like the best strategy. It depends on the goals.
Vicostudio
Thank you for this detailed answer.
The savings account is actually a pretty good example to explain the sharpe ratio.
I have done some research on this sharpe ratio and what I understand is that my strategy that has a sharpe ratio of ~0.75 should be considered unsustainable since the return is not sufficient for the risks taken.
I guess I'm back to the drawing board :)
However I don't understand what is the "risk-free investment" used in the sharpe ratio formula.
Anthony FJ Garner
It very much depends how you define "tradng". I began algorithmic trading after trading in a way that almost ("almost") could not lose. Unfortunately that method of trading more or less came to an end - or at least access to it was no longer possible in the same way.
The sort of systems creatable with data and a back testing engine are unlikley to show those sort of opportunities, depending as they mostly do on prediction over a non trivial time frame.
Basically I was buying assets which were deliberately priced cheaply and immediately reselling them on the markets.
I wish i had a clearer handle on how HFT creates its profits but one way is said to be buying ahead of big orders. You don't need to predict very far ahead if you can buy just ahead of a large buy order or short ahead of a large sell order. I assume they have other methods to profit, but would not know.
One of the biggest success stories of the last few decades has been Jim Simons and the Medallion Fund. A high frequency trading operation which has reaped countless millions for his firm Renaissance technologies. Compare this rapid fire technique to what happens when Mr Simons venture into long term investment predictions: The Renaissance Global Equities Fund. A very different and far less profitable fund.
Other "sure fire " areas of trading include dealing with inside information ahead of announcements. Despite the best efforts of the regulators this practice seems to still be occuring on a regular basis - I speak occasionally to observeres of stock prices in the M&A world.
Penny stocks contains an excellent illegal niche: the Pump and Dump. Insiders ramp an illiquid stock, sell out and then buy back when the stock inevitably crashes.
So what kind of trading do you want to become involved in? Unless you can find a niche such as I have described your trading may have difficulty over the long term in beating stock market indices. And back testing has fuelled many a misconception. It is a dangerous tool indeed. Many a profitable system turns out to work on past data but fail going forward.
If you discover a real niche such as I have described using backtesting - well you may have success going forward. If not, you will struggle to beat the market in risk adjusted terms.
A newcomer to this feel needs to be brutally realistic. Few of them are.
Adam W
Vicostudio
The Sharpe Ratio was conceived as a measure to compare a risky asset (or strategy) to a riskless one. In practice, the "risk-free rate" is typically set as the yield on Treasury Bills/Bonds (for shorter-term strategies, commonly 3-month Bills) or a similar "near risk-less investment". The general idea is to be able to say, "Given my risky Strategy A, how much returns compared to risk can I expect to receive instead of a riskless benchmark?" Unless you are building a full multi-asset class strategy though, you can just assume the riskless asset is Cash with a risk-free rate of 0.
There are some important theoretical implications for Sharpe Ratios, but it's not a very good metric for quantifying risk by itself. I'd suggest you also look at the Sortino Ratio (similar computation, but only penalizing downward volatility), Maximum Drawdowns, Time to Recovery (from a Drawdown), and so on. If you can paste some of the performance metrics of your strategy that LEAN automatically generates, that would be helpful in determining which areas could be improved. I wouldn't scrap the strategy just yet - sometimes a simple tweak in trading logic makes a huge difference.
Anthony also mentions some pessimistic but accurate viewpoints on trading systems. It is very difficult to consistently beat stock market indices (i.e. SPY) with longer-term holding periods (i.e. Buy and Hold), but short-term strategies generally have an edge. I'll leave out the formal explanation for this for now and let you think about it, but intuitively think of trading as having different views on what asset prices should be rather than what they currently are. The probability that assets are persistently mispriced over the long-term asymptotically converges to 0 due to trading activities, but in the short-term it is inevitable.
Vicostudio
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!