Author: Copyright � 2006, ������ ��������
MATWO

This tool is designed to help traders visualize the relationship between different types of moving averages on a separate chart window. Rather than just showing the price movement itself, it focuses on the "gap" or "distance" between two specific mathematical models of market trends.

How the Logic Works

The script performs four simultaneous calculations to determine market momentum:

  1. Primary Comparison: It calculates two different types of moving averages based on a short timeframe (defined by the user). One is a simple weighted average, and the other is an exponential average based on closing prices.
  2. Secondary Comparison: It performs the exact same calculation but applies it to a longer timeframe (double the length of the first).

The Visual Output

The script then translates these four calculations into two distinct visual elements on your screen:

  • The Line Graph: This represents the current "spread" between the primary short-term moving averages. By multiplying this difference by a large factor, it makes the subtle fluctuations in price movement much more visible and easier to read on your screen.
  • The Histogram: This provides a cumulative view. It combines the difference from the long-term timeframe with the difference from the short-term timeframe. This gives you a broader perspective on whether the overall trend is accelerating or decelerating across different time scales simultaneously.

Summary for the Trader

Essentially, this tool strips away the "noise" of the price candles and highlights the underlying tension between different moving average models. When the gap between these averages widens or narrows, it serves as a visual cue regarding the strength of the current market trend.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
MATWO
//+------------------------------------------------------------------+
//|                                                        MATWO.mq4 |
//|                               Copyright © 2006, Âèêòîð ×åáîòàð¸â |
//|                                      http://www.chebotariov.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Âèêòîð ×åáîòàð¸â"
#property link      "http://www.chebotariov.com/"

extern int PERIOD = 8;

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Gray
#property indicator_color2 Red
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorShortName("MATWO");
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM);
   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 MA_Blue = iMA(NULL,0,PERIOD,0,MODE_SMA,PRICE_WEIGHTED,i);
      double MA_Red = iMA(NULL,0,PERIOD,0,MODE_EMA,PRICE_CLOSE,i);
      double MA_Blue2 = iMA(NULL,0,PERIOD*2,0,MODE_SMA,PRICE_WEIGHTED,i);
      double MA_Red2 = iMA(NULL,0,PERIOD*2,0,MODE_EMA,PRICE_CLOSE,i);

      ExtMapBuffer1[i]=((MA_Red2-MA_Blue2)+(MA_Red-MA_Blue))*1000000;
      ExtMapBuffer2[i]=(MA_Red-MA_Blue)*1000000;
      i--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments