Author: Copyright � 2009, Maxim Kovalevskiy
RAVI

This tool is a custom technical indicator designed for the MetaTrader platform to help traders visualize market momentum and trend strength. Instead of looking at raw price action, it focuses on the mathematical relationship between two different moving averages to identify significant shifts in market direction.

Core Logic Overview

The indicator operates by comparing a short-term average (fast) against a long-term average (slow). By calculating the percentage difference between these two values, the tool generates a visual histogram that represents the "velocity" of the price movement relative to its historical average.

How It Works

The logic follows a three-step process to interpret market data:

1. Calculating Relative Strength The script constantly monitors two moving averages. It determines how far the fast average has moved away from the slow average and converts this into a percentage. This allows traders to see not just where the price is, but how aggressively it is moving in a specific direction.

2. Establishing Momentum Boundaries The tool utilizes predefined "levels" (horizontal thresholds). These act as filters to help distinguish between minor market noise and actual significant trends. Only when the momentum exceeds these specific boundaries does the indicator begin to provide active signals.

3. Visual Signaling The final output is displayed as a color-coded histogram in a separate window:

  • Trend Identification: The script looks for a "breakout" in momentum. If the current momentum is rising and has crossed above the upper threshold, it signals upward strength (represented in Green).
  • Counter-Trend Identification: Conversely, if the momentum is falling and has dropped below the lower threshold, it signals downward pressure (represented in Red).
  • Neutrality: When the market is consolidating or moving within the "quiet" zone between these two levels, the indicator remains neutral, helping traders avoid entering low-probability trades during sideways markets.

Summary for Traders

Essentially, this script filters out the "jitter" of the daily market to highlight sustained movements. It identifies when a trend has gained enough velocity to be considered significant, providing a clear visual cue of whether the current market sentiment is leaning aggressively toward the upside or the downside.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
RAVI
//+------------------------------------------------------------------+
//|                                                         RAVI.mq4 |
//|                              Copyright © 2009, Maxim Kovalevskiy |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Maxim Kovalevskiy "

#property  indicator_separate_window
#property  indicator_buffers 3
#property  indicator_color1  Gray
#property  indicator_color2  Green
#property  indicator_color3  Red

#property  indicator_level1  0.3
#property  indicator_level2  -0.3

double     ExtBuffer0[];
double     ExtBuffer1[];
double     ExtBuffer2[];

//---- indicator parameters 
extern int Period1=7; 
extern int Period2=65; 

//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int init() 
  { 

   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_HISTOGRAM);

   SetIndexBuffer(0,ExtBuffer0);
   SetIndexBuffer(1,ExtBuffer1);
   SetIndexBuffer(2,ExtBuffer2);

   IndicatorShortName("RAVI");
//---- initialization done
   return(0);
  } 
//+------------------------------------------------------------------+ 
//| Custor indicator deinitialization function                       | 
//+------------------------------------------------------------------+ 
int deinit() 
  { 
//---- TODO: add your code here 
    
//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| Custom indicator iteration function                              | 
//+------------------------------------------------------------------+ 
int start() 
  { 
   double prev, current, SMA1, SMA2;
   int up = 0;
   
   for(int i = 0; i <= Bars; i++)
   { 
      SMA1=iMA(NULL,0,Period1,0,MODE_SMA,PRICE_CLOSE,i); 
      SMA2=iMA(NULL,0,Period2,0,MODE_SMA,PRICE_CLOSE,i); 
      ExtBuffer0[i] =0; 
      if (SMA2>0) ExtBuffer0[i] = ((SMA1-SMA2)*100)/SMA2; 
   }
   
   for(i = Bars-1; i >= 0; i--)
     {
      current=ExtBuffer0[i];
      prev=ExtBuffer0[i+1];
      up = 0;
      if ((current > prev) && (current > indicator_level1)) up = 1; 
      if ((current < prev) && (current < indicator_level2)) up = -1; 
      
         ExtBuffer2[i] = 0.0;
         ExtBuffer1[i] = 0.0;
         
      if (up == -1)
        {
         ExtBuffer2[i] = current;
         ExtBuffer1[i] = 0.0;
        }
      if (up == 1)
        {
         ExtBuffer1[i] = current;
         ExtBuffer2[i] = 0.0;
        }
     }
//---- done
   return(0);
  } 
//+------------------------------------------------------------------+ 

Comments