iFXAnalyser_H4_Ron_v011

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

The iFXAnalyser_H4 is a specialized technical analysis tool designed for the MetaTrader platform to help traders identify significant momentum shifts and price trends by measuring the relationship between two moving averages. Unlike standard indicators that simply show price averages, this script calculates the "velocity" and "acceleration" of market movement to pinpoint potential turning points.

Core Logic Overview

The script operates by comparing a Fast Moving Average (which reacts quickly to recent price changes) against a Slow Moving Average (which reflects broader trends). Instead of looking at the averages themselves, the tool focuses on the mathematical gap between them.

Key Functional Components

  • Trend Measurement (The Blue Line): The primary calculation determines the distance between the Fast and Slow moving averages. By subtracting the slow average from the fast average, the tool produces a value representing the current strength of the trend. A widening gap suggests increasing momentum, while a narrowing gap may indicate a weakening trend.

  • Momentum Acceleration (The Red Line): The script goes a step further by calculating the change in that distance from one candle to the next. This measures "acceleration"—essentially telling the trader not just if the price is moving, but how much faster it is moving compared to the previous period.

  • Signal Visualization (Visual Alerts): The tool includes an automated marking system to highlight critical threshold breaches on the chart:

    • Primary Thresholds: When the trend distance reaches a specific high level (defined by user settings), the script places a visual marker on the chart to signal significant momentum.
    • Acceleration Alerts: The script also monitors the "acceleration" value. If the rate of change exceeds a secondary threshold, it provides an additional visual cue, helping traders identify areas where price movement is becoming volatile or extreme.

Summary for Traders

This indicator acts as a diagnostic tool for market dynamics. By visualizing the distance and the speed of moving averages, it allows you to see "under the hood" of price action. It helps filter out minor price fluctuations, highlighting only the moments where momentum becomes significant enough to potentially signal a major trend shift or an overextended move.

Price Data Components
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
iFXAnalyser_H4_Ron_v011
/*-----------------------------+
|			       |
| 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
#property indicator_color3 White

// Externals
extern int BarCount=5000;
extern double DVLimit0=10.0;
extern double DVLimit1= 5.0;

//indicator buffers
double ind_buffer0[];
double ind_buffer1[];
double ind_buffer2[];

// indicator controls
extern int FastMA=4;
extern int SlowMA=6;

int Fast_MAMode = PRICE_CLOSE;
int Slow_MAMode = PRICE_OPEN;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ind_buffer0);
   
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ind_buffer1);

   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ind_buffer2);

   int i;
   //remove the old objects 
   for(i=0; i<=BarCount; i++) 
     {
      ObjectDelete("myx"+DoubleToStr(i,0));
     }
  }
  
  
//+-----------+
//| DeInit    |
//+-----------+
int deinit()
  {
   int i;
   //remove the old objects 
   for(i=0; i<=BarCount; i++) 
     {
      ObjectDelete("myx"+DoubleToStr(i,0));
     }
  }
  
  
//+------------------------------------------------------------------+
//| Shaun's 2MA difference                                           |
//+------------------------------------------------------------------+
int start()
  {
   int limit=BarCount;
   int i;
   
   double pos;

   double maF1, maF2, maS1, maS2;
   
   for(i=0; i<limit; i++)
     {
      maF1=iMA(NULL,0,FastMA,0,MODE_SMA,Fast_MAMode,i);
      maS1=iMA(NULL,0,SlowMA,0,MODE_SMA,Slow_MAMode,i);
      ind_buffer0[i]=(maF1-maS1)/Point();                //Blue

      maF2=iMA(NULL,0,FastMA,0,MODE_SMA,Fast_MAMode,i+1);
      maS2=iMA(NULL,0,SlowMA,0,MODE_SMA,Slow_MAMode,i+1);
      ind_buffer1[i]=((maF1-maS1)-(maF2-maS2))/Point();   //Red
      ind_buffer2[i]=ind_buffer1[i]*4;

      pos=( (High[i]+Low[i]+Close[i])/3 ) + ( 13*Point() );
      
      if( ind_buffer0[i] >= DVLimit0 || ind_buffer0[i] <= DVLimit0*(-1) )
        {
         ObjectDelete( "myx"+DoubleToStr(i,0));
         ObjectCreate( "myx"+DoubleToStr(i,0), OBJ_TEXT, 0, Time[i], pos);
         ObjectSetText("myx"+DoubleToStr(i,0),".",32,"Arial",Blue);
        }
      if( ind_buffer2[i] >= DVLimit1 || ind_buffer2[i] <= DVLimit1*(-1) )
        {
         ObjectDelete( "myx"+DoubleToStr(i,0));
         ObjectCreate( "myx"+DoubleToStr(i,0), OBJ_TEXT, 0, Time[i], pos);
         ObjectSetText("myx"+DoubleToStr(i,0),".",32,"Arial",Red);
        }

     }
      
  }

Comments