Motion Smoothness Index

Download script

This script, known as the Motion Smoothness Index, is designed to help traders visualize the stability and momentum of price movements on a trading chart. Rather than just showing where the price is, it analyzes how "smooth" or "erratic" that movement has been over a specific period.

How the Logic Works

The indicator functions by breaking down market behavior into three distinct steps:

1. Measuring Price Change First, the script looks at the raw movement between consecutive candles. It calculates the difference in closing prices from one bar to the next. This creates a foundation of "raw motion"—identifying exactly how much the price moved (up or down) at every individual step.

2. Calculating Volatility of Motion The tool doesn't just look at the direction of the move; it looks at the consistency of those moves. It takes the raw motion data and calculates a "Standard Deviation." In simple terms, this measures how much the price fluctuations vary from their average.

  • If the price is moving in a steady, predictable trend, the deviation is low.
  • If the price is jumping around erratically or experiencing sharp, jagged spikes, the deviation is high.

3. Normalizing the Data (The Index) To make this information easy to read at a glance, the script performs a final calculation called "Normalization." It divides the movement volatility by the overall standard deviation of the asset's price.

This produces a specific index value:

  • Stability: When the index shows low values, it suggests that the market is moving in a relatively smooth, coordinated fashion (low "noise").
  • Instability: When the index rises, it indicates that the market is becoming erratic, with larger and more unpredictable swings occurring relative to the normal price action.

Visual Representation

The indicator appears in its own separate window below your main chart. It features a visual line that fluctuates around a 0.5 level. By observing where the line sits relative to this center point, you can gauge whether the current market "motion" is becoming more turbulent or staying smooth.

Summary for the User

Essentially, this tool filters out the general price direction to show you the quality of the move. It helps you identify periods of high-stress volatility versus periods of stable, fluid trending, allowing you to better understand the underlying "mood" of the market's momentum.

Indicators Used
Standard Deviation indicatorStandard Deviation indicator
Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
Motion Smoothness Index
ÿþ//+--------------------------------------------------------------+

//|                                  Motion Smoothness Index.mq4 |

//+--------------------------------------------------------------+

#property description "Original idea and creation by Alex Grover"

#property description "Metatrader code by Max Michael 2021"

#property indicator_separate_window

#property indicator_buffers 2

#property indicator_color1 Aqua

#property indicator_level1  0.5

#property indicator_levelcolor clrGray

#property indicator_levelstyle STYLE_SOLID

#property version   "1.00"

#property strict



extern int    length = 50;

extern int   MaxBars = 2000;



double       buffer0[];

double       buffer1[];



int init()

{

   SetIndexBuffer(0, buffer0); SetIndexStyle(0, DRAW_LINE);

   SetIndexBuffer(1, buffer1); SetIndexStyle(1, DRAW_NONE);

   string sShortName="Motion Smoothness Index ("+ IntegerToString(length) +")";

   IndicatorShortName(sShortName);

   SetIndexLabel(0,sShortName); 

   SetIndexLabel(1,"");

   return(0);

}



int start()

{

   int counted = IndicatorCounted();

   if (counted < 0) return(-1);

   int limit = Bars-counted-1;

   if (limit > MaxBars) limit=MaxBars;

   

   int i=limit;

   while(i>=0) { buffer1[i]=Close[i]-Close[i+1]; i--; }

      

   i=limit;

   while(i>=0)

   {

      if (i > MaxBars-length) buffer0[i]=EMPTY_VALUE;

      else buffer0[i]=iStdDevOnArray(buffer1,0,length,0,MODE_SMA,i) / iStdDev(_Symbol,0,length,0,MODE_SMA,PRICE_CLOSE,i);

      i--;

   }

   return(0);

}

Comments