JMA_MACD [i]

Download script
JMA_MACD [i]

Technical Overview: JMA MACD Indicator

This script functions as a custom technical analysis tool designed to help traders identify momentum and trend shifts in the financial markets. It combines two sophisticated mathematical concepts—the Jurik Moving Average (JMA) and the Moving Average Convergence Divergence (MACD)—to create a visual representation of price trends with reduced "noise."

Core Logic and Methodology

The tool operates through a three-step calculation process to generate the data you see on your trading chart:

1. The Foundation: Jurik Moving Average (JMA) Unlike standard moving averages, which can often be sluggish or produce many false signals (lag), this script utilizes the Jurik Moving Average. The JMA is specifically engineered to be highly responsive to price changes while maintaining a smooth curve. The script calculates two distinct versions of this average:

  • A Fast Version: Designed to react quickly to immediate price movements.
  • A Slow Version: Designed to track the broader, longer-term trend.

2. The Momentum Calculation (The MACD Component) The script then takes the difference between these two JMA values. By subtracting the "Slow" average from the "Fast" average, the indicator reveals the "gap" between short-term and long-term price action.

  • When the gap widens, it indicates strengthening momentum.
  • When the gap narrows or flips, it suggests a potential change in the trend's direction. This result is displayed as a histogram on your chart.

3. The Signal Smoothing To prevent traders from reacting to minor, insignificant fluctuations in the histogram, the script performs one final calculation. It applies a Simple Moving Average (SMA) to the resulting data. This creates a "Signal Line." This line acts as a secondary guide; when the main histogram crosses over or under this signal line, it provides a more refined cue regarding potential entry or exit points.

Summary of Functionality

In simple terms, this script filters out the market's "jitter" using Jurik’s specialized smoothing logic. It then compares two different speeds of that smoothing to tell you whether the current trend is accelerating or decelerating, providing a clearer picture of market sentiment than standard indicators might offer alone.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
16 Views
0 Downloads
0 Favorites
JMA_MACD [i]
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                  JMA_MACD.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2005, scorpion."
#property  link      "http://www.fxfisherman.com/"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Silver
#property  indicator_color2  Red
//---- indicator parameters
extern int FastJMA=12;
extern int SlowJMA=26;
extern int SignalSMA=9;
extern int FastJMAPhrase=0;
extern int SlowJMAPhrase=0;
//---- indicator buffers
double     ind_buffer1[];
double     ind_buffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,3);
   SetIndexDrawBegin(1,SignalSMA);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
//---- indicator buffers mapping
   if(!SetIndexBuffer(0,ind_buffer1) && !SetIndexBuffer(1,ind_buffer2))
      Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("JMA MACD("+FastJMA+","+SlowJMA+","+SignalSMA+")");
   SetIndexLabel(0,"JMAMACD");
   SetIndexLabel(1,"Signal");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   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--;
   limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
   for(int i=0; i<limit; i++)
      ind_buffer1[i]= iCustom(NULL,0,"JMA",FastJMA,FastJMAPhrase,0,i) - iCustom(NULL,0,"JMA",SlowJMA,SlowJMAPhrase,0,i);
      //ind_buffer1[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd buffer
   for(i=0; i<limit; i++)
      ind_buffer2[i]=iMAOnArray(ind_buffer1,Bars,SignalSMA,0,MODE_SMA,i);
//---- done
   return(0);
  }

Comments