ROC_Indicator v02 e01

Download script
Author: Copyright 2006, Davi Chan
ROC_Indicator v02 e01

This script is designed to act as a multi-currency momentum indicator, providing a unified overview of market movement by aggregating data from four major currency pairs. Instead of looking at a single asset in isolation, the tool calculates the relative price changes across different markets to create a composite "Rate of Change" (ROC) value.

How it Works

The logic operates by analyzing the price fluctuations of the following four currency pairs:

  • GBP/USD
  • EUR/USD
  • USD/JPY
  • USD/CHF

For each calculation, the script looks back at a specific number of periods (defined by the user) to determine how much the price has moved from its previous position. It then calculates the percentage of that move to standardize the data.

Unique Calculations

To ensure the final result is accurate, the script treats different currency pairs differently based on their structure:

  • Direct Pairs: For GBP/USD and EUR/USD, it measures the standard price change directly.
  • Inverse Pairs: For USD/JPY and USD/CHF, the script performs an "inversion" calculation. This is done to ensure that the movement of the US Dollar against the Japanese Yen and Swiss Franc is weighted correctly in relation to the other currencies, preventing the data from being skewed by the way these specific pairs are quoted.

The Final Output

Once the individual momentum values for all four pairs are calculated, the script averages them together. This produces a single, unified line on your chart (represented in lime green).

Purpose for the Trader

The primary goal of this logic is to filter out "noise" from any single currency pair. By combining the movements of four different markets into one average indicator, it helps traders identify broader trends or shifts in the currency market that might not be visible when looking at just one chart at a time.

Price Data Components
Series array that contains close prices for each bar
Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
ROC_Indicator v02 e01
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

#property copyright "Copyright 2006, Davi Chan"

// declaração de variáveis definidas
#property indicator_buffers 1
#property indicator_separate_window
#property indicator_color1 Lime

// declaração de variáveis
extern int periodos = 12;
double medidor_operacoes = 0;
double buffer_indicador[];
int i;

//extern int maxbars = 0; //maxbars limita quando não estiver no modo teste.
int maxbars;

int init()
{
//   if(IsTesting())
 //    maxbars = Bars;
//	else
//	  maxbars = 500;
	  
	SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1);
	SetIndexBuffer(0, buffer_indicador);
	SetLevelValue(0,0.0);
	return(0);
}

int start()
{

	int inicio;   	
	double roc_GBP, roc_EUR, roc_JPY, roc_CHF, roc;	
	int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   
   for(int i=0; i<limit; i++)
   
   {
			roc = 0;			
			roc_GBP = ( iClose("GBPUSD", 0, i) - iClose("GBPUSD", 0, periodos+i)  )/ iClose("GBPUSD", 0, periodos+i) ;	
	      roc_EUR = (iClose("EURUSD", 0, i) - iClose("EURUSD", 0, periodos+i))/iClose("EURUSD", 0, periodos+i);	
	      //inversão dos valores dessas duas moedas
	      roc_JPY = (1/iClose("USDJPY", 0, i) - 1/iClose("USDJPY", 0, periodos+i)) /(1/iClose("USDJPY", 0, periodos+i));	
	      roc_CHF = (1/iClose("USDCHF", 0, i) - 1/iClose("USDCHF", 0, periodos+i)) /(1/iClose("USDCHF", 0, periodos+i));
	      //inversão dos valores dessas duas moedas
	      
	      roc = (roc_GBP + roc_EUR + roc_JPY + roc_CHF)/4;
	      
			buffer_indicador[i] = roc;			
	}
}

Comments