iFXAnalyser

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

The iFXAnalyser is a specialized technical analysis tool designed to provide traders with a deeper understanding of market momentum by calculating the mathematical relationships between two different Moving Averages (MA). Rather than simply showing you where the price is going, this script breaks down the "physics" of the price movement into three distinct layers of data.

Here is a breakdown of how the logic works:

1. The Core Foundation: Divergence

The primary logic begins by comparing two moving averages with different settings (fast and slow). Instead of looking at the averages individually, the tool calculates the Divergence between them.

  • What this means: It measures the "gap" or distance between these two indicators. If the gap is widening, it suggests increasing strength in a specific direction; if it is narrowing, it suggests that the current trend may be losing steam.

2. The Second Layer: Slope (Velocity)

The script then takes that Divergence and calculates its Slope. In simple terms, while Divergence tells you how far apart the averages are, Slope tells you how fast that distance is changing from one moment to the next.

  • What this means: This represents the "velocity" of the market. It helps traders identify if the trend is accelerating or decelerating. A steep slope indicates rapid movement, while a flattening slope can be an early warning that the market is reaching a turning point.

3. The Third Layer: Acceleration (Rate of Change)

Finally, the tool calculates the Slope of the Slope, which represents Acceleration. This is the most advanced layer of the logic, looking at how quickly the velocity itself is changing.

  • What this means: Just as a car can have a high speed but be slowing down (deceleration), or a low speed but increasing rapidly (acceleration), this metric reveals the hidden momentum behind the price. It identifies the "force" pushing the market, allowing for a more nuanced view of potential trend reversals before they become obvious on a standard chart.

Summary for Traders

By processing these three layers—Divergence, Slope, and Acceleration—the iFXAnalyser provides a multi-dimensional view of market dynamics:

  • Divergence shows the current state (Position).
  • Slope shows the current speed (Velocity).
  • Acceleration shows the change in speed (Force).

By observing these three metrics simultaneously, users can better identify when a trend is healthy and robust, or when it is beginning to exhaust itself, providing a more comprehensive analytical framework for making informed trading decisions.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
12 Views
0 Downloads
0 Favorites
iFXAnalyser
//+------------------------------------------------------------------+
//|                                                  iFXAnalyser.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
#property indicator_color3 Green

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

//----
int counted_bars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   int    draw_begin;
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetLevelStyle(STYLE_DOT,1,Black);
   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,"Div");
   SetIndexLabel(1,"Slope");
   SetIndexLabel(2,"Acel");
//---- indicator buffers mapping
   if(!SetIndexBuffer(0,ind_buffer0) && !SetIndexBuffer(1,ind_buffer1) && !SetIndexBuffer(2,ind_buffer2))
     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));
//---- Shaun's Slope of Slope counted in the 3-3d buffer
   for(i=0; i<limit-2; i++)
      ind_buffer2[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))
                     -(iMA(NULL,0,FastMA,0,MODE_SMA,Fast_MAMode,i+1)
                        -iMA(NULL,0,SlowMA,0,MODE_SMA,Slow_MAMode,i+1))
                      -(iMA(NULL,0,FastMA,0,MODE_SMA,Fast_MAMode,i+2)
                        -iMA(NULL,0,SlowMA,0,MODE_SMA,Slow_MAMode,i+2)));
//---- done
   return(0);
  }

Comments