iFXAnalyser_H4-Open_v1

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

This script is a technical analysis tool designed for the MetaTrader platform to help traders identify momentum and price trends by measuring the relationship between two different moving averages. Instead of just looking at where the price is going, this tool focuses on the "dynamics" of the price movement—specifically how quickly the trend is accelerating or decelerating.

How the Logic Works

The tool functions by comparing a Fast Moving Average (which reacts quickly to recent price changes) against a Slow Moving Average (which represents the broader, longer-term trend). It breaks down the market data into three distinct layers of information:

1. The Divergence (The Gap) The primary logic calculates the distance between the Fast and Slow moving averages. By finding the difference between these two lines at any given moment, the tool reveals how much the current price is "pulling away" from its historical average. A widening gap often indicates strengthening momentum, while a narrowing gap suggests the trend may be losing steam.

2. The Slope (The Rate of Change) Beyond just measuring the gap, the script calculates the "Slope." This identifies how that gap is changing from one candle to the next. It essentially asks: Is the distance between the averages getting bigger or smaller? By tracking this change, the tool helps identify if a trend is becoming more aggressive or starting to flatten out.

3. The Acceleration (The Momentum Shift) By comparing the current slope against the previous one, the logic determines the acceleration of the market. This allows traders to see "momentum within momentum." It helps in identifying points where the speed of a price move might be peaking, providing a more nuanced view of market velocity than a standard moving average could provide on its own.

Summary for Traders

In practical terms, this script transforms raw price data into a visual representation of market energy. Rather than simply telling you the direction of the price, it provides a "speedometer" and "accelerometer." It helps traders visualize whether a move is gaining strength, slowing down, or potentially exhausting itself, allowing for more informed decisions regarding entry and exit points based on trend health.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
5 Views
1 Downloads
0 Favorites
iFXAnalyser_H4-Open_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                               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_OPEN;
int Slow_MAMode = PRICE_OPEN;

//----
int counted_bars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   int    draw_begin;
   string short_name = "iFXAnalyser_H4-Open";
//---- 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-1)
                     -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-1)
                       -iMA(NULL,0,SlowMA,0,MODE_SMA,Slow_MAMode,i))
                     -(iMA(NULL,0,FastMA,0,MODE_SMA,Fast_MAMode,i+1-1)
                       -iMA(NULL,0,SlowMA,0,MODE_SMA,Slow_MAMode,i+1));
//---- done
   return(0);
  }

Comments