SimpleRSI&_MA
Download scriptThis tool is designed as a visual aid for traders to better understand market momentum and identify potential price reversals. It functions by combining two popular technical analysis components—the Relative Strength Index (RSI) and the Simple Moving Average (SMA)—into a single, streamlined view.
How the Logic Works
The indicator operates through a three-step calculation process:
1. Monitoring Market Momentum (RSI) First, the script calculates the Relative Strength Index (RSI). The RSI is a standard tool used to measure how quickly and strongly a price is moving. It helps traders identify "overbought" conditions (where the price may be too high) or "oversold" conditions (where the price may be too low).
2. Smoothing the Data (Moving Average) Because the standard RSI can sometimes be volatile or "choppy," this script applies a second layer of logic. It takes the RSI values and runs them through a Simple Moving Average (SMA). Think of this as a smoothing filter; it averages out the recent RSI fluctuations to create a cleaner, more stable line that is easier for the human eye to follow.
3. Visualizing the Trends The script produces two distinct visual lines on your chart:
- The RSI Line: Shows the raw momentum of the market.
- The SMA Line: Shows the smoothed trend of that momentum.
Practical Application for Traders
By displaying these two lines together, the tool allows you to see the relationship between raw price energy and established trends. When the smoothed average line stays steady while the raw RSI line fluctuates, it provides a clearer picture of the market's underlying direction. This helps traders filter out "noise" and focus on the broader movements of the asset.
//+------------------------------------------------------------------+
//| SimpleRSI&MA.mq4 |
//| Copyright(c) 2010 Masaru Sasaki |
//| |
//+------------------------------------------------------------------+
//
// uÆÓv
// *±ÌvOÉîÃs×Ìʶµ½áQA¹¸ÈÇÉ¢Ä
// ìÒÍêØÌÓCð¢Ü¹ñB
//
// uà¾v
// *RSIlÆRSIlðÚ®½Ïµ½lð\¦µÜ·B
// úÔÌWÝèÍA14ÆÈÁĨèÜ·B
// ñÂÌüÌNXª»fÆÈÁĢܷB
// AÚ®½ÏüÌíÞÍSMAA¿iÍIlÅ·B
// vO~OÌûKpÉ쬵½×Asõª éÆv¢Ü·ÌÅA
// gp·éêÍÝè²Óº³¢B
//
// QlÐFFX^g[_[üå PanRolling
//
#property copyright "Copyright(c) 2010 Masaru Sasaki"
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Cyan
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_level1 30
#property indicator_level2 70
// wWobt@
double RSI_Buf[];
double RSI_MA_Buf[];
// úÔ
extern int RSI_period = 14;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
// wWobt@폀
SetIndexBuffer(0, RSI_Buf);
SetIndexBuffer(1, RSI_MA_Buf);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int i;
int limit = Bars - IndicatorCounted();
if( counted_bars == 0 ) limit = limit - RSI_period - 1;
// RSIlÌvZ
for( i = limit-1; i >= 0; i-- ){
RSI_Buf[i] = iRSI(NULL, 0, RSI_period,PRICE_CLOSE, i);
}
if( counted_bars == 0 ) limit = limit - RSI_period - 1;
// RSIÚ®½ÏlÌvZ
for( i = limit-1; i >= 0; i-- ){
RSI_MA_Buf[i] = iMAOnArray(RSI_Buf, 0, RSI_period, 0, MODE_SMA, i);
}
return(0);
}
//+------------------------------------------------------------------+
Comments