iFXAnalyser_v2
Download scriptThe iFXAnalyser is a specialized technical analysis tool designed to help traders visualize the underlying momentum and velocity of price movements. Rather than simply looking at where the price is, this script analyzes how the relationship between two different Moving Averages (MAs) is changing over time.
By calculating the mathematical differences between "Fast" and "Slow" moving averages, the tool breaks down market behavior into three distinct layers of information:
1. Divergence (The Gap)
The first layer tracks the basic distance between a fast-moving average and a slow-moving average. This represents the current spread or "gap" between short-term and long-term price trends. It shows you how much the immediate price action is pulling away from its broader historical average.
2. Slope (The Velocity)
The second layer measures the rate of change in that gap. Instead of looking at how wide the distance is, it looks at whether that distance is growing or shrinking.
- If the slope is increasing, it suggests that the momentum is accelerating.
- If the slope is decreasing, it indicates that the momentum is slowing down, even if the price is still moving in the same direction.
3. Acceleration (The Force)
The third layer measures the "Slope of the Slope." This identifies the acceleration of the trend—essentially showing you how fast the velocity itself is changing. This is a deeper level of analysis that helps identify when a move is gaining significant "force" or when it is beginning to exhaust. By tracking these three layers, the tool allows traders to see not just where the market is going, but how much energy is behind the movement and whether that energy is starting to fade.
Summary for Traders
In practical terms, this script helps filter out "noise" by providing a multi-dimensional view of trend strength. It allows you to distinguish between a steady, healthy trend and a weakening move that might be about to reverse, by highlighting changes in momentum before they become obvious on a standard price chart.
//+------------------------------------------------------------------+
//| 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