Brooky_Strength_rev_1

Download script
Author: Copyright � 2010,Brooky
Brooky_Strength_rev_1

This script is designed to measure and visualize the relative strength of a specific base currency against a group of other currencies. Instead of looking at just one pair, it analyzes how a "Main Currency" (like the USD) is performing across multiple different markets simultaneously to provide a broader picture of its overall market power.

Core Logic and Mechanism

1. Currency Grouping & Identification When you load the tool, it first looks at the list of currency pairs you have provided. It automatically identifies which currency is the common denominator (the "Main Currency"). For example, if you provide several pairs involving the US Dollar, the script identifies the USD as the primary focus and categorizes all other currencies in those pairs as secondary components.

2. Momentum Analysis The script determines the strength of each individual pair by comparing two different types of moving averages (a "Fast" moving average and a "Slow" moving average). It looks for three specific signals in the price action:

  • Strong Upward Momentum: If the fast average is above the slow average and trending upward, it records a high positive score.
  • Weakening Upward Momentum: If the fast average is above the slow average but starting to turn down, it records a mid-range positive score.
  • Strong Downward Momentum: If both averages are trending downward, it records a high negative score.
  • Weakening Downward Momentum: If the averages are low but starting to tick up, it records a mid-range negative score.

3. Weighting and Calculation Not all currency pairs influence the "Strength" equally. The script distinguishes between:

  • Major Currencies: These carry more weight in the final calculation.
  • Minor Currencies: These are weighted differently to ensure the final score accurately reflects the broader market sentiment rather than just a single isolated trade.

The tool then sums these individual scores from all selected pairs and applies a mathematical multiplier. This results in a single, unified "Strength Value."

4. Visual Representation (The Indicator) The script produces two distinct lines on your chart window:

  • Data Line: This shows the raw strength calculation based on the currency group logic.
  • Smoothing Line (Signal): To make the data easier to read and filter out "noise" or erratic price jumps, the script applies a secondary smoothing process to the data. This helps traders see the clearer underlying trend of the currency's strength.

How to Interpret the Results

The indicator operates on a scale. By looking at where the lines sit relative to the levels (such as 8, 0, and -8):

  • Positive Values: Indicate that the Main Currency is currently showing strength against the group of currencies provided.
  • Negative Values: Indicate that the Main Currency is losing strength or weakening against the group.
  • The Smoothing Line: Acts as a guide to help you identify when the momentum is truly shifting versus just experiencing a temporary fluctuation.
Indicators Used
Moving average indicatorMoving average indicator
Miscellaneous
Implements a curve of type %1
2 Views
0 Downloads
0 Favorites
Brooky_Strength_rev_1
//+------------------------------------------------------------------+
//|                                        Brooky_Strength_Rev_1.mq4 |
//|                                          Copyright © 2010,Brooky |
//|                               http://forex-indicators.weebly.com |
//|                     Modified by Pat1 forexfactory.pat1@gmail.com |    
//+------------------------------------------------------------------+

#property copyright "Copyright © 2010,Brooky"
#property link      "http://forex-indicators.weebly.com"

#define Major 1
#define Minor -1
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 C'47,47,47'
#property indicator_color2 DodgerBlue
#property indicator_width1 1
#property indicator_width2 2
#property indicator_level1 8
#property indicator_level2 0
#property indicator_level3 -8

#property indicator_levelcolor Yellow
#property indicator_levelstyle STYLE_DOT
#property indicator_maximum 10.5
#property indicator_minimum -10.5

extern string Author_Site = "Forex-Indicators.weebly.com";
extern string Pair1 = "USDCHF";
extern string Pair2 = "USDJPY";
extern string Pair3 = "USDCAD";
extern string Pair4 = "AUDUSD";
extern string Pair5 = "EURUSD";
extern string Pair6 = "GBPUSD";
extern string Pair7 = "NZDUSD";


extern string Checking_MAs = "Fast v Slow Checks";
extern int slow_check_ma = 55;
extern int fast_check_ma = 34;
extern string Data_Smoothie = "Smoothing Line";
extern int sig_smooth = 15;
extern string Checking_TF = "Timeframe 0 is current";
extern int check_tf = 0;
string Pairs[7];
int PairType[7];
//---- buffers
double data_buffer[];
double sig_buffer[];
int i;
double multiplier = -1.4285714285714285714285714285714;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   Pairs[0]=Pair1;
   Pairs[1]=Pair2;
   Pairs[2]=Pair3;
   Pairs[3]=Pair4;
   Pairs[4]=Pair5;
   Pairs[5]=Pair6;
   Pairs[6]=Pair7;


   string a =StringSubstr(Pairs[0],0,3);
   string b =StringSubstr(Pairs[0],3,3);
   string a1=StringSubstr(Pairs[1],0,3);
   string b1=StringSubstr(Pairs[1],3,3);
   
   if(a==a1 || a==b1)string MainCurrency=a; else MainCurrency=b;
   for(int j=0;j<7;j++)
   {
         if(StringSubstr(Pairs[j],0,3)==MainCurrency){PairType[j]=Major;Print(Pairs[j],"  1");}
    else if(StringSubstr(Pairs[j],3,3)==MainCurrency){PairType[j]=Minor;Print(Pairs[j]," -1");}
    else 
    {string com=StringConcatenate("This Currency ",Pairs[j]," is not a part of the Main Currency ",MainCurrency," group - Indicator aborted");
    Print(com);
    Comment(com);
    return(0);}
   }
   

   SetIndexBuffer(0,data_buffer);SetIndexStyle(0,DRAW_LINE);
   
   SetIndexStyle(1,DRAW_LINE);SetIndexBuffer(1,sig_buffer);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("forex-indicators.weebly.com "
                       +"("+MainCurrency+" Strength Effect)"
                        );   

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
   int start()
   {
      int limit;
      int counted_bars=IndicatorCounted();
      //---- check for possible errors
      if(counted_bars<0) return(-1);
      //---- the last counted bar will be recounted
      if(counted_bars>0) counted_bars--;
      limit=Bars-counted_bars;
      //---- main loop
      for( i=0; i<limit; i++)
      {
         
         int c=0; 
         for(int j=0;j<7;j++)c+=get_c(j);
         data_buffer[i]=c*multiplier;
      }
      for(i=0; i<limit; i++)
      {
      sig_buffer[i]=iMAOnArray(data_buffer,0,sig_smooth,0,MODE_LWMA,i);
      Comment("Level ("+DoubleToStr(sig_buffer[i],1)+")");
      }
      //---- done
      return(0);
   }
//+------------------------------------------------------------------+

double get_c(int j)
{
      double maf1=iMA(Pairs[j],check_tf,fast_check_ma,0,MODE_LWMA,PRICE_CLOSE,i+1);
      double maf0=iMA(Pairs[j],check_tf,fast_check_ma,0,MODE_LWMA,PRICE_CLOSE,i);
      double mas0=iMA(Pairs[j],check_tf,slow_check_ma,0,MODE_LWMA,PRICE_CLOSE,i);
      int c=0;
      if(maf0 > mas0 && maf0 > maf1)c= 1.0 ;
      if(maf0 > mas0 && maf0 < maf1)c= 0.5 ;                
      if(maf0 < mas0 && maf0 < maf1)c=-1.0 ;
      if(maf0 < mas0 && maf0 > maf1)c=-0.5 ;
      c=c*PairType[j];
      return(c);

}

Comments