Author: Copyright � 2006, Victor Chebotariov
MAMy3

This tool is designed as a visual momentum and trend indicator that helps traders identify specific price movements by analyzing the relationship between different types of moving averages. Instead of just showing a single price line, it processes several layers of data to determine the strength and direction of the market.

How the Logic Works

1. Data Gathering The script starts by calculating three distinct values based on your chosen period and smoothing method:

  • The Close: Represents the current primary price action.
  • The Open: Represents the starting point of the price movement.
  • The Weighted Value: A specialized calculation used to determine the "balance" or underlying weight of the price move.

2. Identifying Momentum (Trend Strength) The core logic compares these values against their previous positions. It looks for specific "concurrence"—meaning it wants to see multiple conditions met at once. Specifically, it checks if the current price and its weighted counterparts are moving in the same direction as the previous bars while maintaining a specific hierarchy (for example, ensuring the weighted value stays between the open and close prices).

3. Signal Generation When these conditions are met, the indicator calculates two different outputs:

  • Trend Confirmation: If the price shows consistent strength and follows the required mathematical "path," the script generates a specific value that represents the total distance of the move.
  • Neutrality Filtering: If the price action is erratic or doesn't meet the strict trend criteria, the script zeroes out certain values. This effectively "cleans" the chart, ensuring that you only see active signals when the market is moving with high confidence.

4. Visual Behavior The indicator uses two different color lines (Green and Red) to display these results in a separate window below your main price chart.

  • It acts as a filter: it ignores "noise" and only highlights moments where the price movement is mathematically consistent.
  • It detects shifts: by comparing the current calculated values to the previous ones, it can identify when a trend is gaining speed or losing steam.

Summary for the User

In simple terms, this script acts like a filter. It looks at the "weight" of the price movement rather than just the raw numbers. It waits for the price to prove it is moving in a steady, consistent direction before highlighting that move on your screen. If the price is jumping around without a clear trend, the indicator stays quiet; if the price shows a strong, organized push, the indicator reflects that momentum visually.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
MAMy3
//+------------------------------------------------------------------+
//|                                                     MAMy v.3.mq4 |
//|                             Copyright © 2006, Victor Chebotariov |
//|                                      http://www.chebotariov.com/ 
//  MAO, MAC, MAohlc/4
//|
//+------------------------------------------------------------------+
#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[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorShortName("MAMy3 (" + period + ", " + ma_method + ")");
//---- indicators
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, ExtMapBuffer2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
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);
      
       double close1    = iMA(NULL, 0, period, 0, ma_method, 0, i + 1);
       double open1     = iMA(NULL, 0, period, 0, ma_method, 1, i + 1);
       double weighted1 = iMA(NULL, 0, period, 0, ma_method, 6, i + 1);

       ExtMapBuffer2[i] = (close - weighted)*1000;
       if((close < close1 && weighted < weighted1 && close < weighted && 
          weighted < open && weighted1 < open1 && 
          ExtMapBuffer2[i] <= ExtMapBuffer2[i+1]) || 
          (close > close1 && weighted > weighted1 && 
          close>weighted && weighted > open && weighted1>open1 && 
          ExtMapBuffer2[i] >= ExtMapBuffer2[i+1]))
         {
           ExtMapBuffer1[i] = ((weighted - open) + (close - weighted))*1000;
         }
       else
           ExtMapBuffer1[i] = 0;
       if(ExtMapBuffer1[i] >= 0 && ExtMapBuffer1[i] > ExtMapBuffer1[i+1] && 
          ExtMapBuffer2[i] < 0 && ExtMapBuffer2[i+1] >= 0)
         {
           ExtMapBuffer2[i] = 0;
         }
       else
           ExtMapBuffer2[i] = (close - weighted)*1000;
       i--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments