Author: Yuriy Tokman
MUV

This technical indicator is designed to provide traders with a smoothed visual representation of price action on a financial chart. Rather than simply plotting the standard closing prices, it employs a two-stage mathematical process to filter out "noise" and identify underlying trends more clearly.

How the Logic Works

Step 1: Calculating the Custom Price Point The tool begins by analyzing four specific data points for every individual candle on your chart: the High, Low, Open, and Close prices. It determines the type of price movement that occurred during that period:

  • If the price closed lower than it opened (a bearish move), the script calculates a weighted average favoring the lower values.
  • If the price closed higher than it opened (a bullish move), it shifts the weight toward the higher values.
  • If there was no change in price, it treats the High and Low equally.

This specific weighting ensures that the indicator takes the "mood" of the candle into account—prioritizing whether the market participants were pushing the price up or down during that specific timeframe.

Step 2: The Deviation Measurement Once these weighted points are established, the script calculates a specific variance between these values and the candle's extremes (the High and Low). This creates a secondary set of data points that represent the internal dynamics of the price movement rather than just the surface-level price.

Step 3: Smoothing the Trend In the final stage, the script takes all the calculated data from Step 2 and applies a Moving Average. This is where the user can choose the "sensitivity" of the line—ranging from a Simple Moving Average to an Exponential or Linear Weighted version. By applying this moving average over a specific period (the default being 14), the indicator smooths out erratic spikes, resulting in a fluid line that highlights the broader momentum of the market.

Summary for the User

In plain terms, this tool does not just follow the price; it interprets the strength of each candle's movement first, and then draws a smoothed trend line based on those interpreted movements. It is designed to help you see the "flow" of the market by filtering out minor fluctuations that often appear as clutter on a standard chart.

Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains open prices of each barSeries array that contains close prices for each bar
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
MUV
//+------------------------------------------------------------------+
//|                                                          MUV.mq4 |
//|  3 íîÿáðÿ 2008ã.                                    Yuriy Tokman |
//| ICQ#:481-971-287                           yuriytokman@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#property link      "yuriytokman@gmail.com"

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 LightYellow
#property indicator_color2 Red

extern int period     = 14;
extern int ma_method  = 0;  //MODE_SMA   0   Ïðîñòîå ñêîëüçÿùåå ñðåäíåå 
                            //MODE_EMA   1   Ýêñïîíåíöèàëüíîå ñêîëüçÿùåå ñðåäíåå 
                            //MODE_SMMA  2   Ñãëàæåííîå ñêîëüçÿùåå ñðåäíåå 
                            //MODE_LWMA  3   Ëèíåéíî-âçâåøåííîå ñêîëüçÿùåå ñðåäíåå 

double Buf0[];
double Buf1[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
       SetIndexBuffer(0,Buf0);
       SetIndexBuffer(1,Buf1);
       
       SetIndexStyle(0,DRAW_NONE);
       SetIndexStyle(1,DRAW_LINE);
       
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   for(int i=0; i<limit; i++)
    {
     double x=0.0,
            h = iHigh(NULL,0,i),
            l = iLow(NULL,0,i),
            o = iOpen(NULL,0,i),
            c = iClose(NULL,0,i);
     if     (c<o) { x=(h+l+c+l)/2;}
     else if(c>o) { x=(h+l+c+h)/2;}
     else if(c==o){ x=(h+l+c+c)/2;}
     Buf0[i]=((x-l)+(x-h))/2;
    }
     
   for(i=0; i<limit; i++)
    {
     Buf1[i]=iMAOnArray(Buf0,0,period,0,ma_method,i);
    } 
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments