How to detect unwanted curve fitting during backtest

Whenever you develop an algorithmic trading strategy, unwanted curve fitting is one of the most dangerous hazards. It will lead to substantial losses in real time trading. This article will show you some ways to detect if the performance of your algorithmic trading strategy is based on curve fitting.

Curve fitting – what is it?

Every algorithmic trading strategy will have some parameters. There is no way around it. You will have to decide what length your indicators have, you will have to specify a specific amount for your stop loss or profit target. Beside the actual rules of your strategy the chosen parameters will usually significantly influence the back-test performance of your strategy. And with any parameter you add the danger of curve fitting rises significantly. Continue reading

The Edge of an Entry Signal

When developing a new trading strategy you are usually confronted with multiple tasks: Design the entry, design the exit and design position sizing and overall risk control. This article is about how you can test the edge of your entry signal before thinking about your exit strategy. The results of these tests will guide you to the perfect exit for the tested entry signal (entry-exit combination)

Quality of an Entry Signal

When you develop a new idea for an entry signal there are two things you would like to see after the entry: no risk and fast profits. This would be the perfect entry with the highest possible edge. In reality the market response to your entry will be risk and chance. With a good entry the upside would outnumber the downside. Continue reading

The Edge of Technical Indicators

Classical technical indicators like RSI and Stochastic are commonly used to build algorithmic trading strategies.  But do these indicators really give you an edge in your market? Are they able to define the times when you want to be invested? This article will show you a way to quantify and compare the edge of technical indicators. Knowing the edge of the indicator makes it an easy task to select the right indicator for your market.

The edge of an indicator

Any technical indicator, let it be RSI, moving averages or jobless claims, has got a primary goal. It should signal if it is a wise idea to be invested or not. If this indicator signal has any value, on the next day the market should have a higher return than it has on average. Otherwise  the usage of no indicator and a buy and hold investing approach would be the best solution.

The edge of an indicator in investing consists of two legs.

  1. the quality of the signal
  2. the number of occurrences

Continue reading

Daily Extremes – Significance of time

Analyzing at which time daily market extremes are established shows the significance of the first and last hours of market action. See how different markets show different behavior and see what can be learned from this analysis.

Probability of Extremes

A day of trading usually starts with a lot of fantasies for the future, then we try to survive the day and end it with a lot of hope for tomorrow. This psychological pattern can also be shown when analyzing intraday market data. A high level of fantasies usually leads to a strong market movement, and thus market extremes can often be seen near the beginning or the end of the trading session. Continue reading

Noisy Data strategy testing

Adding some random noise to historic market data can be a great way to test the stability of your trading strategy. A stable strategy will show similar profits with noisy and original data. If the noise has a great impact on your results, the strategy might be over fitted to the actual historic data.

Synthetic market data?

Generating completely synthetic market data to test algorithmic trading strategies is a dangerous endeavour.  You easily lose significant properties like classic chart patterns or the trend properties of your market. Continue reading

Factor investing in portfolio management

Factor investing has been around in portfolio management for some years. Based on algorithmic rules it became the big thing in trading and the ETF industry. But is there still some money to be made? Is small beta still smart or just beta? This article will give you a Tradesignal framework to test the factor investing ideas by your own.

Factor investing

Buy and hold has been a profitable approach in investing. But customers ask for more. So technical analysis came around and held up the promise that market timing is possible. As the returns did not match this promise, algorithmic trading was invented. Clearly defined rules made it possible to backtest any given strategy, and if done properly, the returns equal the ones promised during the backtest. But this requires a lot of intellectual power and relies on cheap execution, so these returns are usually not available to the public. Continue reading

Dollar Cost Averaging Investment Strategy – success based on luck?

This article is about the dollar cost averaging investment strategy and the influence of luck in it.

The Dollar Cost Averaging Investment Strategy

To invest parts of your income into financial markets has been a profitable approach, especially in times when bond yields are low. One approach to do so is the dollar cost averaging investment strategy. Continue reading

Historic Bear Markets & Crashes (business as usual)

Since S&P500 has lost 20% from its top in 2018 and everybody is talking about bear markets. See what has happened in history.

We all have been spoiled by artificially low volatility over the last years.

Now people blame the gone-wild president or algorithmic trading for the market correction, but let us have a look into history to see how common market corrections have been over the last century. Continue reading

Overnight vs Daytime Performance & Volatility

Analysing the market performance of the day session vs. the overnight movement reveals some interesting facts.

Daytime vs. Overnight Performance

The chart below gives a visual impression on where the performance of the SPY ETF is coming from.

The grey line represents a simple buy and hold approach. The green line shows the performance if you would have held SPY only during daytime, closing out in the evening and re-opening the position in the morning. Continue reading

Bullish? Buy stock or sell put option?

So you are bullish on a specific stock, but you also have realised that timing is major problem? So what would be the best strategy to implement your bullish opinion but avoid the problems of any timing strategy?

Selling a put option might be the answer.

Bullish probability

For discussing this question let’s use the current Apple chart as an example. The question is, if you are bullish on apple, should you buy 100 Apple stocks right away or should you sell an at-the-money put option. To find the pros and cons of these two possibilities let’s have a look at some charts. Continue reading

Technical vs. Quantitative Analysis

“The stock market is never obvious. It is designed to fool most of the people, most of the time” Jesse Livermore

Technical Analysis

Technical analysis is a form of market analysis based on historic price patterns. The basic assumption of technical analysis is, that human behaviour does not change over time, and thus similar historic market behaviour will lead to similar future behaviour. Technical analysis is a predictive form of analysis, a technical analyst will try to estimate what the market might most probably do over the next period of time. Continue reading

An Algorithmic Stock Picking Portfolio

In this article I will discuss a simple algorithmic stock picking approach based on momentum and volatility. The goal will be to generate excess returns versus a capital weighted stock basket.

Alpha and Beta

Investing in assets with low volatility and high return is on a lot of peoples wish list. Portfolios which archive this goal will have a high Sharpe ratio and in the end get the investors money. By reverse engineering this criteria, one can find promising stocks to invest in and out perform a given capital weighted index.

Alpha and beta are measures to describe an assets performance relative to its index. Both are used in the CAPM – capital asset pricing model.

Alpha is a measure for an assets excess return compared to an index. Continue reading

Market crash or market correction?

Over the last days and weeks some traders have been worried if the currently ongoing correction in the markets will evolve into a crash, or if it is just a normal correction.

Crash or correction

The main difference between a correction and a crash is the panic level. But it is not the absolute level of .VIX, the CBOE implied volatility meter. It is the difference between realized and implied volatility that defines a crash which defines real panic. Continue reading

Bollingerband: The search for volatility

Usually it makes no sense to fight against normal distribution. But there are setups which have got a high probability of unexpected behaviour.  Volatility can be the key to future market movements.

Bollinger bands width percentile

Bollinger Bands are a great tool to describe market volatility. And my favourite tool to measure the width of Bollinger Bands is Bollinger percentile.

Like the IV percentile indicator my Bollinger percentile indicator is a probabilistic indicator. It gives the probability of Bollinger Bands having a narrower upper band – lower band range than currently given. Continue reading

IV Percentile – when to sell volatility

Volatility trading: when to buy and when to sell volatility

You got to know when to hold ’em,
Know when to fold ’em,
Know when to walk away,
And know when to run.
(Kenny Rogers)

When to sell implied volatility

Volatility is a nicely reverting time series. If it is high chances are good that it will come down again. The only problem is to find out when volatility is high, and when it is low. Unfortunately there are no absolute levels, you can’t say that 50% implied volatility is high, as this specific stock might have an implied volatility of 80% most of the time. So you can only compare the current volatility level to historic levels and so define if volatility is currently high or low. Continue reading

The Hindenburg Omen – Stock Market Crash Ahead?

The Hindenburg Omen is an indicator which is believed to forecast market crashes. Unfortunately it does not work, but the idea behind this indicator is worth to be discussed.

Market Breadth – Hindenburg Omen

The Hindenburg Omen is a market breadth indicator. It describes how correlated stocks are within a market behave.

I already had a market breadth indicator in this blog a long time ago, the percentage of stocks within a market above the 200 day average. The Hindenburg Omen does not use moving averages, it is based on the number of new highs and lows in the market.

Hindenburg Omen: idea and calculation

To get a warning signal for an upcoming stock market crash the Hindenburg Omen indicator observes the number of stocks making new 54 week highs and the number of stocks making 54 week lows. In a strong bull market you will usually see a lot of new highs but hardly any new lows, in a bear market you will see new lows, but no new highs. Continue reading

Implied vs. Realized Volatility for NASDAQ100 stocks

(1) You shall only trade when the chances are on your side

Comparing implied and realised volatility

Selling volatility can be a profitable game, but only if you sold a higher volatility than the market realises later on. Comparing realised and current implied volatility gives you an idea if the chances are on your side.

We already had a look at realised volatility and what the fair price for a straddle might be. Have a look at the kvolfair bet articles. These articles present a way to calculate the historically correct price for a straddle. Whenever you sell a straddle (to sell volatility), implied volatility should be higher than the fair bet price. Only then you will win on a statistical basis. Also have a look at the statistics of VIX, to get a clue when a downturn in volatility can be expected. Continue reading

Distribution of Returns

“Tomorrow never happens. It’s all the same fucking day, man. ”  Janis Joplin

Distribution of Returns

Analysing history and hoping it will somehow repeat itself  is the big hope of all quantitative traders. This article is about the distribution of market returns, but not about normal distribution, Gauss and standard deviation. This article is about the visualisation of market returns and what can be learned from it.

Probability distribution diagrams show the probability of a specific outcome. How likely is it that the market will be at a specific price sometimes in the future?  How does a specific bullish or bearish indicator signal affect the future market behaviour on a statistical basis? An approaching visualisation of the statistical probabilities are the best way to understand market behaviour and find your chances in trading. Continue reading