Special RSI ARROW_001
Download scriptThis tool is designed to provide visual trading signals by analyzing the momentum of price movements. Rather than looking at a single price point, it focuses on the relationship between two different Relative Strength Index (RSI) periods to filter out market noise and identify significant shifts in trend.
Core Analytical Logic
The script operates through a multi-layered smoothing process to ensure that the signals generated are based on established trends rather than temporary price fluctuations:
1. Momentum Comparison The system tracks two different RSI indicators simultaneously (using two distinct time periods). By calculating the difference between these two indicators, the tool identifies how much "strength" exists in the current trend relative to a longer-term average.
2. Multi-Stage Smoothing To prevent the indicator from reacting too quickly to minor price "wiggles," the script applies several layers of mathematical smoothing:
- First, it calculates the difference between the two RSI values.
- Second, it applies an Exponential Moving Average (EMA) to that difference.
- Third, it applies another layer of smoothing to the result.
This triple-layer approach ensures that the resulting line represents a very stable trend of the market's momentum.
3. Signal Generation (The Arrows) The actual "buy" and "sell" signals are triggered by the movement of this final smoothed line. The script looks for specific threshold breaches:
- Upward Signals: When the smoothed trend line rises significantly beyond a predefined distance, the script identifies a potential upward move and places an arrow on the chart.
- Downward Signals: When the smoothed trend line drops significantly below a certain point, the script identifies a potential downward move and places a corresponding arrow.
Key Features for the User
- Noise Reduction: By using multiple smoothing layers, the tool aims to ignore "fake-outs" where the price moves briefly in one direction before reversing.
- Trend Confirmation: The arrows act as visual confirmations of momentum shifts, helping traders see when a trend is gaining enough strength to potentially be acted upon.
- Visual Clarity: Instead of requiring the user to interpret complex overlapping lines, the tool simplifies the data into clear directional arrows on the trading chart.
//+------------------------------------------------------------------+
//| Special_RSI_ARROW.mq4 |
//| Copyright © 2009, leMai |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, leMai"
//----
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Green
#property indicator_color2 White
#property indicator_color3 Blue
#property indicator_color4 LimeGreen
#property indicator_color5 Red
//----
extern int RSIPeriod1=14;
extern int RSIPeriod2=28;
extern int Cross1=10;
extern double difference=2.0;
double ind_buffer1[];
double MABuffer1[];
double Cross[];
double UpArrow[];
double DnArrow[];
double now=1,last=0;
int direction=0;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);
SetIndexStyle(3, DRAW_ARROW);
SetIndexArrow(3, 233);
SetIndexStyle(4, DRAW_ARROW);
SetIndexArrow(4, 234);
//----
SetIndexBuffer(0, ind_buffer1);
SetIndexBuffer(1, MABuffer1);
SetIndexBuffer(2, Cross);
SetIndexBuffer(3, UpArrow);
SetIndexBuffer(4, DnArrow);
//----
IndicatorShortName("Special RSI ARROW");
Comment("leMai");
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
double RSI1,RSI2;
int Limit, i, counted_bars = IndicatorCounted();
//----
if(counted_bars < 0)
return(-1);
//----
if(counted_bars > 0)
counted_bars--;
Limit=ArraySize(MABuffer1);
for(i=Limit; i>=0; i--)
{
RSI1 = iRSI(NULL, 0, RSIPeriod1, PRICE_CLOSE, i);
RSI2 = iRSI(NULL, 0, RSIPeriod2, PRICE_CLOSE, i);
MABuffer1[i] = (RSI1-RSI2);
}
for(i=Limit; i>=0; i--)
{
ind_buffer1[i] = iMAOnArray(MABuffer1,0,14,0,MODE_EMA,i);
}
for(i=Limit; i>=0; i--)
{
Cross[i]=iMAOnArray(ind_buffer1,Bars,Cross1,0,MODE_EMA,i);
now=Cross[i];
if(now>(last+(difference/1000)))
{
if(direction<1)
{
UpArrow[i]=Cross[i];
direction=1;
}
}
else
if(now<(last-(difference/1000)))
{
if(direction>-1)
{
DnArrow[i]=Cross[i];
direction=-1;
}
}
last=Cross[i];
}
for(i=Limit; i>=0; i--)
{
MABuffer1[i]=0;
}
return(0);
}
//+------------------------------------------------------------------+
Comments