Back-testing a Popular Trading Strategy

Back-testing the Moving Average Cross Strategy in TradingView

Sofien Kaabar, CFA


Moving averages may provide interesting trading strategies. This article back-test the most famous moving average strategy and shows how to code it in TradingView.

Moving Averages & Crosses

Moving averages are widely used technical analysis tools in financial markets. They are calculated by taking the average price of an asset over a specified period of time, and they help smooth out short-term price fluctuations, providing a clearer picture of the underlying trend.

A simple moving average is calculated by summing up the prices over a certain period and then dividing by the number of periods. An exponential moving average gives more weight to recent prices, making it more responsive to price changes.

Moving average crossovers occur when two different moving averages with different periods intersect or cross each other on a price chart.

Moving average crossovers are often used by traders to identify potential buy or sell signals. However, it’s important to note that they are lagging indicators, meaning they may signal a trend change after it has already occurred.

  • A bullish cross occurs whenever the short-term moving average crosses above the long-term moving average.
  • A bearish cross occurs whenever the short-term moving average crosses below the long-term moving average.
Moving average bullish cross followed by a bearish cross

Join the other 82,000 followers and get top trading signals (through charts) with an updated track record every week! These are personal trades that I share and are found using a mix between sentiment analysis and technical analysis with rigorous analysis first.

A Simple Back-test of the Strategy