Rads MACD_v1

Download script
Author: Copyright � 2007 Steve Bowley
Rads MACD_v1

This script is a custom technical analysis tool designed for the MetaTrader trading platform. It functions as a specialized momentum oscillator that helps traders visualize price trends and potential reversals by interpreting the relationship between moving averages.

Core Functionality

The logic behind this indicator operates in two primary stages: calculation and visual separation.

1. Trend Momentum Calculation At its core, the script calculates a "MACD" (Moving Average Convergence Divergence) value based on specific price weights. It compares two different exponential moving averages—one tracking shorter-term price changes and the other tracking longer-term trends. By subtracting the long-term average from the short-term average, the script identifies the velocity and strength of the current market move.

2. Directional Filtering (The "Rads" Logic) What distinguishes this specific script is how it displays that data. Rather than showing a single fluctuating line, it analyzes the direction of the momentum:

  • It constantly compares the current value against the previous value to determine if the momentum is rising or falling.
  • If the momentum is increasing, the script highlights the data in one color (Lime).
  • If the momentum is decreasing, it switches the display to a different color (Red).

Visual Representation

The tool presents this information in a separate window below your main price chart as a histogram. This provides a clear, visual "pulse" of the market:

  • Color Coding: The change in color allows you to see at a glance when the momentum shifts from bullish (upward) to bearish (downward).
  • Histogram Bars: By using solid bars instead of a continuous line, the tool emphasizes the magnitude of the movement. When the bars are high, it indicates strong momentum; when they move toward the center line, it suggests the trend is losing steam.

Summary for Traders

Essentially, this script acts as a visual filter for market momentum. It simplifies complex mathematical averages into a color-coded histogram that tells you whether the current price movement is accelerating or decelerating, helping you identify potential turning points in the market trend.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
Rads MACD_v1
//+------------------------------------------------------------------+
//|                                                    Rads MACD.mq4 |
//|                                    Copyright © 2007 Steve Bowley |
//|                                        http://www.9squaredfx.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007 Steve Bowley"
#property link      "http://www.9squaredfx.com"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Lime
#property  indicator_color2  Red
//---- indicator buffers
double     ind_buffer1[];
double     ind_buffer2[];
double     ind_buffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 1 additional buffer used for counting.
   IndicatorBuffers(3);
//---- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
   SetIndexDrawBegin(0,36);
   SetIndexDrawBegin(1,36);
//---- 3 indicator buffers mapping
   if(!SetIndexBuffer(0,ind_buffer1) &&
      !SetIndexBuffer(1,ind_buffer2) &&
      !SetIndexBuffer(2,ind_buffer3))
      Print("cannot set indicator buffers!");
//---- Set level Color and Style 
   SetLevelStyle(0, 2, RoyalBlue);
   SetLevelValue(0 , 0);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("Rads MACD");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| 9Squared Oscillator                                              |
//+------------------------------------------------------------------+
int start()
  {
   int    limit;
   int    counted_bars=IndicatorCounted();
   double prev,current;
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1-st additional buffer
   for(int i=0; i<limit; i++)
      ind_buffer3[i]=iMA(NULL,0,18,0,MODE_EMA,PRICE_WEIGHTED,i)-iMA(NULL,0,27,0,MODE_EMA,PRICE_WEIGHTED,i);
//---- dispatch values between 2 buffers
   bool up=true;
   for(i=limit-1; i>=0; i--)
     {
      current=ind_buffer3[i];
      prev=ind_buffer3[i+1];
      if(current>prev) up=true;
      if(current<prev) up=false;
      if(!up)
        {
         ind_buffer2[i]=current;
         ind_buffer1[i]=0.0;
        }
      else
        {
         ind_buffer1[i]=current;
         ind_buffer2[i]=0.0;
        }
     }
//---- done
   return(0);
  }
//+------------------------------------------------------------------+

Comments