Normal_MUVm

Download script
Author: Copyright � 2008, MetaQuotes Software Corp.
Normal_MUVm

This technical tool is designed to provide traders with a normalized visual representation of market momentum and movement. Instead of displaying raw price data or standard oscillator values, it transforms external market indicators into a consistent scale, making it easier to identify trends and exhaustion points across different assets.

Core Functionality

The script functions by "wrapping" another technical indicator (such as the MACD or RSI) and applying a mathematical normalization process to its output. It takes the raw data from your chosen indicator and converts it into a relative percentage-based value. This allows you to see how close an indicator is to its recent highs or lows on a standardized scale.

How the Logic Works

To achieve this, the script follows a specific three-step logical flow:

1. Data Retrieval and Differentiation The tool first pulls data from a secondary indicator based on your custom settings (period, mode, and parameters). It calculates two primary components:

  • The direct value of that indicator.
  • The difference between the current value and the previous bar's value (representing the "velocity" or change).

2. Dynamic Range Analysis For every point on the chart, the script looks back over a specific window of time (defined by the user). It identifies the highest peak and the lowest valley reached during that period for both the indicator value and its rate of change. This establishes a "local boundary" for the market's current behavior.

3. Normalization Mapping This is the most critical step. The script compares the current price point against those local peaks and valleys to calculate a relative position. It uses a formula that maps these values into a normalized range. Essentially, it translates complex mathematical fluctuations into a simplified visual:

  • It determines where the current movement sits between the recent "high" and "low."
  • The result is a smoothed line that represents the indicator's progress toward its extremes.

Visual Output

The final output provides two primary visual lines. By normalizing the data in this way, the script removes the "noise" of varying price scales, allowing traders to see whether an asset is reaching an overextended state or maintaining steady momentum relative to its own recent history.

Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
Normal_MUVm
//+------------------------------------------------------------------+
//|                                                          111.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
//MUV%.mq4 (3.7 Kb) svm-d (09.11.2008 09:29)http://codebase.mql4.com/ru/4826 
//Normalizer.mq4 (3.5 Kb)alsu (18.11.2008 10:19) http://codebase.mql4.com/ru/4876

#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Green
#property indicator_color2 Yellow
#property indicator_color3 Red
#property indicator_color4 Blue

#property indicator_level1 0.25
#property indicator_level2 0.5
#property indicator_level3 0.75
#property indicator_levelcolor C'74,85,96'//SlateGray

//extern int MAMetod = 0;
//extern int MAPeriod = 14;
extern int KPeriod = 14;
extern bool ShowDif = true;
extern bool ShowMUV = true;

extern string  Indicator= "macd";//èëè rsi ... ëþáîå
extern int     mode=0;
extern int     param1=12;  //Íó èëè 9, íå âàæíî...
extern int     param2=26;
extern int     param3=9;   //Ñêîêà íàäî ïàðàìåòðîâ, ñòîêà è çàäàåì

extern string  note ="type-in Indicator FileName & params: macd, cci ... any  with zero level cross";


//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//double ExtMapBuffer3[];
//double ExtMapBuffer4[];
double K0[];
double K1[];
//double K2[];
//double K3[];


double Indyuk(int shift)

{
   return (iCustom(0,0,Indicator,param1,param2,param3,/* è ò.ä.:)*/mode,shift));
}

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
IndicatorBuffers(8); 
   if (ShowDif) SetIndexStyle(0,DRAW_LINE); else SetIndexStyle(0,DRAW_NONE); 
   if (ShowMUV) SetIndexStyle(1,DRAW_LINE); else SetIndexStyle(1,DRAW_NONE);
//   if (ShowMUV) {SetIndexStyle(0,DRAW_LINE); SetIndexStyle(1,DRAW_NONE);} 
//   else {SetIndexStyle(0,DRAW_NONE); SetIndexStyle(3,DRAW_LINE);}   
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
//   SetIndexBuffer(2,ExtMapBuffer3);
//   SetIndexBuffer(3,ExtMapBuffer4);   
   SetIndexBuffer(4,K0);   
   SetIndexBuffer(5,K1); 
//   SetIndexBuffer(6,K2);   
//   SetIndexBuffer(7,K3);      

SetIndexLabel(0,"IndDiff");
SetIndexLabel(1,"Ind");

   IndicatorShortName("NormalMUV "+Indicator);


//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----

  for (int i = Bars-counted_bars;i >=0; i--)
  {


  K0[i] = Indyuk(i)-Indyuk(i+1);
  K1[i] = Indyuk(i);

//  K0[i] = iCustom(NULL,0,"MUV",MAPeriod,0,1,i)-iCustom(NULL,0,"MUV",MAPeriod,0,1,i+1);
//  K2[i] = iCustom(NULL,0,"MUV",MAPeriod,0,1,i);
  
  double K0mx = K0[ArrayMaximum(K0,KPeriod,i)];
  double K0mm = K0[ArrayMinimum(K0,KPeriod,i)]; 
    
  double K1mx = K1[ArrayMaximum(K1,KPeriod,i)];
  double K1mm = K1[ArrayMinimum(K1,KPeriod,i)];
    
  
  if ((K0mx - K0mm)>0) double k0 = 1-((K0mx-K0[i])/(K0mx-K0mm)); else k0 = 1;        
  if ((K1mx - K1mm)>0) double k1 = 1-((K1mx-K1[i])/(K1mx-K1mm)); else k1 = 1;
//  if ((K2mx - K2mm)>0) double k2 = 1-((K2mx-K2[i])/(K2mx-K2mm)); else k2 = 0;
//  if ((K3mx - K3mm)>0) double k3 = 1-((K3mx-K3[i])/(K3mx-K3mm)); else k3 = 0;

  ExtMapBuffer1[i] = k0;
  ExtMapBuffer2[i] = k1;


  }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments