Author: Copyright � 2005, MetaQuotes Software Corp.
MRO2

This custom indicator is designed to provide traders with a visual representation of price volatility relative to a moving average of market range. By analyzing historical price action, it helps identify the intensity of price movements compared to the "normal" behavior of the asset over a specific timeframe.

How the Logic Works

The script operates by calculating two primary components of price action:

1. Establishing the "Average Range" The indicator first looks at a specific number of previous bars (determined by the user-defined period, which defaults to 7). For each of these bars, it measures the distance between the highest price and the lowest price reached. It then adds these distances together and calculates the average. This creates a baseline for how much the asset typically fluctuates within that timeframe.

2. Measuring Relative Movement Once the average range is established, the script looks at a specific movement in the price—specifically the difference between the closing price of one bar and the closing price of another (three bars prior).

3. The Final Calculation The final value displayed on your chart is the result of dividing that specific price movement by the average range calculated in step one.

What This Means for the User

Essentially, this indicator normalizes price movement. Instead of looking at the raw points or pips an asset moves, it shows you how significant a move is compared to recent historical volatility.

  • High Values: Suggest that the price is moving significantly more than it usually does, indicating high momentum or a breakout.
  • Low Values: Suggest that price movement is relatively calm and consistent with recent history.

By plotting this on a separate window, it allows traders to see "volatility-adjusted" price action, helping to distinguish between standard market noise and meaningful shifts in price direction.

Miscellaneous
Implements a curve of type %1
15 Views
0 Downloads
0 Favorites
MRO2
//+------------------------------------------------------------------+
//|                                                         MRO2.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- input parameters
extern int       periodMRO2=7;
//---- buffers
double RatedRangeBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,RatedRangeBuffer);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double Range,AvrRange;
   int shift,i;
   int    counted_bars=Bars-periodMRO2-1;
//---- TODO: add your code here
   for (shift=counted_bars;shift>=0;shift--)
      {
      Range=0.0;
      for (i=shift+1;i<=shift+periodMRO2;i++)
         {
         Range=Range+MathAbs(High[i]-Low[i]);
         };
      AvrRange=Range/periodMRO2;
      //RatedRangeBuffer[shift]=AvrRange/Point;
      RatedRangeBuffer[shift]=MathAbs(Close[shift+1]-Close[shift+4])/AvrRange;
      };   
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments