MTF_AbsoluteStrength_v1DH

Download script
Author: Copyright � 2006, TrendLaboratory Ltd.
MTF_AbsoluteStrength_v1DH

This tool is designed to measure and visualize the "Absolute Strength" of a currency pair or asset by identifying the momentum between buyers (Bulls) and sellers (Bears). It provides traders with a visual representation of which side currently holds the advantage in the market.

Core Functionality

The script calculates market strength based on two primary methodologies that you can choose from:

  • RSI Method: Uses Relative Strength Index logic to determine price velocity.
  • Stochastic Method: Analyzes the current price position relative to a specific high/low range over a set period.

Key Features and Logic

1. Multi-Timeframe (MTF) Integration One of the most significant features of this script is its ability to "look ahead" at higher timeframes while you are viewing a smaller one. For example, you can stay on a 5-minute chart but view the strength data from the 4-hour or Daily charts. This allows traders to see the "big picture" trends without switching screens.

2. Data Smoothing and Signaling To prevent the data from being too erratic or "noisy," the script employs several layers of processing:

  • Smoothing: It applies a smoothing period to the raw strength data to highlight consistent trends rather than momentary spikes.
  • Signal Lines: It generates specific signal lines that help identify potential turning points or shifts in momentum.
  • Moving Averages: You can customize how these averages are calculated (e.g., Simple, Exponential, Smoothed, or Linear Weighted) to suit your preferred trading style.

3. Visual Representation The indicator populates a separate window on your trading platform with four primary visual elements:

  • Bulls and Bears Histograms: These provide a clear visual of the volume/strength of buying vs. selling pressure.
  • Signal Lines: These track the moving averages of that strength, helping to confirm if the momentum is accelerating or decelerating.

4. Smart Buffer Refreshing The logic includes a specific mechanism to ensure that when viewing higher timeframes, the data remains visually consistent. It "refreshes" the information across the bars of your current chart so that the multi-timeframe data doesn't appear jagged or disconnected, but rather flows smoothly across your active screen.

How it Helps a Trader

By using this script, a trader can quickly identify:

  • Dominance: Who is winning the fight—the buyers or the sellers?
  • Trend Context: Is the current price movement supported by strong momentum on a higher timeframe?
  • Exhaustion: When strength reaches extremes, it may indicate that a trend is becoming overextended and could be due for a reversal.
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
MTF_AbsoluteStrength_v1DH
//+------------------------------------------------------------------+
//| www.forex-tsd.com jerseydevil2   (Diff_Hist)    MTF_AbsoluteStrength_v1DH .mq4 |
//|                          Copyright © 2006, TrendLaboratory Ltd. |
//|            http://finance.groups.yahoo.com/group/TrendLaboratory |
//|                                       E-mail: igorad2004@list.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, TrendLaboratory Ltd."
#property link      "http://finance.groups.yahoo.com/group/TrendLaboratory"

#property indicator_separate_window
#property indicator_buffers   4
#property indicator_color1    LightBlue
#property indicator_color2    Tomato
#property indicator_color3    Aqua
#property indicator_color4    Orange
#property indicator_width1    1 
#property indicator_width2    1
#property indicator_width3    1
#property indicator_width4    1 
#property indicator_style3    3 
#property indicator_style4    3
//---- input parameters
extern int TimeFrame=0;
extern int       Mode =  0; // 0-RSI method; 1-Stoch method
extern int       Length = 10; // Period
extern int       Smooth =  5; // Period of smoothing
extern int       Signal =  5; // Period of Signal Line
extern int       Price  =  0; // Price mode : 0-Close,1-Open,2-High,3-Low,4-Median,5-Typical,6-Weighted
extern int       ModeMA =  3; // Mode of Moving Average: SMA0,EMA1,SmdMA2,LWMA3

//---- buffers
double Bulls[];
double Bears[];
double AvgBulls[];
double AvgBears[];
double SmthBulls[];
double SmthBears[];
double SigBulls[];
double SigBears[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(8);
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,SmthBulls);
   SetIndexStyle(1,0);
   SetIndexBuffer(1,SmthBears);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,SigBulls);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,SigBears);
   SetIndexBuffer(4,Bulls);
   SetIndexBuffer(5,Bears);
   SetIndexBuffer(6,AvgBulls);
   SetIndexBuffer(7,AvgBears);
//---- name for DataWindow and indicator subwindow label
   string short_name="MTF_AbsoluteStrength["+TimeFrame+"]"+Mode+","+Length+","+Smooth+","+Signal+","+ModeMA+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,"Bulls; tf("+TimeFrame+")");
   SetIndexLabel(1,"Bears; tf("+TimeFrame+")");
   SetIndexLabel(2,"SignalBulls; tf("+TimeFrame+")");
   SetIndexLabel(3,"SignalBears; tf("+TimeFrame+")");      
//----
   SetIndexDrawBegin(0,Length+Smooth+Signal);
   SetIndexDrawBegin(1,Length+Smooth+Signal);
   SetIndexDrawBegin(2,Length+Smooth+Signal);
   SetIndexDrawBegin(3,Length+Smooth+Signal);
   
   //MTF
//---- name for DataWindow and indicator subwindow label   
   switch(TimeFrame)
   {
      case 1 : string TimeFrameStr="Period_M1"; break;
      case 5 : TimeFrameStr="Period_M5"; break;
      case 15 : TimeFrameStr="Period_M15"; break;
      case 30 : TimeFrameStr="Period_M30"; break;
      case 60 : TimeFrameStr="Period_H1"; break;
      case 240 : TimeFrameStr="Period_H4"; break;
      case 1440 : TimeFrameStr="Period_D1"; break;
      case 10080 : TimeFrameStr="Period_W1"; break;
      case 43200 : TimeFrameStr="Period_MN1"; break;
      default : TimeFrameStr="Current Timeframe";
  }

   return(0);
  }
//+------------------------------------------------------------------+
//| MTF                                                              |
//+------------------------------------------------------------------+
int start()
  {
   datetime TimeArray[];
   int    i,limit,y=0,counted_bars=IndicatorCounted();
 
// Plot defined time frame on to current time frame
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); 
   
   limit=Bars-counted_bars+TimeFrame/Period();
   for(i=0,y=0;i<limit;i++)
   {
   if (Time[i]<TimeArray[y]) y++;

/***********************************************************   
   Add your main indicator loop below.  You can reference an existing
      indicator with its iName  or iCustom.
   Rule 1:  Add extern inputs above for all neccesary values   
   Rule 2:  Use 'TimeFrame' for the indicator time frame
   Rule 3:  Use 'y' for your indicator's shift value
 **********************************************************/  
 
   SmthBulls[i]=iCustom(NULL,TimeFrame,"AbsoluteStrength_v1DH",Mode,Length,Smooth,Signal,Price,ModeMA,0,y); 
   SmthBears[i]=iCustom(NULL,TimeFrame,"AbsoluteStrength_v1DH",Mode,Length,Smooth,Signal,Price,ModeMA,1,y); 
   SigBulls[i]=iCustom(NULL,TimeFrame,"AbsoluteStrength_v1DH",Mode,Length,Smooth,Signal,Price,ModeMA,2,y); 
   SigBears[i]=iCustom(NULL,TimeFrame,"AbsoluteStrength_v1DH",Mode,Length,Smooth,Signal,Price,ModeMA,3,y); 
   Bulls[i]=iCustom(NULL,TimeFrame,"AbsoluteStrength_v1DH",Mode,Length,Smooth,Signal,Price,ModeMA,4,y); 
   Bears[i]=iCustom(NULL,TimeFrame,"AbsoluteStrength_v1DH",Mode,Length,Smooth,Signal,Price,ModeMA,5,y); 
   AvgBulls[i]=iCustom(NULL,TimeFrame,"AbsoluteStrength_v1DH",Mode,Length,Smooth,Signal,Price,ModeMA,6,y); 
   AvgBears[i]=iCustom(NULL,TimeFrame,"AbsoluteStrength_v1DH",Mode,Length,Smooth,Signal,Price,ModeMA,7,y); 
 
   }  
     //----  Refresh buffers ++++++++++++++++++++ upgrade by Raff  
     int TimeFrame;   if (TimeFrame>Period()) {
     int PerINT=TimeFrame/Period()+1;
     datetime TimeArr[]; ArrayResize(TimeArr,PerINT);
     ArrayCopySeries(TimeArr,MODE_TIME,Symbol(),Period()); 
     for(i=0;i<PerINT+1;i++) {if (TimeArr[i]>=TimeArray[0]) {
 /********************************************************  
    Refresh buffers:         buffer[i] = buffer[0];
 ********************************************************/  

      SmthBulls[i] = SmthBulls[0];
      SmthBears[i] = SmthBears[0];
      SigBulls[i]  = SigBulls[0];
      SigBears[i]  = SigBears[0];
      Bulls[i]     = Bulls[0];
      Bears[i]     = Bears[0];
      AvgBulls[i]  = AvgBulls[0];
      AvgBears[i]  = AvgBears[0];
 
 //--
   } } }
//+++++++++++++++++++++++++++++++++++++++++++++++++++  Raff  
    
//
   return(0);
  }
//+++++++++++++

Comments