TSD_PP_MACD_FORCE_Ind_v1_v2

Download script
Author: Pedro Puado (From Elders Book)
TSD_PP_MACD_FORCE_Ind_v1_v2

This technical tool is designed to help traders identify specific market conditions by combining two different types of momentum and trend analysis across multiple timeframes. Instead of looking at a single chart, the logic pulls data from Weekly and Daily perspectives to spot "forced" moves or potential reversals.

How the Logic Works

The script functions by cross-referencing three main components:

1. The Weekly Trend (MACD) The tool first analyzes the "MACD" (Moving Average Convergence Divergence) on a Weekly timeframe. It looks at the relationship between two different moving averages to determine the overall long-term direction of the market. It identifies if the weekly momentum is currently trending upward or downward.

2. The Daily Strength (Force Index) Simultaneously, the tool calculates a "Force Index" based on Daily price action. This measures the strength of the current price movement. It essentially tells the script whether the daily market is exerting significant "force" in a positive or negative direction relative to its average.

3. The Combination Logic (The Signals) The core value of this tool lies in how it combines these two pieces of information. Rather than just showing you a trend, it looks for specific "conflicts" or "confirmations" between the Weekly and Daily data:

  • Bullish Opportunity: If the long-term Weekly trend is moving upward, but the short-term Daily force shows a negative reading (an opposing move), the tool highlights this as a potential point of interest.
  • Bearish Opportunity: If the long-term Weekly trend is moving downward, but the short-term Daily force shows a positive reading, the tool highlights this as well.

Summary for the Trader

In simple terms, the script acts like a filter. It ignores standard market noise by looking for specific moments where the daily "muscle" of the market is pushing in the opposite direction of the weekly "path." This allows traders to see potential exhaustion points or significant shifts in momentum that might not be obvious when looking at a single timeframe alone. The results are displayed as a histogram, making it easy to visualize these specific occurrences chronologically.

Indicators Used
MACD HistogramForce index
Miscellaneous
Implements a curve of type %1
15 Views
0 Downloads
0 Favorites
TSD_PP_MACD_FORCE_Ind_v1_v2
//+------------------------------------------------------------------+
//|                 TSD_PP_MACD_FORCE_Ind_v1.mq4                     |
//|                 (From Elders Book)                               |
//|                 Copyright ® 2005 Bob O'Brien / Barcode           |
//|                 TSD Indicator by Pedro Puado                     |
//|                 TSD Indicator version 1                          |
//+------------------------------------------------------------------+
#property copyright "Pedro Puado (From Elders Book)"
#property link      "http://www.metaquotes.net"
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//---- input parameters
extern int       Force=2;
extern int       FastMA=12;
extern int       SlowMA=26;
extern int       Signal=9;
extern int       MaxBars=1000;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexLabel(0,"Up");
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexLabel(1,"Down");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   double MacdPrevious, MacdPrevious2, force, ForcePos, ForceNeg;
   int    Direction;
//---- 
   int    i,k, nDay, nWeek;
   i=Bars-1;
   if(counted_bars>0) i=Bars-counted_bars+0;
   i=MathMin(i, MaxBars);
   //
   while(i >=0)
     {
      nWeek=GetWeekIndex(i);
      MacdPrevious =iMACD(Symbol(),PERIOD_W1,SlowMA,FastMA,Signal,PRICE_CLOSE,MODE_MAIN,nWeek+1);
      MacdPrevious2=iMACD(Symbol(),PERIOD_W1,SlowMA,FastMA,Signal,PRICE_CLOSE,MODE_MAIN,nWeek+2);
//----
      if (MacdPrevious > MacdPrevious2) Direction=1;
      if (MacdPrevious < MacdPrevious2) Direction=-1;
      if (MacdPrevious==MacdPrevious2) Direction=0;
//----
      nDay=GetDayIndex(i);
      force=iForce(Symbol(),PERIOD_D1,Force,MODE_EMA,PRICE_CLOSE,nDay+1);
      ForcePos=force > 0;
      ForceNeg=force < 0;
      Print(nWeek, " - ", Direction, " - ", nDay, " - ", Force);
//----
      if(Direction==1 && ForceNeg)
        {
         ExtMapBuffer1[i]=1;
         ExtMapBuffer2[i]=0.0;
        }
      if(Direction==-1 && ForcePos)
        {
         ExtMapBuffer1[i]=0.0;
         ExtMapBuffer2[i]=-1;
        }
      i--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int GetWeekIndex(int x)
  {
   datetime dSun=StrToTime(TimeToStr(Time[x]-(TimeDayOfWeek(Time[x])*86400),TIME_DATE));
   return(((iTime(Symbol(),PERIOD_W1,0)-dSun)/86400)/7);
  }
//+------------------------------------------------------------------+
int GetDayIndex(int x)
  {
   if (Period()==PERIOD_D1) return(x);
   int nWeek=GetWeekIndex(x)*5; //number of days since 
   datetime dSun=StrToTime(TimeToStr(Time[x],TIME_DATE));
   int i=MathAbs((iTime(Symbol(),PERIOD_D1,nWeek)-dSun)/86400);
   return(nWeek-i);
  }
//+------------------------------------------------------------------+

Comments