iFXAnalyser_H4

Download script
Author: Copyright � 2006, Renato P. dos Santos
iFXAnalyser_H4

The iFXAnalyser_H4 is a specialized technical analysis tool designed to help traders visualize market momentum and trend changes by measuring the relationship between two moving averages. Instead of simply looking at price action, this script calculates specific mathematical differences to reveal how "aggressive" or "stable" a trend currently is.

How the Logic Works

The tool operates by comparing two different Moving Averages (MAs): a Fast Moving Average and a Slow Moving Average. By observing the gap between these two lines, the script provides three distinct layers of information:

1. Trend Divergence (The Gap) The primary logic identifies the raw difference between the Fast Moving Average and the Slow Moving Average at any given moment.

  • When this value is high, it indicates a strong trend moving in a specific direction.
  • When the value narrows, it suggests that the momentum is weakening or that the market is entering a period of consolidation (sideways movement).

2. Slope Analysis (The Rate of Change) Beyond just looking at the gap, the script calculates the "Slope." This measures how much the difference between the two moving averages changed from one bar to the next.

  • Essentially, it tells you if the trend is accelerating, decelerating, or staying constant.
  • It helps traders see if a move is gaining steam or starting to lose its "push."

3. Acceleration (The Momentum) By calculating the change in the slope, the tool provides an underlying look at market acceleration. This allows users to anticipate potential turning points before they become obvious on a standard price chart.

Visual Representation

The script processes these calculations and displays them in a separate window below your main trading chart. It uses visual buffers to plot:

  • Divergence: The immediate distance between the two averages.
  • Slope: The movement of that distance over time.
  • Acceleration: The underlying shift in momentum.

Summary for Traders

Rather than just showing you where the price is, this tool shows you the physics of the move. It translates complex mathematical price action into a clearer picture of market strength, helping you identify when a trend is healthy and when it might be reaching an exhaustion point.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
8 Views
0 Downloads
0 Favorites
iFXAnalyser_H4
//+------------------------------------------------------------------+
//|                                               iFXAnalyser_H4.mq4 |
//|                           Copyright © 2006, Renato P. dos Santos |
//|                   inspired on 4xtraderCY's and SchaunRSA's ideas |
//|   http://www.strategybuilderfx.com/forums/showthread.php?t=16086 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Renato P. dos Santos"
#property link "http://www.strategybuilderfx.com/forums/showthread.php?t=16086"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Red

//---- indicator parameters
extern int MA_Shift=0;
//---- indicator buffers
double ind_buffer0[];
double ind_buffer1[];
int FastMA=4;
int SlowMA=6;
int Fast_MAMode = PRICE_CLOSE;
int Slow_MAMode = PRICE_OPEN;

//----
int counted_bars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   int    draw_begin;
   string short_name = "iFXAnalyser_H4";
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetLevelStyle(STYLE_DOT,1,Black);
   SetLevelValue(1,15*Point);
   SetLevelValue(2,-15*Point);
   SetIndexShift(0,MA_Shift);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
   draw_begin=FastMA-1;
   SetIndexDrawBegin(0,draw_begin);
//---- indicator short name
   IndicatorShortName(short_name+"("+FastMA+","+SlowMA+")");
   SetIndexLabel(0,short_name+"Div");
   SetIndexLabel(1,short_name+"Slope");
   SetIndexLabel(2,short_name+"Accel");
//---- indicator buffers mapping
   if(!SetIndexBuffer(0,ind_buffer0) && !SetIndexBuffer(1,ind_buffer1))
     Alert("cannot set indicator buffer!");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Shaun's 2MA difference                                           |
//+------------------------------------------------------------------+
int start()
  {
   if(Bars<=MathMax(FastMA,SlowMA)) return(0);
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if (counted_bars>0) counted_bars--;
//---- Shaun's Divergence counted in the 1-st buffer
   int limit=Bars-counted_bars;
   int i;
   for(i=0; i<limit; i++)
      ind_buffer0[i]=iMA(NULL,0,FastMA,0,MODE_SMA,Fast_MAMode,i)
                     -iMA(NULL,0,SlowMA,0,MODE_SMA,Slow_MAMode,i);
//---- Shaun's Slope counted in the 2-nd buffer
   for(i=0; i<limit-1; i++)
      ind_buffer1[i]=(iMA(NULL,0,FastMA,0,MODE_SMA,Fast_MAMode,i)
                       -iMA(NULL,0,SlowMA,0,MODE_SMA,Slow_MAMode,i))
                     -(iMA(NULL,0,FastMA,0,MODE_SMA,Fast_MAMode,i+1)
                       -iMA(NULL,0,SlowMA,0,MODE_SMA,Slow_MAMode,i+1));
//---- done
   return(0);
  }

Comments