+ind_MA_RSI_MACD_v.7

Download script
Author: Aleksei Parvatkin, 22/05/2009
+ind_MA_RSI_MACD_v.7

This technical indicator is designed to identify specific trend reversals and momentum shifts in financial markets by analyzing two primary data sources: the Relative Strength Index (RSI) and the Moving Average Convergence Divergence (MACD). Instead of relying on a single price point, it evaluates the relationship between these indicators over multiple candles to filter out noise and pinpoint potential entry signals.

Core Logic & Signal Generation

The indicator operates by monitoring "crossovers"—moments where one technical average crosses above or below another—while simultaneously verifying the momentum of the market. It categorizes its logic into two main directions:

1. Bullish (Buy) Analysis For a potential buy signal to appear, the script looks for a specific sequence of events:

  • Trend Confirmation: It checks if the fast average of the RSI has moved above its slow average.
  • Momentum Validation: It verifies that the previous candle's MACD main line was positioned above its signal line.
  • Price Action Pivot: The script specifically looks for "V-shaped" price movements in the indicator values. It identifies a point where the RSI value was trending down and suddenly turns upward.
  • Visual Feedback: When these conditions align, it places a visual arrow on the chart to notify the user of a potential upward movement.

2. Bearish (Sell) Analysis Conversely, for sell signals, the script looks for the inverse behavior:

  • Trend Confirmation: It identifies when the fast RSI average falls below the slow RSI average.
  • Momentum Validation: It checks if the previous MACD main line was positioned below its signal line.
  • Price Action Pivot: It detects a "peak" where the RSI value was trending up but begins to hook downward.
  • Visual Feedback: Once confirmed, it places a visual arrow on the chart to highlight potential downward pressure.

Advanced Filtering Features

To ensure higher accuracy and prevent "false positives," the script includes several sophisticated layers of logic:

  • The Two-Bar Filter: This allows the user to choose how strictly the script validates a reversal. When enabled, it requires the indicator to confirm a change in direction over a specific multi-bar sequence, ensuring that the move is substantial rather than just a minor flicker in price.
  • Exit Signals: Beyond just telling you when to enter, the script includes logic to identify potential exit points (closing signals). These appear when the momentum starts to diverge or shows signs of exhaustion before a full reversal occurs.
  • Signal Counting: The indicator maintains an internal counter to track consecutive signals. This helps differentiate between "strong" primary signals and smaller follow-through movements, providing a clearer picture of the strength of the current trend.

Summary for the User

Essentially, this tool acts as a secondary confirmation system. It doesn't just tell you that the price is moving; it looks for the moment when momentum (MACD) and relative strength (RSI) agree on a change in direction. By combining these three factors, the script aims to highlight high-probability turning points while filtering out the "choppy" movements that often mislead traders using simple indicators alone.

Indicators Used
MACD Histogram
Miscellaneous
Implements a curve of type %1
9 Views
1 Downloads
0 Favorites
+ind_MA_RSI_MACD_v.7




#property copyright "Aleksei Parvatkin, 22/05/2009"
#property link      "alexpar@list.ru"



#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 CLR_NONE
#property indicator_color2 CLR_NONE
#property indicator_color3 DeepSkyBlue
#property indicator_color4 Red
#property indicator_color5 DeepSkyBlue
#property indicator_color6 Red
#property indicator_color7 Goldenrod

#property indicator_width3 0
#property indicator_width4 0
#property indicator_width5 1
#property indicator_width6 1

//---- input parameters
extern int       RSIPeriod=5;
extern int       MAPeriod=5;

extern bool TwoBar=true;      // Ïðîâåðÿòü ïåðåãèá ïî äâóì áàðàì (ñëåâà îò ýêñòðåìóìà, ñïðàâà âñåãäà ïî îäíîì áàðó)

//---- buffers
double macd_m[];
double macd_s[];
double ma_rsi1[];
double ma_rsi2[];
double buy[];
double sell[];
double buy1[];
double sell1[];
double close[];
double cnt[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators

   IndicatorBuffers(8);

   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ma_rsi1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ma_rsi2);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,225);
   SetIndexBuffer(2,buy);
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(3,226);
   SetIndexBuffer(3,sell);
   SetIndexStyle(4,DRAW_ARROW);
   SetIndexArrow(4,233);
   SetIndexBuffer(4,buy1);
   SetIndexStyle(5,DRAW_ARROW);
   SetIndexArrow(5,234);
   SetIndexBuffer(5,sell1);

   SetIndexStyle(6,DRAW_ARROW);
   SetIndexArrow(6,251);   
   SetIndexBuffer(6,close);
   SetIndexBuffer(7,cnt);
   
   SetIndexLabel(0,"Fast MA");
   SetIndexLabel(1,"Slow MA");
   SetIndexLabel(2,"");
   SetIndexLabel(3,"");
   SetIndexLabel(4,"");
   SetIndexLabel(5,"");   
   SetIndexLabel(6,"");   
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
         int limit=Bars-IndicatorCounted();

            for(int i=limit-1;i>=0;i--){
               buy[i]=EMPTY_VALUE;
               sell[i]=EMPTY_VALUE;
               ma_rsi1[i]=iCustom(NULL, 0, "MA_RSI",RSIPeriod,0,MAPeriod,PRICE_CLOSE,i);
               ma_rsi2[i]=iCustom(NULL, 0, "MA_RSI",RSIPeriod,0,MAPeriod,PRICE_CLOSE,i+1);
               macd_m[i]=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,i);
               macd_s[i]=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,i);
               cnt[i]=cnt[i+1];
               buy1[i]=EMPTY_VALUE;
               sell1[i]=EMPTY_VALUE;               
               close[i]=EMPTY_VALUE;
                  if(ma_rsi1[i]>ma_rsi2[i]){
                           
                           if(ma_rsi1[i+1]<=ma_rsi2[i+1]&& macd_m[i+1]>macd_s[i+1]){
                              close[i]=Low[i]-Point*7;
                           }
                  
                           if(ma_rsi1[i+3]>ma_rsi1[i+2] || !TwoBar){
                              if(ma_rsi1[i+2]>ma_rsi1[i+1]){
                                 if(ma_rsi1[i+1]<ma_rsi1[i]){
                                       buy[i]=Low[i]-Point*5;
                                          if(cnt[i]<0){
                                             cnt[i]=0;
                                          }
                                       cnt[i]++;
                                          if(cnt[i]==1){
                                             buy1[i]=Low[i]-Point*5;
                                          }
                                 }
                              }
                           }
                  }
                  
                  if(ma_rsi1[i]<ma_rsi2[i]){
                  
                           if(ma_rsi1[i+1]>=ma_rsi2[i+1]&& macd_m[i+1]<macd_s[i+1]){
                              close[i]=High[i]+Point*7;
                           }                  
                  
                           if(ma_rsi1[i+3]<ma_rsi1[i+2] || !TwoBar){
                              if(ma_rsi1[i+2]<ma_rsi1[i+1]){
                                 if(ma_rsi1[i+1]>ma_rsi1[i]){
                                       sell[i]=High[i]+Point*5;    
                                          if(cnt[i]>0){
                                             cnt[i]=0;
                                          }           
                                       cnt[i]--;     
                                          if(cnt[i]==-1){
                                             sell1[i]=High[i]+Point*5;  
                                          }                                                                 
                                 }
                              }   
                           }               
                  }
               
            }
   return(0);
  }
//+------------------------------------------------------------------+

Comments