RSI_SevenPairsBuy
Download scriptThis tool is designed to provide a comprehensive overview of market momentum across multiple currency pairs simultaneously. Instead of looking at just one chart, it aggregates data from several different assets to give you a broader perspective on "Buy" sentiment.
How It Works
Multi-Pair Monitoring The script tracks up to seven different currency pairs at once (such as GBPUSD, EURGBP, etc.). By monitoring these diverse pairs, the tool helps identify broader market trends that might be missed if you were only looking at a single trade setup.
Momentum Analysis (RSI) For each of the selected currency pairs, the script calculates a momentum indicator known as the Relative Strength Index (RSI). The RSI is a standard technical tool used to measure the speed and change of price movements. It helps traders determine whether an asset is being bought aggressively or sold off.
The Averaging Logic This is the core feature of the script. Rather than just showing you seven separate lines, the tool performs the following steps automatically:
- It calculates the RSI value for every active currency pair in your list.
- It adds all those values together into a single total.
- It divides that total by the number of pairs currently being tracked.
- It produces a final "Average" line on your chart.
Key Visual Output On your trading platform, you will see individual lines representing each currency pair, and a distinct average line. This average serves as a collective momentum gauge; when the average line moves upward, it indicates a general strengthening of "Buy" sentiment across your entire portfolio of selected pairs.
Smart Compatibility The script includes an automatic adjustment feature to ensure it works correctly regardless of your broker's naming conventions. It can automatically detect and append necessary suffixes (like specific account types or currency identifiers) to the currency names so that the data flows correctly into the calculations without manual intervention.
//+---------------------------------------------------------------------+
//| Copyright © 2008, Robert Hill |
//+---------------------------------------------------------------------+
#property copyright "Copyright © 2008, Robert Hill"
#property link ""
#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Lime
#property indicator_color2 Lime
#property indicator_color3 Lime
#property indicator_color4 Lime
#property indicator_color5 Lime
#property indicator_color6 Lime
#property indicator_color7 Lime
#property indicator_color8 White
extern string Buy_currency_pairs = "----- List of Buy currency pairs -----";
extern string mPair_1 = "GBPUSD";
extern string mPair_2 = "EURGBP";
extern string mPair_3 = "GBPJPY";
extern string mPair_4 = "USDCHF";
extern string mPair_5 = "NZDUSD";
extern string mPair_6 = "AUDJPY";
extern string mPair_7 = "EURJPY";
extern int RSI_Period = 14;
extern int BarsBack = 100;
string Pair1, Pair2, Pair3, Pair4, Pair5, Pair6, Pair7;
double Pair1_Buffer[];
double Pair2_Buffer[];
double Pair3_Buffer[];
double Pair4_Buffer[];
double Pair5_Buffer[];
double Pair6_Buffer[];
double Pair7_Buffer[];
double Avg_Buffer[];
int init()
{
GetCorrectPairs();
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(0,Pair1_Buffer);
SetIndexLabel(0,Pair1);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(1,Pair2_Buffer);
SetIndexLabel(1,Pair2);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(2,Pair3_Buffer);
SetIndexLabel(2,Pair3);
SetIndexStyle(3,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(3,Pair4_Buffer);
SetIndexLabel(3,Pair4);
SetIndexStyle(4,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(4,Pair5_Buffer);
SetIndexLabel(4,Pair5);
SetIndexStyle(5,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(5,Pair6_Buffer);
SetIndexLabel(5,Pair6);
SetIndexStyle(6,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(6,Pair7_Buffer);
SetIndexLabel(6,Pair7);
SetIndexStyle(7,DRAW_LINE,STYLE_SOLID);
SetIndexBuffer(7,Avg_Buffer);
SetIndexLabel(7,"Buy Avg");
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int i, limit;
int counted_bars = IndicatorCounted();
double Sum;
int Num;
if(counted_bars < 0) return(-1);
//---- last counted bar will be recounted
if(counted_bars > 0) counted_bars--;
limit=BarsBack;
for(i=0; i<limit; i++)
{
Sum = 0;
Num = 0;
if (StringLen(Pair1) > 0)
{
Pair1_Buffer[i] = iRSI(Pair1, 0, RSI_Period, PRICE_CLOSE, i);
Sum += Pair1_Buffer[i];
Num++;
}
if (StringLen(Pair2) > 0)
{
Pair2_Buffer[i] = iRSI(Pair2, 0, RSI_Period, PRICE_CLOSE, i);
Sum += Pair2_Buffer[i];
Num++;
}
if (StringLen(Pair3) > 0)
{
Pair3_Buffer[i] = iRSI(Pair3, 0, RSI_Period, PRICE_CLOSE, i);
Sum += Pair3_Buffer[i];
Num++;
}
if (StringLen(Pair4) > 0)
{
Pair4_Buffer[i] = iRSI(Pair4, 0, RSI_Period, PRICE_CLOSE, i);
Sum += Pair4_Buffer[i];
Num++;
}
if (StringLen(Pair5) > 0)
{
Pair5_Buffer[i] = iRSI(Pair5, 0, RSI_Period, PRICE_CLOSE, i);
Sum += Pair5_Buffer[i];
Num++;
}
if (StringLen(Pair6) > 0)
{
Pair6_Buffer[i] = iRSI(Pair6, 0, RSI_Period, PRICE_CLOSE, i);
Sum += Pair6_Buffer[i];
Num++;
}
if (StringLen(Pair7) > 0)
{
Pair7_Buffer[i] = iRSI(Pair7, 0, RSI_Period, PRICE_CLOSE, i);
Sum += Pair7_Buffer[i];
Num++;
}
Avg_Buffer[i] = Sum / Num;
}
return(0);
}
void GetCorrectPairs()
{
Pair1 = GetCorrectSymbol(mPair_1);
Pair2 = GetCorrectSymbol(mPair_2);
Pair3 = GetCorrectSymbol(mPair_3);
Pair4 = GetCorrectSymbol(mPair_4);
Pair5 = GetCorrectSymbol(mPair_5);
Pair6 = GetCorrectSymbol(mPair_6);
Pair7 = GetCorrectSymbol(mPair_7);
}
string GetCorrectSymbol(string pair)
{
string AddChar, myPair;
myPair = pair;
if (StringLen(pair) > 0)
{
if (StringLen(Symbol()) == 7)
{
AddChar = StringSubstr(Symbol(), 6, 1);
myPair = pair + AddChar;
}
}
return(myPair);
}
Comments