Flat Trend MOM

Download script
Author: Copyright � 2006, Forex-TSD.com
Flat Trend MOM

This tool is designed as a visual trend filter for traders who want to identify the underlying momentum of a financial market. Instead of looking at raw price action alone, it processes the data to highlight whether the current market environment is favoring an upward or downward movement.

Core Functionality

The script utilizes a "Momentum" calculation—a mathematical way to measure how quickly prices are moving in a specific direction over a set timeframe (defined by the user). It evaluates this momentum against a neutral baseline of 100. By doing this, it effectively filters out market "noise" to help clarify the dominant trend.

How the Logic Works

The indicator operates by constantly scanning the most recent price data and categorizing the market into two distinct states:

  • Upward Momentum: When the calculated momentum value rises above the 100-point threshold, the script identifies an "Up Trend." This is represented visually on your chart as a positive histogram bar.
  • Downward Momentum: When the calculated momentum falls below the 100-point threshold, the script identifies a "Down Trend." This is represented by a negative histogram bar in a different color.

Visual Guidance for Traders

The primary purpose of this logic is to act as a "go/no-go" signal:

  • Trend Identification: By looking at the histogram, you can see at a glance whether the market is currently showing strength (Up) or weakness (Down).
  • Trade Filtering: The tool provides a specific guideline for traders—specifically suggesting that downward trades should be prioritized only when the "Down Trend" indicators are clearly active. If the momentum is neutral or positive, the visual bars will remain empty, signaling that the current conditions do not align with a bearish strategy.

In essence, this script simplifies complex price movement into a clear, binary visual aid, helping you stay aligned with the prevailing market flow.

Indicators Used
Momentum indicator
Miscellaneous
Implements a curve of type %1
14 Views
0 Downloads
0 Favorites
Flat Trend MOM
///+------------------------------------------------------------------

//|                                                 MomFilter_v1.mq4 

//|                                  Copyright © 2006, Forex-TSD.com 

//|                         Written by IgorAD,igorad2003@yahoo.co.uk 
   
//|            http://finance.groups.yahoo.com/group/TrendLaboratory 
                                      
//+------------------------------------------------------------------

#property copyright "Copyright © 2006, Forex-TSD.com "
#property link      "http://www.forex-tsd.com/"

#property indicator_separate_window
#property indicator_minimum -0.05
#property indicator_maximum 1.00
#property indicator_buffers 2
#property indicator_color1 DeepSkyBlue
#property indicator_color2 Red

//---- input parameters
extern int PeriodMOM=14;
//---- indicator buffers
double UpBuffer[];
double DnBuffer[];
//+------------------------------------------------------------------

//| Custom indicator initialization function                         

//+------------------------------------------------------------------

  int init()
  {
   string short_name;
//---- indicator line
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,4);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,4);
   SetIndexBuffer(0,UpBuffer);
   SetIndexBuffer(1,DnBuffer);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//---- name for DataWindow and indicator subwindow label
   short_name="MOM Filter("+PeriodMOM+")  (Down trade only when down bars are orange)";
   IndicatorShortName(short_name);
   SetIndexLabel(0,"UpTrend");
   SetIndexLabel(1,"DownTrend");
//----
   SetIndexDrawBegin(0,PeriodMOM);
   SetIndexDrawBegin(1,PeriodMOM);
//----
   return(0);
  }

//+------------------------------------------------------------------

//| MOMFilter_v1                                                     

//+------------------------------------------------------------------

int start()
  {
   int shift,trend;
   double MOM0;

   
   for(shift=Bars-PeriodMOM-1;shift>=0;shift--)
   {	
   MOM0=iMomentum(NULL,0,PeriodMOM,PRICE_CLOSE,shift);
   	
	  if (MOM0>100)  trend=1; 
	  if (MOM0<100)  trend=-1;
	  
	  if (trend>0) 
	  {
	  if (MOM0 > 100) UpBuffer[shift]=1.0;
	  else UpBuffer[shift] = EMPTY_VALUE;
	  DnBuffer[shift]=0;
	  }
	  if (trend<0) 
	  {
	  if (MOM0 < 100) DnBuffer[shift]=-1.0;
	  else DnBuffer[shift] = EMPTY_VALUE;
	  UpBuffer[shift]=0;
	  }
	}
	return(0);	
 }




//+------------------------------------------------------------------+

Comments