Ehlers Super Smoother Smoothed oscillator

Download script
Author: Copyright � 2009, Julien Loutre
Ehlers Super Smoother Smoothed oscillator

This tool functions as a sophisticated visual oscillator designed to help traders identify the underlying momentum and direction of a market price with reduced "noise." Instead of looking at raw price movements, which can be erratic and distracting, this script processes data through a specialized smoothing mathematical model to highlight clearer trends.

How the Logic Works

1. The Foundation: Advanced Smoothing At its core, the script utilizes a "Two Pole Super Smoother" calculation. In non-technical terms, think of this as a high-quality filter. It takes the volatile price data and smooths out the "jitters"—the small, insignificant fluctuations that often mislead short-term traders—while attempting to preserve the significant trend movements.

2. Momentum Calculation The script doesn't just look at the smoothed price; it looks at the change between those prices. By calculating the difference between current and previous smoothed values, it determines the velocity of the market. This allows the tool to react to how fast the price is moving in a specific direction.

3. Dual-Directional Visualization The indicator translates these complex calculations into three distinct visual elements on your chart:

  • The Trend Line: A continuous line that represents the smoothed path of the market.
  • Upward Momentum (Osc UP): When the market moves higher than it did in the previous period, the script highlights this positive momentum as a histogram. This helps visually confirm an accelerating upward trend.
  • Downward Momentum (Osc DOWN): Conversely, when the market drops below its previous level, the script highlights the negative momentum.

Summary of User Experience

For a trader, this means the script acts like a "trend stabilizer." Rather than seeing every tiny tick in price, you see a refined representation of where the market is heading. When the histogram bars appear on the upper side, it signals strengthening bullish momentum; when they appear on the lower side, it indicates strengthening bearish momentum. By observing these shifts, you can more easily identify whether a trend is gaining strength or beginning to lose steam.

12 Views
0 Downloads
0 Favorites
Ehlers Super Smoother Smoothed oscillator
//+------------------------------------------------------------------+
//|                                                  Accelerator.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Julien Loutre"
#property link      "http://www.zenhop.com"

#property  indicator_separate_window
#property  indicator_buffers 3
#property  indicator_color1  LightBlue
#property  indicator_color2  DodgerBlue
#property  indicator_color3  Red

extern int        CuttOff  = 15;
extern double     alpha    = 0.15;
extern int        shift    = 0;

double      EMA[],Osc[],OscUP[],OscDOWN[];


int init() {
   IndicatorBuffers(3);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_HISTOGRAM,0,2);
   SetIndexStyle(2,DRAW_HISTOGRAM,0,2);
   IndicatorDigits(6);
   SetIndexDrawBegin(0,0);
   SetIndexBuffer(0,EMA);
   SetIndexBuffer(1,OscUP);
   SetIndexBuffer(2,OscDOWN);
   SetIndexShift(0,shift);
   SetIndexLabel(0,NULL);
   SetIndexLabel(0,"Osc");
   SetIndexLabel(1,"Osc UP");
   SetIndexLabel(2,"Osc DOWN");
   IndicatorShortName("Two pole Smoothed Oscillator ("+CuttOff+","+DoubleToStr(alpha,2)+")");
   
   return(0);
}
  
int start() {
   int    counted_bars=IndicatorCounted();
   int    limit,i;
   
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   
   for(i=limit-1; i>=0; i--) {
      EMA[i] = (alpha-((alpha/2)*(alpha/2)))*getValue(i)+((alpha*alpha)/2)*getValue(i+1)-(alpha-(3*(alpha*alpha)/4))*getValue(i+2)+2*(1-alpha)*EMA[i+1]-((1-alpha)*(1-alpha))*EMA[i+2];
      
      if (EMA[i] > EMA[i+1]) {
         OscUP[i] = EMA[i];
         OscDOWN[i] = EMPTY_VALUE;
      }
      if (EMA[i] < EMA[i+1]) {
         OscUP[i] = EMPTY_VALUE;
         OscDOWN[i] = EMA[i];
      }
   }
   return(0);
}

double getValue(int i) {
   return(iCustom(NULL,0,"Ehlers Two Pole Super Smoother Filter", CuttOff, 0, i)-iCustom(NULL,0,"Ehlers Two Pole Super Smoother Filter", CuttOff, 0, i+1));
}

Comments