alx_RSI_BANDS_MA_change

Download script
Author: alx_Babon
alx_RSI_BANDS_MA_change

This custom indicator is designed to provide a multi-layered visual analysis of market momentum and volatility. Rather than looking at price action directly, it processes data through a series of mathematical filters to help traders identify trend strength, potential overbought/oversold conditions, and price boundaries.

Core Logic and Components

The tool operates by layering three primary types of financial analysis:

1. Momentum Tracking (RSI) The foundation of the indicator is the Relative Strength Index (RSI). It measures how quickly and strongly the price is moving in a specific direction. By calculating this, the script establishes a "heartbeat" for the market's current speed.

2. Moving Average Integration The script applies a Moving Average specifically to the RSI data (rather than just the price). This smooths out the "noise" of the momentum readings, making it easier to see the underlying trend of the momentum itself. This allows traders to see if the market's strength is accelerating, decelerating, or stabilizing.

3. Dynamic Banding (Bollinger-style Bands) The indicator creates a "channel" around the RSI data. By applying standard deviation logic to the momentum readings, it generates:

  • Upper and Lower Boundaries: These act as visual "ceilings" and "floors." When the momentum pushes toward these edges, it suggests the market may be reaching an extreme state.
  • A Main Median Line: This acts as a baseline, helping to identify the equilibrium point of the current momentum.

How it Works Together

Instead of showing you where the price is, this script shows you how the momentum feels.

By combining these three elements, the logic creates a comprehensive "environment" for the momentum:

  • The RSI provides the raw data on speed.
  • The Moving Average identifies the direction of that speed.
  • The Bands define the limits of that speed.

User Interface & Feedback

The script provides real-time visual feedback in two ways:

  • Visual Plots: It draws several lines on a separate window, allowing you to see the relationship between the smoothed momentum and its boundaries at a glance.
  • Data Summary: On the main chart area, it displays a text summary of the current numerical values for the RSI, the Bands, and the Moving Average. This gives you the exact data points needed for precise analysis without having to guess based on the lines alone.
Indicators Used
Relative strength indexMoving average indicatorMoving average indicator
Miscellaneous
Implements a curve of type %1
14 Views
0 Downloads
0 Favorites
alx_RSI_BANDS_MA_change
//+------------------------------------------------------------------+
//|                                             alx_RSI_BANDS_MA.mq4 |
//|                                                       alx_Babon |
//+------------------------------------------------------------------+
#property copyright "alx_Babon"
#property link      "babon82@gmail.com"
 
#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 Yellow
#property indicator_color2 DarkBlue
#property indicator_color3 White
#property indicator_color4 White
#property indicator_color5 White
//---- input parameters
extern int       RSI_Per=4;
extern int       MA_Per=4;
extern int       Bands_Per=24;
extern int       SmoothType=0;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double Sostoyanie;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   string type;
   switch(SmoothType)
   {
   case MODE_EMA: type="EMA";break;
   case MODE_SMMA: type="SMMA";break;
   case MODE_LWMA: type="LWMA";break;
   default: type="LWMA";SmoothType=0;break; // åñëè íè îäèí âàðèàíò íå ïîäîøåë
   }
 
   SetIndexStyle(0,DRAW_LINE,0,1);
   SetIndexBuffer(0,ExtMapBuffer1);//Ñâîéñòâà RSI
   SetIndexLabel(0,"RSI("+RSI_Per+")");
   SetIndexStyle(1,DRAW_LINE,0,2);
   SetIndexBuffer(1,ExtMapBuffer2);//Ñâîéñòâà MA
   SetIndexLabel(1,"MA ("+MA_Per+"), "+type);
   SetIndexStyle(2,DRAW_LINE,2,1);
   SetIndexBuffer(2,ExtMapBuffer3);//Ñâîéñòâà Bands
   SetIndexLabel(2,"Bands ("+Bands_Per+")");
   SetIndexStyle(3,DRAW_LINE,2,1);
   SetIndexBuffer(3,ExtMapBuffer4);//Ñâîéñòâà Bands
   SetIndexLabel(3,"Bands ("+Bands_Per+")");
   SetIndexStyle(4,DRAW_LINE,2,1);
   SetIndexBuffer(4,ExtMapBuffer5);//Ñâîéñòâà Bands
   SetIndexLabel(4,"Bands ("+Bands_Per+")");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int limit,cnt;
   int cnt_rsi,cnt_bb,cnt_ma;
   if(counted_bars < 0)
       return(-1);
 
   if(counted_bars > 0) 
       counted_bars--;
 
    
      {
      limit=Bars-RSI_Per-1;
      for(cnt=limit;cnt>=0;cnt--)
         {
          ExtMapBuffer1[cnt]=iRSI(NULL,0,RSI_Per,PRICE_CLOSE,cnt);
         }
      for(cnt=0;cnt<=Bars;cnt++)
         {
          ExtMapBuffer6[cnt]= iMA(NULL,0,MA_Per,0,SmoothType,PRICE_CLOSE,cnt);
                
         }
      for(cnt=limit-MA_Per;cnt>=0;cnt--)
         {
          ExtMapBuffer2[cnt]=iMAOnArray(ExtMapBuffer1,0,MA_Per,0,SmoothType,cnt);
         }          
      for(cnt=limit-Bands_Per;cnt>=0;cnt--)
         {
          ExtMapBuffer3[cnt]=iBandsOnArray(ExtMapBuffer1,0,Bands_Per,2,0,MODE_LOWER,cnt);
         }
      for(cnt=limit-Bands_Per;cnt>=0;cnt--)
         {
          ExtMapBuffer4[cnt]=iBandsOnArray(ExtMapBuffer1,0,Bands_Per,2,0,MODE_UPPER,cnt);
         }  
      for(cnt=limit-Bands_Per;cnt>=0;cnt--)
         {
          ExtMapBuffer5[cnt]=iBandsOnArray(ExtMapBuffer1,0,Bands_Per,2,0,MODE_MAIN,cnt);
         } 
         
      }
      cnt_rsi=limit;
      cnt_bb=limit-Bands_Per;
      cnt_ma=limit-MA_Per;
      Comment(
               "RSI (",RSI_Per,")=",ExtMapBuffer1[1],"\n",
          "Bolinger (",Bands_Per,")=",ExtMapBuffer5[1],"\n",
                "MA (",MA_Per,")=",ExtMapBuffer2[1],"\n"
                //,"MA CNT (",MA_Per,")=",ExtMapBuffer6[8],"\n"
                //,"CNT_MA (",cnt_ma,")"
             );
//----
      //ObjectCreate("Arrow", OBJ_ARROW, 0, 0, 5);
      //ObjectSet("Arrow",OBJPROP_ARROWCODE,OBJ_PERIOD_M15 | OBJ_PERIOD_H1);
      //ObjectSetText("PivotText", "Pivot Point (DJ)", fontsize, "Arial", 
                 //colorPivot);
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments