The Stochastic RSI combines two very popular technical analysis indicators, Stochastics and the Relative Strength Index (RSI). Whereas
Stochastics and RSI are based off of price, Stochastic RSI derives its values
from the Relative Strength Index (RSI); it is basically the Stochastic indicator
applied to the RSI indicator.
Stochastic RSI was developed to increase sensitivity and
reliability of the regular RSI indicator when it comes to trading off
overbought/oversold RSI levels. The Stochastic RSI is an effective and potentially profitable use of the
popular Stochastic indicator and RSI indicator.
The authors of the Stochastic RSI indicator - Tushard Chande and Stanley Kroll - explain that often regular RSI indicator would trade in between 20 and 80 levels for extended periods of times
without ever reaching an oversold/overbought areas where many traders
seek trading opportunities. When combining RSI with Stochastic, a new indicator provides better and more distinctive signals to trade upon
Buy when the Stochastic RSI crosses above the Oversold Line (20%).
Sell when the Stochastic RSI crosses below the Overbought Line (80%).
Stochastic RSI = ((Today's RSI - Lowest RSI Low in %K Periods) /
(Highest RSI High in %K Periods - Lowest RSI Low in %K Periods)) * 100
Stochastic RSI measures the value of RSI in relation to its High and Low range over the required period:
when a regular RSI reaches a a new Low for the period, Stochastic RSI will be at 0. When RSI
records a new high for the period, Stochastic RSI will be at 100
//+------------------------------------------------------------------+ //| StochRSI.mq4 | //| Copyright © 2006, Robertson Enterprises | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, Robertson Enterprises" #property link "" #property indicator_separate_window #property indicator_minimum 0 #property indicator_maximum 1 #property indicator_level1 0.8 #property indicator_level2 0.2 #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 LightSteelBlue //---- input parameters extern int RSI_Period=14; extern int K_Period=14; extern int D_Period=9; //---- buffers double StochRSI_Buffer[]; double Signal_Buffer[]; double RSI_Buffer[]; double HiRSI_Buffer[]; double LowRSI_Buffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorBuffers(5); SetIndexBuffer(2,RSI_Buffer); SetIndexBuffer(3,HiRSI_Buffer); SetIndexBuffer(4,LowRSI_Buffer); SetIndexStyle(0,DRAW_LINE); SetIndexDrawBegin(0,K_Period); SetIndexBuffer(0,StochRSI_Buffer); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,Signal_Buffer); SetIndexDrawBegin(1,K_Period+D_Period); //---- name for DPeriodataWindow and indicator subwindow label IndicatorShortName("Stochastic RSI("+RSI_Period+",%"+K_Period+",%"+D_Period+")"); SetIndexLabel(0,"StochRSI"); SetIndexLabel(1,"Signal"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i,limit; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); if(Bars<=RSI_Period || Bars<=K_Period) return(0); //---- initial zero if(counted_bars<1) { for(i=1;i<=MathMax(RSI_Period,K_Period);i++) StochRSI_Buffer[Bars-i]=0.0; for(i=1;i<=RSI_Period;i++) RSI_Buffer[Bars-i]=0.0; for(i=1;i<=K_Period+D_Period;i++) Signal_Buffer[Bars-i]=0.0; } //---- if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(i=0; i<limit; i++) { RSI_Buffer[i]=iRSI(NULL,0,RSI_Period,PRICE_TYPICAL,i); HiRSI_Buffer[i] = RSI_Buffer[ArrayMaximum(RSI_Buffer,K_Period,0)]; LowRSI_Buffer[i] = RSI_Buffer[ArrayMinimum(RSI_Buffer,K_Period,0)]; StochRSI_Buffer[i] = ((iRSI(NULL,0,RSI_Period,PRICE_TYPICAL,i) - LowRSI_Buffer[i])/(HiRSI_Buffer[i] - LowRSI_Buffer[i])); } for(i=0; i<limit; i++) Signal_Buffer[i] = iMAOnArray(StochRSI_Buffer,Bars,D_Period,0,MODE_SMA,i); //---- return(0); } //+------------------------------------------------------------------+
Comments