Moving Average indicator (MA)
The Moving Average (MA) is a technical indicator designed to measure a financial asset's price movement and trend. It is a handy indicator, and we have created three filters based on it to help you increase your edge in trading:
  • Distance - The distance of the price from its average.
  • Crossover - Built from two moving averages and the relationship between them.
  • Rank - The Percentile of the distance between the asset price and its average.
This article will describe the distance filterFor the other two filters, please refer to the right article from the links above or below.

Why use it?

You can use the MA indicator to measure the trend of the financial asset. It is essential to trade with the trend, so filtering out trades that don't fit your desired direction will increase your probability of profit.

How to use the MA indicator in SamurAI

The MA indicator measures the distance of the asset from its price. It is measured in percent, and a positive number means that the stock/ETF is above its average and vice-versa: a negative number means it's below.

You can use the SMA indicator to:
  1. Find stocks in Bullish/Bearish trend - If a stock is above a long-term average (usually 200 days), it is considered bullish, and if it is below, it is considered bearish.
  2. Cross - You can set the filter to find stocks that crossed the MA and changed the trend.

The Filter

In Samurai, you can use it in an advanced way to find stocks about to move in your direction. You can choose:
  1. Zone - Make sure the indicator has specific values. For example: above/below the MA.
  2. Cross - The indicator crossed a value. For example: Crossed above or below the MA.
  3. Breadth - How long does the indicator stay in the zone. This is useful for finding extreme cases and initiating trades after, for example, the stock has been a month above a short-term MA.


  1. Length: in days. During the market hours, we will simulate the last price as the closing price for that day to show you how the MA changes during market hours.
  2. From: and To: - These are the filters to initiate the zone you want the stock to be. The most common zones are: Above MA (From: 0) and Below MA (To: 0).
  3. Min Periods inside/outside range: How long the Stock was above or below the MA.
    1. You can replace the 'inside' and 'outside' the range filters by clicking on the word.
    2. The number is in days - how many days you want the stock to be above or below.
    3. his is useful for:
      1. Cross: Set it as min periods outside to 1.
      2. Breadth: Set the MA to short term and the min period inside for 20, for example (About one month)
      3. See more common use cases below.

Common use cases

  1. Stock is in a bullish trend - (1) periods 200 (default), (2) from:0 to:empty (3) Min. periods in range: 0 (default)
  2. Stock is in a bearish trend - (1) periods 200 (default), (2) from:empty to:0 (3) Min. periods in range: 0 (default)
  3. Stock crossed into bullish trend - (1) periods 200 (default), (2) from:0 to:empty (3) Min. periods outside range: 1

Switching between Simple and Exponential Moving Average

There are many ways to calculate the moving average formula. We support the two most popular calculation methods:
  1. Simple - This gives the same weight to each value in the time range.
  2. Exponential - This calculation gives higher weight to the most recent values, making the indicator moves faster. 

To switch between the calculations, change the drop-down menu at the top of the filter.

Read more

About Technical analysis Engine - KB
About Bollinger Bands - KB
About RSI - KB
About MA indicator - KB
About MA Crossover indicator - KB
About MA Rank (unique) indicator - KB
About MACD indicator - KB
About Stochastic Oscillator - KB
Was this article helpful?