AO_Email Alerted

AO_Email Alerted

This tool is designed to enhance your trading experience by providing automated visual and notification cues based on the Awesome Oscillator (AO), a popular momentum indicator used to identify trend strength and reversals. Instead of requiring you to constantly watch the charts for subtle shifts, this script acts as an intelligent monitor that alerts you when specific market conditions are met.

Core Functionality

The script performs three main tasks: calculating momentum trends, identifying visual shifts in data, and delivering real-time notifications (Pop-ups and Emails).

1. Trend Identification & Visualization

The tool analyzes the relationship between two different moving averages to determine the current "speed" of price movement. It then translates this data into a clear visual format:

  • Momentum Tracking: It calculates whether the market is gaining or losing strength.
  • Color-Coded Histogram: The script automatically separates these movements into distinct visual bars (Histograms). This makes it much easier to see at a glance whether momentum is currently driving upward or downward.
  • Signal Line Smoothing: It creates a secondary "Signal Line" based on the main data. This line acts as a baseline, helping traders filter out minor market noise to focus on more significant trend changes.

2. Automated Alert System

The primary purpose of this script is to notify you immediately when specific "crossover" events occur. You can customize which of these alerts you want to receive:

  • Signal Line Crossovers: The tool monitors the main momentum data against its own signal line. When the momentum crosses over this line, it indicates a potential change in direction (a "Buy" or "Sell" opportunity).
  • Zero-Line Crossovers: It watches for the moment momentum shifts from positive to negative (or vice versa) relative to the zero midpoint. This is often used to identify the transition between a bullish and a bearish market phase.

3. Multi-Channel Notifications

To ensure you never miss a potential trade, the script provides two layers of communication:

  • On-Screen Alerts: Immediate pop-up notifications appear directly on your trading platform to grab your attention.
  • Email Integration: If enabled, the tool will automatically send an email to your registered account. This allows you to stay informed about market movements even when you are away from your computer.

Summary for the Trader

Essentially, this script transforms a standard momentum indicator into a proactive assistant. It monitors the "heartbeat" of the market 24/7 and pings you specifically when the data suggests a trend reversal or a significant shift in momentum, allowing for faster reaction times and more consistent monitoring.

Indicators Used
Moving average indicatorMoving average indicator
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screenIt sends emails
9 Views
0 Downloads
0 Favorites
AO_Email Alerted
//+------------------------------------------------------------------+
//|                                             AO_Email Alerted.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                    DW Trading/Oromek Programming |
//|                                                                  |
//+------------------------------------------------------------------+

#property  copyright "DW Trading & Oromek Programming"
#property  link      "Your Welcome"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 4
#property  indicator_color1  Black
#property  indicator_color2  MediumBlue
#property  indicator_width2  4
#property  indicator_color3  Crimson
#property  indicator_width3  4
#property  indicator_color4  CLR_NONE

extern int Fast = 5;
extern int Slow = 34;
extern int Signal=5;
extern int SignalShift=0;
extern bool EnableSignalLineAlert = false;
extern bool EnableZeroLineCrossoverAlert = true;
extern bool EMail_Signals=true;

//---- indicator buffers
double     ExtBuffer0[];
double     ExtBuffer1[];
double     ExtBuffer2[];
double     SignalBuffer[];
int a=0,b=0,c=0,d=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   //---- drawing settings
   SetIndexStyle(0,DRAW_NONE);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexStyle(3,DRAW_LINE,STYLE_SOLID);
    SetIndexShift( 3, SignalShift); 
   
   IndicatorDigits(Digits+1);
   SetIndexDrawBegin(0,34);
   SetIndexDrawBegin(1,34);
   SetIndexDrawBegin(2,34);
   SetIndexDrawBegin(3,34);
   
//---- 3 indicator buffers mapping
   SetIndexBuffer(0,ExtBuffer0);
   SetIndexBuffer(1,ExtBuffer1);
   SetIndexBuffer(2,ExtBuffer2);
   SetIndexBuffer(3,SignalBuffer);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("Email Alerted AO");
   SetIndexLabel(1,NULL);
   SetIndexLabel(2,NULL);
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Awesome Oscillator                                               |
//+------------------------------------------------------------------+
int start()
  {
   int    limit;
   int    counted_bars=IndicatorCounted();
   double prev,current;
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd
   for(int i=0; i<limit; i++)
      ExtBuffer0[i]=iMA(NULL,0,Fast,0,MODE_SMA,PRICE_MEDIAN,i)-iMA(NULL,0,Slow,0,MODE_SMA,PRICE_MEDIAN,i);
//---- dispatch values between 2 buffers
   bool up=true;
   for(i=limit-1; i>=0; i--)
     {
      current=ExtBuffer0[i];
      prev=ExtBuffer0[i+1];
      if(current>prev) up=true;
      if(current<prev) up=false;
      if(!up)
        {
         ExtBuffer2[i]=current;
         ExtBuffer1[i]=0.0;
        }
      else
        {
         ExtBuffer1[i]=current;
         ExtBuffer2[i]=0.0;
        }
     }
// ----- Draw signal
    for(i=0; i<limit; i++)
         SignalBuffer[i]=iMAOnArray(ExtBuffer0,Bars,Signal,0,MODE_SMA,i);
         
         
    if(EnableSignalLineAlert)
    {
       if(ExtBuffer0[0]<SignalBuffer[0] && ExtBuffer0[1]>=SignalBuffer[1] && Bars>a)
       {
         Alert(Symbol()+" Period "+Period()+" AO CROSSED Signal (SELL)");
         if (EMail_Signals) SendMail(Symbol()+": AO CROSSED Signal (SELL)",Symbol()+" Period "+Period()+" AO CROSSED Signal (SELL)");
         a = Bars;
       }
       
       if(ExtBuffer0[0]>SignalBuffer[0] && ExtBuffer0[1]<=SignalBuffer[1] && Bars>b)
       {
         Alert(Symbol()+" Period "+Period()+" AO CROSSED Signal (BUY)");
         if (EMail_Signals) SendMail(Symbol()+": AO CROSSED Signal (BUY)",Symbol()+" Period "+Period()+" AO CROSSED Signal (BUY)");
         b = Bars;
       } 
    }     
    
    if(EnableZeroLineCrossoverAlert)
    {
       if(ExtBuffer0[0]<0 && ExtBuffer0[1]>=0 && Bars>c)
       {
         Alert(Symbol()+" Period "+Period()+" AO CROSSED ZERO LINE (SELL)");
         if (EMail_Signals) SendMail(Symbol()+": AO CROSSED Signal (SELL)",Symbol()+" Period "+Period()+" AO CROSSED Signal (SELL)");
         c = Bars;
       }
       
       if(ExtBuffer0[0]>0 && ExtBuffer0[1]<=0 && Bars>d)
       {
         Alert(Symbol()+" Period "+Period()+" AO CROSSED ZERO LINE (BUY)");
         if (EMail_Signals) SendMail(Symbol()+": AO CROSSED Signal (BUY)",Symbol()+" Period "+Period()+" AO CROSSED Signal (BUY)");
         d = Bars;
       }
    }
         
//---- done
   return(0);
  }
//+------------------------------------------------------------------+

Comments