Author: Copyright � 2005, adoleh2000
TTM_v1

This tool is designed to provide a visual representation of market momentum by filtering out "noise" and identifying the prevailing direction of price action. Rather than showing every single fluctuation in price, it focuses on highlighting significant moves while simplifying the overall trend for the trader.

How the Logic Works

1. Establishing the Trend Boundaries The script begins by analyzing a specific window of recent price data (defined by a user-set period). It calculates two moving averages: one based on the highest prices reached and another based on the lowest prices reached during that timeframe. By calculating the difference between these two averages, the tool establishes a "volatility zone" for the current market movement.

2. Defining Action Zones The script then divides this volatility zone into three distinct sections. It creates specific mathematical boundaries (the "low third" and "high third") to separate the price action into different categories:

  • High Momentum Area: Where price is pushed strongly toward the top of the range.
  • Neutral Zone: A middle area where price movement is considered indecisive or consolidating.
  • Low Momentum Area: Where price is pulled strongly toward the bottom of the range.

3. Visual Filtering (The Histogram) This is where the most important logic occurs. The tool looks at where the current candle closes relative to those boundaries:

  • Bullish Identification: If a price candle closes above the high boundary, the script recognizes strong upward momentum. It then plots a specific visual mark on the chart to highlight this strength.
  • Bearish Identification: If a price candle closes below the low boundary, the script recognizes strong downward momentum and plots a corresponding mark.
  • Filtering the Noise: If a candle closes within the middle "neutral" zone, the script essentially ignores it in its visual output.

The End Result for the Trader

By using this logic, the tool provides a cleaned-up view of the market. Instead of seeing every minor wiggle of the price, the user is presented with a clear visual history of only the most significant movements. It helps traders distinguish between periods of high-conviction movement (where momentum is clear) and periods of sideways consolidation (where the market is unsure), allowing for a much clearer perspective on the dominant trend.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
TTM_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                          TTM.mq4 |
//|                             Copyright © 2005, adoleh2000 and dwt5|
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
//| Based on code offered at MT Yahoo group                          |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, adoleh2000"
#property link      "adoleh2000@yahoo.com"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 EMPTY
#property indicator_color4 EMPTY



//---- input parameters
extern int TTMperiod=6;
//---- buffers
double HighBuffer[];
double LowBuffer[];
double  Low_ma,
	     High_ma,
	     Low_third[],
	     High_third[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2);
   SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,2);

 
   SetIndexBuffer(0,HighBuffer);
   SetIndexBuffer(1,LowBuffer);
   SetIndexBuffer(2,High_third);
   SetIndexBuffer(3,Low_third);


//---- name for DataWindow and indicator subwindow label
   short_name="TTM";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);

//----
   SetIndexDrawBegin(0,10);
   SetIndexDrawBegin(1,10);
   SetIndexDrawBegin(2,10);
   SetIndexDrawBegin(3,10);

//----

   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here

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

//---- TODO: add your code here
if (counted_bars==0) counted_bars=TTMperiod+1;
i=(Bars-counted_bars);

for (shift=i; shift>=0;shift--)
{

Low_ma= iMA(NULL,0,TTMperiod,0,MODE_EMA,PRICE_LOW,shift);
High_ma = iMA(NULL,0,TTMperiod,0,MODE_EMA,PRICE_HIGH,shift);
Low_third[shift] = (High_ma- Low_ma) / 3 + Low_ma;
High_third[shift] = 2 * (High_ma- Low_ma) / 3 + Low_ma;

//Comment ("Low_third=",Low_third[shift],"; ","High_third=",High_third[shift]);

if (Close[shift] > High_third[shift]) 
   { 
      HighBuffer[shift]=High[shift];
      LowBuffer[shift]=Low[shift]; 
   }
   
   else

if (Close[shift] < Low_third[shift]) 
   { 
      LowBuffer[shift]=High[shift];
      HighBuffer[shift]=Low[shift];
    }


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

Comments