Elliott Wave Oscillator

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

This Elliott Wave Oscillator is a technical analysis tool designed to help traders visualize price momentum and identify potential shifts in market direction based on moving averages. Instead of just looking at raw price action, this script calculates the mathematical relationship between two different timeframes of average price movement.

How the Logic Works

1. The Foundation: Moving Averages The tool tracks two specific "Moving Averages": a fast-responding one (5-period) and a slower, broader one (35-period). By calculating the difference between these two averages, the script identifies the "gap" or momentum between short-term price trends and long-term price trends.

2. Visual Representation The indicator displays this momentum in a separate window below your main trading chart as a histogram:

  • Positive Momentum: When the fast average is higher than the slow average, the values appear in one color (Green), indicating upward pressure.
  • Negative Momentum: When the fast average falls below the slow average, the values switch to another color (Red), indicating downward pressure.

3. Automated Wave Detection The core intelligence of this script lies in its ability to recognize "waves." It constantly monitors the interaction between these two momentum values:

  • Upward Wave Initiation: The script detects when the trend shifts from negative to positive and triggers an alert when a new upward wave begins.
  • Downward Wave Initiation: Conversely, it monitors for the point where momentum flips from positive to negative to signal the start of a downward wave.

4. Target Threshold Alerts Beyond just identifying the start of a move, the script includes specific "hit" triggers. It monitors whether the momentum reaches a predefined mathematical threshold (a specific intensity level). If the upward momentum exceeds a certain strength or if the downward momentum drops below a certain depth, the system will generate an alert.

User Experience

For a trader, this means you don't have to constantly watch the lines for subtle changes. The script does the heavy lifting by scanning every price bar. When it detects a significant shift in the "Elliott Wave" structure—such as a new trend starting or a move reaching a specific intensity—it sends a real-time notification (Alert) directly to your trading platform, allowing you to react quickly to market changes.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
8 Views
0 Downloads
0 Favorites
Elliott Wave Oscillator
//+------------------------------------------------------------------+
//|                                      Elliott Wave Oscillator.mq4 |
//|                                                tonyc2a@yahoo.com |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "tonyc2a@yahoo.com"
#property link      ""
#property indicator_buffers 2
#property indicator_separate_window
#property indicator_color1 LawnGreen
#property indicator_color2 Red

//---- buffers
double Buffer1[];
double Buffer2[];
double alertBar;
double prev;
double prev1;
extern int SoundAlertMode = 1;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexBuffer(0,Buffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexBuffer(1,Buffer2);
   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 MA5,MA35;
//---- TODO: add your code here
   for(int i=Bars;i>=0;i--){
      MA5=iMA(NULL,0,5,0,MODE_SMA,PRICE_MEDIAN,i);
      MA35=iMA(NULL,0,35,0,MODE_SMA,PRICE_MEDIAN,i);
      
      if(Buffer2[i]  > 0) {Buffer1[i]=MA5-MA35;Buffer2[i]=0;}
      if(Buffer1[i]  < 0) {Buffer2[i]=MA5-MA35;Buffer1[i]=0;}

      if(prev != 2 && Buffer2[i] < Buffer1[i] && SoundAlertMode > 0 && Bars>alertBar) {Alert("Elliot Wave new Up wave starting on ",Symbol()," Period ",Period(),"buf1= ",Buffer1[i],"buf2= ",Buffer2[i]," prev = ", prev);alertBar = Bars;prev = 2;}
      if(prev != 1 && Buffer2[i] > Buffer1[i] && Buffer2[i] != 0 && SoundAlertMode > 0 && Bars>alertBar) {Alert("Elliot Wave new Down wave starting on ",Symbol()," Period ",Period(),"buf1= ",Buffer1[i],"buf2= ",Buffer2[i]," prev = ", prev);alertBar = Bars;prev = 1;}
      if(Buffer1[i] >= 0.0005 && Buffer2[i] != 0 && SoundAlertMode > 0 && Bars>alertBar) {Alert("Up wave Hit 0.0005 on ",Symbol()," Period ",Period()," buf1= ",Buffer1[i]," buf2= ",Buffer2[i]);alertBar = Bars;prev = Buffer1[i];}
      if(Buffer2[i] <= -0.0003 && Buffer1[i] != 0 && SoundAlertMode > 0 && Bars>alertBar) {Alert("Down wave Hit -0.0003 on ",Symbol()," Period ",Period()," buf1= ",Buffer1[i]," buf2= ",Buffer2[i]);alertBar = Bars;prev1 = Buffer2[i];}
      }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments