rsi_gold_silver

Download script
Author: ForF
rsi_gold_silver

This tool is designed as a visual market indicator for the MetaTrader platform, specifically created to track and compare the relative strength of two different assets—in this case, Gold and Silver. By monitoring these two metals simultaneously, the indicator helps traders understand the relationship between them more clearly.

Core Logic and Functionality

The script operates by calculating a technical momentum metric known as the RSI (Relative Strength Index) for both assets over a specific period of time. Instead of looking at simple price movements, it uses "Typical Price" (an average of the high, low, and closing prices) to ensure the data is more balanced and less susceptible to sudden price spikes.

The indicator processes this information in three distinct stages:

  • Gold Tracking: The script calculates the momentum for Gold and plots it as a visual line on your chart. This allows you to see how strong or weak the Gold market is currently moving.
  • Silver Tracking: Simultaneously, the script performs the exact same calculation for Silver, plotting it as a second independent line.
  • The "Typical" Comparison: The final piece of logic takes the data from both the Gold and Silver lines and calculates their average. This creates a third, smoothed line that represents the combined momentum of both metals.

How to Interpret the Data

By displaying these three lines in a single separate window, the tool allows you to observe how these two metals interact:

  1. Individual Performance: You can quickly see if one metal is significantly outperforming the other.
  2. Combined Strength: The third "Typical" line acts as a composite view. If the individual lines are moving in different directions, the average line helps identify the broader trend of the precious metals market as a whole.
  3. Visual Benchmarks: The indicator includes three pre-set horizontal levels (35, 50, and 65). These serve as visual guides to help you identify "overbought" or "oversold" conditions, where prices might be stretched too far in one direction and could potentially reverse.

In summary, this script simplifies complex market data by merging the behavior of two major assets into one visual display, making it easier for traders to spot trends and correlations at a glance.

Indicators Used
Relative strength index
Miscellaneous
Implements a curve of type %1
8 Views
0 Downloads
0 Favorites
rsi_gold_silver
/*=============================================== H E A D E R ==============================================
                                 Pavol Krizan | paulie.sk@gmail.com 
                                 
EN  = Please if anyone modifying and improves file, send to me on my email thank you !!!                                          
SVK = Prosím ak niekto upravuj alebo vylepšuje tento súbor, predošlite mi to na môj email dakujem !!!
   
/*=========================================== H E A D E R  E N D ===========================================*/
#property copyright "ForF"
#property link      "http://www.forf.eu/"
#property version   "1.01" 

/*==========================================================================================================*/

#property  indicator_separate_window
//+------------------------------------------------------------------+
#property  indicator_level1      50
#property  indicator_level2      35
#property  indicator_level3      65
#property  indicator_levelcolor  Silver
#property  indicator_levelstyle  0
//+------------------------------------------------------------------+
#property  indicator_buffers     3
#property  indicator_color1      Gold
#property  indicator_color2      DeepSkyBlue
#property  indicator_color3      White
//+------------------------------------------------------------------+
#property  indicator_width1      1
#property  indicator_width2      1
#property  indicator_width3      1
//+------------------------------------------------------------------+
extern string Symobol_1="GOLD";
extern string Symobol_2="SILVER";
extern int    period           = 14;

double     MacdBuffer1[];
double     MacdBuffer2[];
double     MacdBuffer3[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE,0,2);

//---- indicator buffers mapping
   SetIndexBuffer(0,MacdBuffer1);
   SetIndexBuffer(1,MacdBuffer2);
   SetIndexBuffer(2,MacdBuffer3);

   IndicatorShortName("RSI_Gold_Silver");
   
   SetIndexLabel(0,"GOLD");
   SetIndexLabel(1,"SILVER"); 
   SetIndexLabel(2,"Typical"); 
   
 
   return(0);
  }
//+------------------------------------------------------------------+
// Signal indicator                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
   int i;
     
//====================================================         
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//====================================================   
   for(i=0; i<limit; i++)
      MacdBuffer1[i]=iRSI(Symobol_1,0,period,PRICE_TYPICAL,i);
   
   for(i=0; i<limit; i++)
      MacdBuffer2[i]=iRSI(Symobol_2,0,period,PRICE_TYPICAL,i); 
              
   for(i=0; i<limit; i++)
      MacdBuffer3[i]=
       ((
       MacdBuffer1[i]+MacdBuffer2[i]
        )/2);
        
//====================================================   
     return(0);
}
//+------------------------------------------------------------------+

Comments