ROC_multi
Download scriptThis tool is designed to help traders visualize the momentum and speed of price movements across four major currency pairs simultaneously: EUR/USD, GBP/USD, USD/JPY, and USD/CHF. Instead of looking at these charts individually, the script consolidates their "Rate of Change" into a single, easy-to-read window, allowing for a broader market overview.
Core Functionality
Multi-Currency Tracking The primary purpose of this script is to track four different currency pairs at once. It calculates how quickly each pair is moving relative to its previous price point. By presenting these on one screen, you can quickly identify which currencies are gaining strength or losing momentum compared to others.
Momentum Calculation The logic works by measuring the percentage difference between the current closing price and the previous closing price for each specific time frame (e.g., 1-minute, 5-minutes, Hourly, etc.). This calculation is then accumulated over time to create a "Rate of Change" line. This helps smooth out minor market noise and highlights the broader trend of the currency's movement.
Customizable Time Frames The script is dynamic, allowing you to switch between different time intervals. Whether you are a scalper looking at 1-minute fluctuations or a long-term investor monitoring Daily trends, the tool adjusts its calculations to match your preferred timeframe automatically.
Visual Indicators and Reference Levels To make the data actionable, the script provides several visual aids:
- Color-Coded Lines: Each of the four currency pairs is assigned a unique color (Royal Blue, Lime Green, Yellow, and Red), making it simple to distinguish between them at a glance.
- Reference Zones: The tool includes six pre-defined horizontal levels (ranging from 300 down to -300). These serve as visual boundaries to help you identify extreme overbought or oversold conditions, providing a clear sense of whether a currency's momentum is reaching an exhausted state.
How it helps the trader
Rather than manually jumping between four different tabs, this script provides a "birds-eye view" of the forex market. It highlights volatility and speed, helping you spot opportunities where one currency is moving significantly faster or slower than the rest of the group.
//+------------------------------------------------------------------+
//| Rate of Change for Multi Currency Pairs.mq4 | |
//| Ernst van der Merwe |
//+------------------------------------------------------------------+
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 4
extern int TimeFrame=0; //1=1minute;5=5minutes;15=15minutes;30=30minutes;60=1Hour;240=4Hour;1440=Daily;
extern double level1= 300;
extern double level2= 200;
extern double level3= 100;
extern double level4=-100;
extern double level5=-200;
extern double level6=-300;
//---- indicator buffers
double ROC_EURUSD[];
double ROC_GBPUSD[];
double ROC_USDJPY[];
double ROC_USDCHF[];
string pair1="EURUSD";
string pair2="GBPUSD";
string pair3="USDJPY";
string pair4="USDCHF";
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetLevelStyle(STYLE_DOT,1,LightSlateGray);
SetLevelValue(0,level1);
SetLevelValue(1,level2);
SetLevelValue(2,level3);
SetLevelValue(3,level4);
SetLevelValue(4,level5);
SetLevelValue(5,level6);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,RoyalBlue);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,LimeGreen);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1,Yellow);
SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,1,Red);
IndicatorDigits(Digits+1);
SetIndexDrawBegin(0,0);
SetIndexDrawBegin(1,0);
SetIndexDrawBegin(2,0);
SetIndexDrawBegin(3,0);
//----
SetIndexBuffer(0,ROC_EURUSD);
SetIndexBuffer(1,ROC_GBPUSD);
SetIndexBuffer(2,ROC_USDJPY);
SetIndexBuffer(3,ROC_USDCHF);
//----
switch(TimeFrame)
{
case 1 : string TimeFrameStr="M1"; break;
case 5 : TimeFrameStr="M5"; break;
case 15 : TimeFrameStr="M15"; break;
case 30 : TimeFrameStr="M30"; break;
case 60 : TimeFrameStr="H1"; break;
case 240 : TimeFrameStr="H4"; break;
case 1440 : TimeFrameStr="D1"; break;
case 10080 : TimeFrameStr="W1"; break;
case 43200 : TimeFrameStr="MN1"; break;
default : TimeFrameStr="";
}
IndicatorShortName("ROC "+TimeFrameStr);
SetIndexLabel(0,pair1);
SetIndexLabel(1,pair2);
SetIndexLabel(2,pair3);
SetIndexLabel(3,pair4);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int i,limit=1000;
double EURUSD[1000];
double GBPUSD[1000];
double USDJPY[1000];
double USDCHF[1000];
int limitEURUSD=ArraySize(EURUSD);
ArraySetAsSeries(EURUSD,true);
for(i=0; i<limitEURUSD; i++)
EURUSD[i]=((iClose(pair1,TimeFrame,i)-iClose(pair1,TimeFrame,i+1))/iClose(pair1,TimeFrame,i+1))*1000;
ROC_EURUSD[1000]=0;
for(i=limit-1; i>=0; i--)
ROC_EURUSD[i]=ROC_EURUSD[i+1]+EURUSD[i];
int limitGBPUSD=ArraySize(GBPUSD);
ArraySetAsSeries(GBPUSD,true);
for(i=0; i<limitGBPUSD; i++)
GBPUSD[i]=((iClose(pair2,TimeFrame,i)-iClose(pair2,TimeFrame,i+1))/iClose(pair2,TimeFrame,i+1))*1000;
ROC_GBPUSD[1000]=0;
for(i=limit-1; i>=0; i--)
ROC_GBPUSD[i]=ROC_GBPUSD[i+1]+GBPUSD[i];
int limitUSDJPY=ArraySize(USDJPY);
ArraySetAsSeries(USDJPY,true);
for(i=0; i<limitUSDJPY; i++)
USDJPY[i]=((iClose(pair3,TimeFrame,i)-iClose(pair3,TimeFrame,i+1))/iClose(pair3,TimeFrame,i+1))*1000;
ROC_USDJPY[1000]=0;
for(i=limit-1; i>=0; i--)
ROC_USDJPY[i]=ROC_USDJPY[i+1]+USDJPY[i];
int limitUSDCHF=ArraySize(USDCHF);
ArraySetAsSeries(USDCHF,true);
for(i=0; i<limitUSDCHF; i++)
USDCHF[i]=((iClose(pair4,TimeFrame,i)-iClose(pair4,TimeFrame,i+1))/iClose(pair4,TimeFrame,i+1))*1000;
ROC_USDCHF[1000]=0;
for(i=limit-1; i>=0; i--)
ROC_USDCHF[i]=ROC_USDCHF[i+1]+USDCHF[i];
//---- done
return(0);
}
Comments