# Simple Moving Average Trading Strategy

## What Is A Simple Moving Average

A moving average calculates data points by creating a series of averages of different subsets of the full data set. In finance, a moving average is a stock indicator that is commonly used in technical analysis. Calculating the moving average of a stock is to help smooth out the price data by creating a constantly updated average price.

## SMA Indicator

A simple moving average (SMA) is a trend indicator that can help determine if the price of an asset will continue or if it will reverse a bull or bear trend.

## How To Calculate SMA indicator

The Formula for SMA is:

SMA= (A1 + A2 + A3 + ….. + An)/n

Where:

An = the price of the asset at period n

n = total number of periods

## Why Use The Simple Moving Average

The simple moving average (SMA) calculates the average of a selected range of prices, usually closing prices, by the number of periods in that range. It can be enhanced as an exponential moving average (EMA) that is more heavily weighted on recent price action. The EMA gives a higher weighting to current prices, while the SMA assigns an equal weighting to all values.

## How To Use The Simple Moving Average

Moving averages are usually calculated to identify the trend direction of a stock or determine its support and resistance levels. It is a trend-following or lagging indicator because it is based on past prices.A simple moving average (SMA) is a calculation that takes the arithmetic mean of a given set of prices over the specific number of days in the past, e.g., over the previous 15, 30, 100, or 200 days.

SMA = Sum(data, period) / period

### Defining a Bullish Scenario to generate a buy signal:

• When the price crosses above the simple moving average , it indicates that the current price is greater than the average of the defined period; hence the market is in an upward trend.
• When the shorter period moving average crosses over the longer time moving average, it indicates the start of a new uptrend.

### Defining a Bearish Scenario to generate a sell signal:

• When the price crosses down the simple moving average, it indicates that the current price is lower than the average of the defined period; hence the market is in a downward trend.
• When the shorter period moving average crosses down the longer time moving average , it indicates the start of a new downtrend.

## Building The Simple Moving Average Trading Strategy On Mudrex:

You can create strategies on Mudrex using simple ‘blocks’. You can connect multiple blocks and define conditions on those connections or ‘paths’ to create your strategy on Mudrex.

As discussed above, lets first write our entry/exit conditions so that we know what to do:

BUY: When price crosses up the SMA.

SELL: When price crosses down the SMA.

Overall Strategy: The overall strategy on mudrex looks like this

Testing: We can now run a quick back-test to see how our strategy performs

A few quick references below: