Predicting the future by looking at the past.
By: Keno Leon
Tags: Trading, Stock Market, Cryptocurrency, Data Science, Data Visualization

Predicting the future by looking at the past.

An analysis of trading strategies with backtesting.

The Problem:

You decide to invest in the stock market and buy a few shares of XYZCorp, you suddenly wake up one day and decide that you are going to day trade to capture the profit from the price movements but have nothing else to guide your decision but your gut, technical analysis is also starting to look interesting even though it all sounds a little fishy*, you trust fundamental analysis but see it more as a long term tool, you wish there was a reasonable way to capture all these ups and downs…

* Note: I've never been a fan of Technical Analysis but to each its own, my main beef is that it lacks a proven track record and hinges on a mostly absolute certainty that the past will repeat itself; and that there are rules governing behaviors across markets, exchanges and participants we can describe, yet the basis for these rules is usually not explained, a fertile ground for snake oil.

The Solution:

Don’t ! … You stand a better chance of turning a profit in your investment if you Buy and Hold than if you day trade; this strategy (Buy and Hold) while not without risk (global/local economy, market, sector, company) has a few things going on for it that others don’t:

It’s cheap : Day trading can chew your principal capital via commissions and taxes.

It’s low maintenance: You literally have to do nothing for years on end but provide capital, XYZCorp then uses your capital to generate monetary value and you get a cut via your stock price and/or dividends.

It’s less risky: The risk here comes from missing out on the big swings that can happen in a matter of minutes, being on the wrong side of a trade during a swing is usually devastating.

not about financial advice, but for an overview that expands on the risks of day trading and other financial follies I can recommend This post isabout financial advice, but for an overview that expands on the risks of day trading and other financial follies I can recommend The Investment Answer (Goldie, Murray)

A reasonable alternative ?

First things first, let’s call what we are about to do by its proper name: Gambling, we are placing our money at risk expecting a reward on an uncertain event => Here the uncertain event is what will happen with XYZCorps price during a time period.

You could argue that all of Investing is gambling and you wouldn’t be entirely wrong, even guaranteed investments like government bonds fail from time to time, so what is important to note is the risk amount which in turn is correlated to how uncertain we are of the outcome, in other words, how confident are you that XYZCorps price will behave in such and such way in the following days.

Confronted with this seemingly impossible problem ( uncertainty ) we usually turn to the past, not because the past is a perfect or even good predictor of the future, but rather ( humbly ) because we don’t have anything else to look at for clues about the future, and that’s unfortunately all we get, clues…

Backtesting as its name implies is simulating or testing a certain action with past data and confronting the result with the present, it also gives us valuable insights about future strategies, if you have ever thought about your life in terms of the choices you didn't take ( what if I had pursued a medical profession ) and then confronted that with present data ( Jim is a doctor and he’s wealthy but overworked ) you are backtesting. When your own son or daughter then asks you what to study, you can tell them: from what I understand you have a good chance of becoming wealthy and overworked, the certainty /risk is left out, but it depends on many factors like your sample size, data quality and external or intrinsic factors, if medical robots suddenly become the norm your offspring might not fare that well, ( but you had no way of knowing ), as I said the past gives us clues, uncertain ones, nothing more…