Volatility 3 pairs

Download script
Author: briz18@rambler.ru
Volatility 3 pairs

This tool is designed to help traders visualize and compare the relative volatility between three specific currency pairs: GBP/USD, USD/JPY, and GBP/JPY. By consolidating this information into a single window, it allows for a clearer understanding of market momentum across different regions simultaneously.

How it Works

The logic of the script centers on calculating the "spread" or difference between two distinct types of moving averages for each currency pair. Instead of simply showing the price of the currency, the tool focuses on the distance between these averages to identify trends and volatility levels.

1. Data Processing The script continuously monitors three pairs:

  • GBP/USD
  • USD/JPY
  • GBPJPY

For each of these pairs, it looks at two different price indicators (Moving Averages) over a user-defined period (defaulting to 5 bars). By subtracting one value from the other, the script creates a "difference" value. This helps smooth out minor market noise and highlights the underlying strength or weakness of the currency movement.

2. Scaling for Comparison Because different currency pairs have different exchange rates (e.g., GBP/USD vs. USD/JPY), they cannot be compared directly on the same scale without adjustment. The script applies specific multipliers to each pair:

  • The GBP/USD difference is multiplied by 10,000.
  • The USD/JPY difference is multiplied by 100.
  • The GBPJPY difference is multiplied by 100.

These multipliers normalize the data, allowing all three pairs to be viewed together in a single, cohesive chart window despite their different market values.

3. Visual Representation The results are displayed as three distinct lines on a separate indicator window:

  • Each line represents one of the currency pairs.
  • The window includes several horizontal reference levels (at 50, 100, 200, 300, and 400) to help the user gauge the intensity of the volatility.

Summary for the Trader

Essentially, this script acts as a multi-pair momentum tracker. By watching how these three lines move relative to one another and the reference levels, you can quickly identify which currency pairs are experiencing the most significant movement or "stretch" at any given moment, helping you decide where the highest market activity is occurring.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
16 Views
0 Downloads
0 Favorites
Volatility 3 pairs
//+------------------------------------------------------------------+
//|                                           Complex_Volatility.mq4 |
//|                                                briz18@rambler.ru |
//+------------------------------------------------------------------+
#property copyright "briz18@rambler.ru"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Teal
#property indicator_color2 SlateBlue
#property indicator_color3 MediumVioletRed
//---- buffers
double GBPUSD[];
double USDJPY[];
double GBPJPY[];
//---- input parameters
extern int VolatilityPeriod=5;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorShortName("Volantility+GU;UJ;GJ");
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,GBPUSD);
   SetIndexLabel(0, "GBPUSD"); 
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,USDJPY);
   SetIndexLabel(1, "USDJPY"); 
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,GBPJPY);
   SetIndexLabel(2, "GBPJPY"); 
   SetLevelValue(0,50);
   SetLevelStyle(0,1,DimGray);
   SetLevelValue(1,100);
   SetLevelStyle(0,0,DimGray);
   SetLevelValue(2,200);
   SetLevelStyle(0,0,DimGray);
   SetLevelValue(3,300);
   SetLevelStyle(0,0,DimGray);
   SetLevelValue(4,400);
   SetLevelStyle(0,0,DimGray);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
     int limit;
     int counted_bars=IndicatorCounted();
  //---- ïðîâåðêà íà âîçìîæíûå îøèáêè
     if(counted_bars<0) return(-1);
  //---- ïîñëåäíèé ïîñ÷èòàííûé áàð áóäåò ïåðåñ÷èòàí
     if(counted_bars>0) counted_bars-=10;
     limit=Bars-counted_bars;
  //---- îñíîâíîé öèêë
      int Mode=0;
      int Price1=2;
      int Price2=3;
      int per=VolatilityPeriod;      
     for(int i=0; i<limit; i++)
       {
        GBPUSD[i]=(iMA("GBPUSD",0,per,0,Mode,Price1,i)-iMA("GBPUSD",0,per,0,Mode,Price2,i))*10000;
        USDJPY[i]=(iMA("USDJPY",0,per,0,Mode,Price1,i)-iMA("USDJPY",0,per,0,Mode,Price2,i))*100;
        GBPJPY[i]=(iMA("GBPJPY",0,per,0,Mode,Price1,i)-iMA("GBPJPY",0,per,0,Mode,Price2,i))*100;
       }
  //----
    return(0);
  }
//+------------------------------------------------------------------+

Comments