acc_dist_graph_gbp

Download script
Author: Copyright � 2009, sHrung.
acc_dist_graph_gbp

This tool is designed as a specialized visual indicator for the MetaTrader platform, specifically tailored to track the relative strength or accumulation/distribution of the British Pound (GBP) against a specific basket of currencies. Instead of looking at just one exchange rate, it synthesizes data from four different currency pairs to provide a more comprehensive view of the Pound's market position.

Core Functionality

The logic operates by monitoring the following four currency pairings simultaneously:

  • GBP/USD (British Pound vs. US Dollar)
  • EUR/GBP (Euro vs. British Pound)
  • GBP/JPY (British Pound vs. Japanese Yen)
  • GBP/CHF (British Pound vs. Swiss Franc)

How the Logic Works

The script performs a mathematical "weighting" of these four pairs to generate a single consolidated line on your chart. To achieve this, it follows a specific calculation sequence:

  1. Data Collection: The indicator looks back over a user-defined period (defaulting to 1,000 bars) and gathers the technical data for each of the four currency pairs listed above.
  2. Synthesis: It combines these values using a specific additive and subtractive formula:
    • It adds the values of GBP/USD, GBP/JPY, and GBP/CHF.
    • It subtracts the value of EUR/GBP.
  3. Visual Output: The result of this calculation is plotted as a single continuous line in a separate window on your trading platform.

Purpose for the Trader

By combining these different markets into one visual representation, the tool aims to filter out the "noise" of individual currency fluctuations. Because it accounts for four different global markets at once, the resulting line serves as a composite indicator of the British Pound's momentum. This allows traders to see a more holistic view of the currency's strength or weakness relative to a broad basket of major global economies, rather than relying on a single pair alone.

Indicators Used
Accumulation/Distribution indicator
Miscellaneous
Implements a curve of type %1
20 Views
0 Downloads
0 Favorites
acc_dist_graph_gbp

#property copyright "Copyright © 2009, sHrung."
#property link      "http://www.something.com/"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 LimeGreen

//---- input parameters
extern int MomPeriod=1000;
//---- buffers
//--- currencies 
double GBP[];

//--- 
double ac_gbpusd[];
double ac_eurgbp[];
double ac_gbpjpy[];
double ac_gbpchf[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
   //---- additional buffers used for counting.
  IndicatorBuffers(5);


//---- indicator line
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,GBP);
   SetIndexBuffer(1,ac_eurgbp);
   SetIndexBuffer(2,ac_gbpusd);
   SetIndexBuffer(3,ac_gbpchf);
   SetIndexBuffer(4,ac_gbpjpy);
   
   
   
//---- name for DataWindow and indicator subwindow label
   short_name="Accu/Dist Graph GBP ("+MomPeriod+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,"GBP");
//----
   SetIndexDrawBegin(0,MomPeriod);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Four legs                                                        |
//+------------------------------------------------------------------+
int start()
  {
   int i,counted_bars=IndicatorCounted();
   int a, b, c, d, e, f, g, h, ii, j;
//----
   if(Bars<=MomPeriod) return(0);
//---- initial zero
   if(counted_bars<1)
      for(i=1;i<=MomPeriod;i++) GBP[Bars-i]=0.0;
//----

    int limia=Bars-counted_bars;
   if(counted_bars>1) limia++;
   for(a=0; a<MomPeriod; a++)
   ac_gbpusd[a] = iAD("GBPUSD",0,a);
   
   int limie=Bars-counted_bars;
   if(counted_bars>1) limie++;
   for(e=0; e<MomPeriod; e++)
   ac_eurgbp[e] = iAD("EURGBP",0,e);

  
   int limih=Bars-counted_bars;
   if(counted_bars>1) limih++;
   for(h=0; h<MomPeriod; h++)
   ac_gbpjpy[h] = iAD("GBPJPY",0,h);
     
   int limij=Bars-counted_bars;
   if(counted_bars>1) limij++;
   for(j=0; j<MomPeriod; j++)
   ac_gbpchf[j] = iAD("GBPCHF",0,j);

//----
//----
   i=Bars-MomPeriod-1;
   if(counted_bars>=MomPeriod) i=Bars-counted_bars-1;
   while(i>=0)
     {
GBP[i] = ac_gbpusd[i] + ac_gbpchf[i] - ac_eurgbp[i] + ac_gbpjpy[i] ;

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

Comments