Elliott Wave Oscillator_v3

Download script
Author: tonyc2a@yahoo.com
Elliott Wave Oscillator_v3

This tool is designed to help traders visualize market momentum by identifying the difference between short-term and long-term price trends. It operates as an oscillator, which means it appears in a separate window below your main price chart, allowing you to see fluctuations in strength without cluttering the actual price action.

How the Logic Works

The script functions by calculating two distinct types of moving averages simultaneously:

  • Short-Term Trend: The tool looks at a very recent window of price data (defined by the first period setting) to capture immediate market "mood" and quick fluctuations.
  • Long-Term Trend: It simultaneously looks at a much broader window of historical data (defined by the second period setting) to establish the overarching direction of the market.

The Core Calculation

The "Elliott Wave Oscillator" value is generated by subtracting the long-term average from the short-term average. By calculating this gap, the tool highlights how far the current price is deviating from its historical norm:

  1. Expansion: When the indicator moves upward or shows significant height, it indicates that short-term momentum is pulling away from the long-term average (often signifying a strengthening trend).
  2. Contraction: When the indicator moves downward or shrinks toward zero, it suggests that the current price action is cooling off or aligning more closely with the broader historical average.

Visual Representation

The data is displayed as a solid histogram. This visual format makes it easy to spot peaks and valleys at a glance. Traders use this to identify potential "overextended" movements—where the gap between short-term and long-term trends becomes too wide—or to confirm when a new wave of momentum is beginning to take hold.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
15 Views
0 Downloads
0 Favorites
Elliott Wave Oscillator_v3
//+------------------------------------------------------------------+
//|                                      Elliott Wave Oscillator.mq4 |
//|                                                tonyc2a@yahoo.com |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "tonyc2a@yahoo.com"
#property link      ""

#property indicator_separate_window
#property indicator_color1 DimGray
//---- input parameters
extern int EWOPeriod1 = 5;
extern int EWOPeriod2 = 35;
//---- buffers
double Buffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicators
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 2);
   SetIndexBuffer(0, Buffer1);
//---- name for DataWindow and indicator subwindow label
   short_name = "EWO(" + EWOPeriod1 + ", " + EWOPeriod2 + ")";
   IndicatorShortName(short_name);
   SetIndexLabel(0, "EWO");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars = IndicatorCounted();
   double MA1, MA2;
//---- TODO: add your code here
   for(int i = Bars; i >= 0; i--)
     {
       MA1 = iMA(NULL, 0, EWOPeriod1, 0, MODE_SMA, PRICE_MEDIAN, i);
       MA2 = iMA(NULL, 0, EWOPeriod2, 0, MODE_SMA, PRICE_MEDIAN, i);
       Buffer1[i] = MA1-MA2;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments