ZeroLag OsMA

Download script
Author: Copyright � 2007, Ryan Klefas
ZeroLag OsMA

The ZeroLag OsMA is a specialized technical analysis tool designed to help traders identify market momentum and trend directions with increased responsiveness. It operates by processing price data through a specific multi-layered calculation to visualize the strength of a movement in a separate window on your trading chart.

How the Logic Works

Core Foundation: The ZeroLag MACD The script functions as a wrapper for a primary indicator called the "ZeroLag MACD." Standard momentum indicators often suffer from "lag," meaning they show price changes only after they have already occurred. The ZeroLag component is designed to minimize this delay, attempting to provide a more immediate reflection of current market behavior.

Dual-Data Processing The logic works by pulling two distinct streams of information from the ZeroLag MACD:

  1. The Main Line: This represents the primary momentum calculation based on fast and slow moving averages.
  2. The Signal Line: This is a secondary, smoothed version of the main line used to filter out "noise" or minor price fluctuations.

The Final Calculation (The OsMA) Instead of simply plotting these two lines individually, this script performs a subtraction logic. It calculates the difference between the Main Line and the Signal Line at every point in time.

Visual Representation The result of this subtraction is displayed as a histogram. This visual format allows you to see:

  • Direction: Whether the gap between momentum and the signal is widening or narrowing.
  • Strength: The height of the histogram bars indicates the magnitude of the current trend.
  • Trend Shifts: By observing how the bars move relative to the zero point, traders can better identify potential shifts in market sentiment.

Key Customization Parameters

Users can fine-tune the sensitivity of the indicator by adjusting three specific variables:

  • Fast EMA: Controls how quickly the indicator reacts to recent price changes.
  • Slow EMA: Provides the long-term context for the trend.
  • Signal EMA: Determines the smoothness of the signal filter, helping to balance between responsiveness and stability.
Miscellaneous
Implements a curve of type %1
7 Views
0 Downloads
0 Favorites
ZeroLag OsMA
//+------------------------------------------------------------------+
//|                                                 ZeroLag OsMA.mq4 |
//|                                    Copyright © 2007, Ryan Klefas |
//|                                        http://www.metaquotes.net |
//|                                      Last Update:  June 28, 2007 |
//+------------------------------------------------------------------+
//| REQUIRES:                                                        |
//+------------------------------------------------------------------+
//| ZeroLag MACD.mq4                                                 |
//+------------------------------------------------------------------+

#property copyright "Copyright © 2007, Ryan Klefas"
#property link      "rklefas@inbox.com"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Orchid

//---- input parameters
extern int       FastEMA=12;
extern int       SlowEMA=24;
extern int       SignalEMA=9;

//---- buffers
double OsmaBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(0);
   SetIndexBuffer(0,OsmaBuffer);
   
   SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,2);
   SetIndexDrawBegin(0,SlowEMA);
   IndicatorDigits(Digits+2);


   IndicatorShortName("ZeroLag OsMA ("+FastEMA+","+SlowEMA+","+SignalEMA+")");
   SetIndexLabel(0,"ZeroLag OsMA");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;


   for(int i=0; i<limit; i++)
      OsmaBuffer[i]=main(i)-signal(i);


   return(0);
}
  
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

double main(int xx)
{  return (iCustom(NULL, 0, "ZeroLag MACD", FastEMA, SlowEMA, SignalEMA, 0, xx));  }

//+------------------------------------------------------------------+

double signal(int xx)
{  return (iCustom(NULL, 0, "ZeroLag MACD", FastEMA, SlowEMA, SignalEMA, 1, xx));  }

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

//+------------------------------------------------------------------+

Comments