Author: Copyright � 2006, Victor Chebotariov
MAMy

This custom indicator is designed to provide traders with a visual representation of price momentum and relative movement by analyzing smoothed data trends. Instead of looking at raw, volatile price action, the tool processes information through a mathematical smoothing filter to create a cleaner narrative of the market's direction.

Core Logic and Functionality

The script functions by calculating three distinct types of "smoothed" values based on a user-defined timeframe (period) and a specific calculation method:

  1. Primary Close Reference: It identifies the current smoothed closing price to understand where the market is currently settling.
  2. Previous Open Reference: It looks at the smoothed opening price from the preceding period to establish a baseline for how far the price has moved since it last began its cycle.
  3. Weighted Midpoint: It identifies a weighted average point, which acts as a pivot or "anchor" for the current movement.

How the Data is Processed

The indicator then performs two specific calculations to generate the visual lines on your chart:

  • The First Line (Green): This represents a combined measurement of "momentum expansion." It calculates the gap between the weighted midpoint and the previous open, adds it to the difference between the current close and that same midpoint, and scales it for visibility. Essentially, it tracks the total "distance traveled" by the price relative to its starting point and its center weight.
  • The Second Line (Red): This line focuses specifically on the relationship between the current smoothed close and the weighted midpoint. It isolates how much the price has deviated from its central weighted average in the most recent movement.

Visual Purpose for the User

By plotting these two values in a separate window, the tool allows you to observe the "strength" of a trend. When the gaps between these lines widen or tighten, it provides a visual cue regarding whether the market is accelerating away from its mean or if it is beginning to consolidate. Because the results are multiplied by a factor of 1000, the movement is magnified, making it easier for the human eye to spot subtle shifts in price dynamics that might be overlooked on a standard price chart.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
MAMy
//+------------------------------------------------------------------+
//|                                                         MAMy.mq4 |
//|                             Copyright © 2006, Victor Chebotariov |
//|                                      http://www.chebotariov.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Victor Chebotariov"
#property link      "http://www.chebotariov.com/"
//----
extern int period = 3;
extern int ma_method = 3;
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorShortName("MAMy(" + period + ", " + ma_method + ")");
//---- indicators
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, ExtMapBuffer2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Accumulation/Distribution                                        |
//+------------------------------------------------------------------+
int start()
  {
   int i, counted_bars = IndicatorCounted();
//----
   i = Bars - counted_bars - 1;
   while(i >= 0)
     {
      double close    = iMA(NULL, 0, period, 0, ma_method, 0, i);
      double open     = iMA(NULL, 0, period, 0, ma_method, 1, i);
      double weighted = iMA(NULL, 0, period, 0, ma_method, 6, i);
      //----
      ExtMapBuffer1[i] = ((weighted - open) + (close - weighted))*1000;
      ExtMapBuffer2[i] = (close - weighted)*1000;
      i--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments