MTF_AbsoluteStrength_v1.1_SideBarM2

Download script
Author: Copyright � 2006, TrendLaboratory Ltd.
MTF_AbsoluteStrength_v1.1_SideBarM2

This script is a specialized technical analysis tool designed to interpret and visualize market momentum by analyzing data from higher timeframes. It essentially acts as a multi-layered filter, taking complex underlying price movements and distilling them into clear visual signals for traders.

Core Logic Overview

The primary purpose of this script is Multi-Timeframe (MTF) Analysis. Instead of just looking at the current chart's immediate fluctuations, it "reaches out" to a different, larger timeframe (which you can define in the settings) to see what the broader market trend looks like. It then projects those findings onto your current screen.

How the Analysis Works

The script processes data through several logic layers:

1. Momentum Calculation It uses an underlying method (either based on RSI or Stochastic oscillators) to determine the "Absolute Strength" of both buyers (Bulls) and sellers (Bears). It looks at these forces across a specific period, applies smoothing to remove "noise," and generates a signal line.

2. Trend Identification By comparing the smoothed strength of bulls against the smoothed strength of bears, the script identifies five distinct market states:

  • Strong Bullish Move: Occurs when bullish strength significantly exceeds bearish strength and crosses above the primary signal threshold.
  • Bullish Correction: Occurs when the market is still leaning toward the upside but shows signs of pulling back or consolidating.
  • Strong Bearish Move: Occurs when bearish strength dominates the market and drops below key signal thresholds.
  • Bearish Correction: Occurs when the market is primarily in a downtrend but exhibits temporary "relief" rallies.
  • No Interest / Neutral Zone: This identifies areas where neither side has enough momentum to provide a clear direction, signaling a period of equilibrium or low volatility.

3. Conflict Detection The script also includes logic to detect "Two Forces On." This is a specific warning state where both buyers and sellers are showing high levels of activity simultaneously. In trading terms, this suggests a high-volatility "tug-of-war" where the market direction is uncertain.

Visual Representation

To make this data easy to read at a glance, the script uses a series of visual markers (arrows/squares) with specific color-coding:

  • Blue / Dodger Blue: Indicates different levels of upward momentum (Strong vs. Correction).
  • Red / Tomato: Indicates different levels of downward momentum (Strong vs. Correction).
  • Gold: Acts as a caution signal for "Two Forces On."
  • White: Marks the "No Trade Zone" where there is insufficient trend strength.

Summary for the User

Essentially, this tool saves you from having to manually switch between different charts. It calculates the "mood" of a larger timeframe and tells you—in real-time on your current chart—whether the big players are pushing the price up, down, pulling back, or if the market is currently in a state of indecision.

Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
MTF_AbsoluteStrength_v1.1_SideBarM2
//+-------------------------------------------------------------------------------+
//| MTF_ASv1.1DHsBarM2:     SideBar                  AbsoluteStrength_v1.1 & MTF  |
//|                                        Copyright © 2006, TrendLaboratory Ltd. |
//|                         http://finance.groups.yahoo.com/group/TrendLaboratory |
//|   www.ForexTSD.com                                 E-mail: igorad2004@list.ru |
//|            Signals according to Igorad & Newdigital Rules    (cattus)     ik  |    
//+-------------------------------------------------------------------------------+

#property copyright "Copyright © 2006, TrendLaboratory Ltd."
#property link      "http://finance.groups.yahoo.com/group/TrendLaboratory"

#property indicator_separate_window
#property indicator_maximum 77
#property indicator_minimum 1
#property indicator_buffers   8
#property indicator_color1    LightBlue //Histogram>0
#property indicator_width1    1
#property indicator_color2    Sienna //LightSeaGreen //Line// Histogram<0
#property indicator_width2    1 
#property indicator_color3    Blue //Signal StrongUp
#property indicator_width3    1 
#property indicator_color4    DodgerBlue //Signal Up
#property indicator_width4    1 
#property indicator_color5    Red //Signal StrongDown
#property indicator_width5    1 
#property indicator_color6    Tomato//IndianRed //Signal Down
#property indicator_width6    1 
#property indicator_color7    Gold //Two forces strong
#property indicator_width7    1 
#property indicator_color8    White //Signal No Interest
#property indicator_width8    1 

//---- input parameters
extern int       TimeFrame=0;

extern int ASBarLevel = 20; // bar location in sep.windpw(from 1(min) to 77(max))
extern int       Mode =  0; // 0-RSI method; 1-Stoch method
extern string    note1 = "ASBarLevel:1-77;Mode:RSI-0;Stoch1;ADX2";
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
extern string    note2 = "Price(OCHLMTF)ModeMa(SMA0,EMA1,SmmMA2,LWMA3";
extern string    Signals_Up = "StrongUp,Correction: Blue,DogerBlue";
extern string    Signals_Down = "StrongDn,Correction: Red,IndianRed";
extern string    Sinal_TwoForcesOn = "Caution, DirChangePosbl:TwoForcesOn; Yellow";
extern string    Sinal_NoInterest = "NoTradeZone-NoInterest:Bulls&BearsDown; White";

/*************************************************************************
PERIOD_M1   1
PERIOD_M5   5
PERIOD_M15  15
PERIOD_M30  30 
PERIOD_H1   60
PERIOD_H4   240
PERIOD_D1   1440
PERIOD_W1   10080
PERIOD_MN1  43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
---------------------------------------
MODE_SMA    0 Simple moving average, 
MODE_EMA    1 Exponential moving average, 
MODE_SMMA   2 Smoothed moving average, 
MODE_LWMA   3 Linear weighted moving average. 
You must use the numeric value of the MA Method that you want to use
when you set the 'ma_method' value with the indicator inputs.

**********************************************************/

//---- buffers
double Bulls[];
double Bears[];
double AvgBulls[];
double AvgBears[];

double SmthBulls[];
double SmthBears[];
double SigBulls[];
double SigBears[];

double Bulls_Bears[];
double Bears_Bulls[];

double SigStrongUp[];
double SigUpCorrection[];
double SigStrongDown[];
double SigDownCorrection[];
double SigTwoForcesOn[];
double SigNoTrade[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
 //  IndicatorBuffers(8);
   SetIndexBuffer(0,Bulls_Bears);
   SetIndexStyle(0,DRAW_ARROW);
    SetIndexArrow(0,59);  //square:110//(hollow square:111,112;//59;250;249-hollow rectangle)//
   SetIndexBuffer(1,Bears_Bulls);   
  SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,59); 
      
   SetIndexBuffer(2,SigStrongUp);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,159);
      
   SetIndexBuffer(3,SigUpCorrection);
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(3,159);
      
   SetIndexBuffer(4,SigStrongDown);
   SetIndexStyle(4,DRAW_ARROW);
   SetIndexArrow(4,159);
      
   SetIndexBuffer(5,SigDownCorrection);
   SetIndexStyle(5,DRAW_ARROW);
   SetIndexArrow(5,159);
   
   SetIndexBuffer(6,SigTwoForcesOn);
   SetIndexStyle(6,DRAW_ARROW);
   SetIndexArrow(6,159);
   
   SetIndexBuffer(7,SigNoTrade);
   SetIndexStyle(7,DRAW_ARROW);
   SetIndexArrow(7,159);



//    SetIndexEmptyValue(4,EMPTY_VALUE);
//---- name for DataWindow and indicator subwindow label
   string short_name="MTF_AbsStrDHs["+TimeFrame+"]"+Mode+","+Length+","+Smooth+","+Signal+","+ModeMA+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,"Bulls/Bears; tf("+TimeFrame+")");
   SetIndexLabel(1,"Bears/Bulls; tf("+TimeFrame+")");
   SetIndexLabel(2,"StrongUp,tf("+TimeFrame+")");
   SetIndexLabel(3,"UpCorr,tf("+TimeFrame+")");      
   SetIndexLabel(4,"StrongDown,tf("+TimeFrame+")");
   SetIndexLabel(5,"DownCorr,tf("+TimeFrame+")");
   SetIndexLabel(6,"TwoForcesOn("+TimeFrame+")");
   SetIndexLabel(7,"NoTrade("+TimeFrame+")");

//----
   SetIndexDrawBegin(0,Length+Smooth+Signal);
   SetIndexDrawBegin(1,Length+Smooth+Signal);
   SetIndexDrawBegin(2,Length+Smooth+Signal);
   SetIndexDrawBegin(3,Length+Smooth+Signal);
   SetIndexDrawBegin(4,Length+Smooth+Signal);
   SetIndexDrawBegin(5,Length+Smooth+Signal);
   SetIndexDrawBegin(6,Length+Smooth+Signal);
   SetIndexDrawBegin(7,Length+Smooth+Signal);
            
//---- 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
 **********************************************************/  

   
double SmthBulls   =iCustom(NULL,TimeFrame,"AbsoluteStrength_v1.1",  Mode, Length,Smooth, Signal, Price, ModeMA,0,0,0,y);
double SmthBears   =iCustom(NULL,TimeFrame,"AbsoluteStrength_v1.1",  Mode, Length,Smooth, Signal, Price, ModeMA,0,0,1,y);
double SigBulls    =iCustom(NULL,TimeFrame,"AbsoluteStrength_v1.1",  Mode, Length,Smooth, Signal, Price, ModeMA,0,0,2,y);
double SigBears    =iCustom(NULL,TimeFrame,"AbsoluteStrength_v1.1",  Mode, Length,Smooth, Signal, Price, ModeMA,0,0,3,y);

      SigStrongUp[i] = EMPTY_VALUE;
      SigUpCorrection[i] = EMPTY_VALUE;
      SigStrongDown[i] = EMPTY_VALUE;
      SigDownCorrection[i] = EMPTY_VALUE;
      SigTwoForcesOn[i] = EMPTY_VALUE;
      SigNoTrade[i] = EMPTY_VALUE;
      Bulls_Bears[i] = EMPTY_VALUE; 
      Bears_Bulls[i] = EMPTY_VALUE;
  
      if(SmthBulls>=SmthBears && SmthBulls>=SigBulls && SmthBears<SigBears) SigStrongUp[i] = ASBarLevel;//Blue
      if(SmthBulls>=SmthBears && SmthBulls<SigBulls && SmthBears>=SigBears) SigUpCorrection[i] = ASBarLevel;//DodgerBlue UpCorrection 
      
      if(SmthBulls<SmthBears && SmthBulls<SigBulls && SmthBears>=SigBears) SigStrongDown[i] = ASBarLevel;//Red
      if(SmthBulls<SmthBears && SmthBulls>=SigBulls && SmthBears<SigBears) SigDownCorrection[i] = ASBarLevel;//IndianRed DnCorrection 
      
      if(SmthBears>SigBears && SmthBulls>SigBulls) SigTwoForcesOn[i] = ASBarLevel;//Gold
      if(SmthBulls<SigBulls && SmthBears<SigBears) SigNoTrade[i] = ASBarLevel;//White

      if(SmthBulls>SmthBears) Bulls_Bears[i] = 3+ASBarLevel;//LightBlue
      if(SmthBulls<=SmthBears) Bears_Bulls[i] = 3+ASBarLevel;//IndianRed

   
   }  


//
    //----  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];
 ********************************************************/  

    Bulls_Bears[i] =  Bulls_Bears[0];
    Bears_Bulls[i] = Bears_Bulls[0];
    //  SigBulls[i] = SigBulls[0];
   //   SigBears[i] = SigBears[0];
      SigStrongUp[i] = SigStrongUp[0];
      SigUpCorrection[i] = SigUpCorrection[0];
      SigStrongDown[i] = SigStrongDown[0];
      SigDownCorrection[i] = SigDownCorrection[0];
      SigTwoForcesOn[i] = SigTwoForcesOn[0];
      SigNoTrade[i]= SigNoTrade[0];
 
 //--
   } } }
//+++++++++++++++++++++++++++++++++++++++++++++++++++  Raff  

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


Comments