AO_AC_Cross_Alert_LimitaAMa_Sintetic

Download script
Author: Andrey Matvievskiy

This script is designed to act as a sophisticated monitoring tool for traders, specifically identifying key momentum shifts in the market by analyzing two technical indicators: the Awesome Oscillator (AO) and the Awesomedonchi (AC).

Core Functionality

The primary goal of this script is to detect "crossovers"—moments where the trend changes direction or crosses a significant neutral zone. It automates the process of watching these movements and provides real-time notifications so that traders do not have to constantly stare at the charts.

How it Works

The logic is divided into two main monitoring streams:

1. Momentum Trend Detection (AO)

  • Directional Crosses: The script looks for instances where the Awesome Oscillator flips its direction (e.g., moving from a downward path to an upward path).
  • Zero-Line Crosses: It also monitors when the indicator crosses the "zero line," which is often interpreted as a shift from bearish to bullish sentiment (or vice versa) regardless of the previous immediate direction.

2. Donchi Momentum Detection (AC)

  • The script performs a parallel analysis on the Awesomedonchi indicator. It follows the same rules as above: it identifies both the reversal of momentum and the crossing of the zero-line.

Visual and Alert Systems

To ensure the trader is informed immediately, the script employs three distinct methods of communication:

  • On-Chart Visuals: When a crossover is detected, the script places visual markers (arrows) directly on the price chart. It intelligently calculates the distance of these arrows based on recent market volatility to ensure they remain visible and clear.
  • Audible Alerts: If enabled, the software will play a sound notification the moment a significant crossover occurs on the current bar.
  • Email Notifications: The script can be configured to send an automated email. This includes detailed information such as the specific price at the time of the cross, the exact date and time, the currency pair being traded, and the timeframe.

Summary for the User

Think of this script as a 24/7 digital sentry. Instead of manually watching two complex indicators to see when they "flip" or cross zero, this tool does the math instantly. When the market shows a potential shift in momentum based on the AO or AC indicators, it highlights it on your screen and sends you an immediate alert via sound or email, allowing for faster reaction times.

Price Data Components
Series array that contains open time of each bar
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screenIt sends emails
7 Views
0 Downloads
0 Favorites
AO_AC_Cross_Alert_LimitaAMa_Sintetic

//+------------------------------------------------------------------+
//|                       AO-AC_Cross_Alert_Limit(AM)Sintetic.mq4    |
//|                                       Andrey Matvievskiy         |                                             
//+------------------------------------------------------------------+

#property copyright "Andrey Matvievskiy"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_width1  3
#property indicator_width2  3
#property indicator_color3 Blue
#property indicator_color4 Red
#property indicator_width3  0
#property indicator_width4  0


extern bool SoundON=false;
extern bool EmailON=false;
//---- input parameters

extern int AO_PeriodMA1 = 34;
extern int AO_PeriodMA2 = 5;
extern int AO_TypeMA1 = 0;
extern int AO_TypeMA2 = 0;
extern int AO_PriceMA1 = 4;
extern int AO_PriceMA2 = 4;
extern int AO_TF1 = 0;
extern int AO_TF2 = 0;
extern int AO_Shift1 = 0;
extern int AO_Shift2 = 0;

extern int AC_PeriodMA1 = 34;
extern int AC_PeriodMA2 = 5;
extern int AC_PeriodMA3 = 5;
extern int AC_TypeMA1 = 0;
extern int AC_TypeMA2 = 0;
extern int AC_TypeMA3 = 0;
extern int AC_PriceMA1 = 4;
extern int AC_PriceMA2 = 4;
extern int AO_AC_TF1 = 0;
extern int AO_AC_TF2 = 0;
extern int AO_AC_Shift1 = 0;
extern int AO_AC_Shift2 = 0;
extern int AO_AC_Shift3 = 0;

extern int CountedBars = 300;


double CrossUp1[];
double CrossDown1[];
double CrossUp2[];
double CrossDown2[];
int flagval1 = 0;
int flagval2 = 0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0, DRAW_ARROW, EMPTY);
   SetIndexArrow(0, 241);
   SetIndexBuffer(0, CrossUp1);
   SetIndexStyle(1, DRAW_ARROW, EMPTY);
   SetIndexArrow(1, 242);
   SetIndexBuffer(1, CrossDown1);
  
   SetIndexStyle(2, DRAW_ARROW, EMPTY);
   SetIndexArrow(2, 241);
   SetIndexBuffer(2, CrossUp2);
   SetIndexStyle(3, DRAW_ARROW, EMPTY);
   SetIndexArrow(3, 242);
   SetIndexBuffer(3, CrossDown2);
   
   SetIndexLabel(0,"AO+");
   SetIndexLabel(1,"AO-");
   SetIndexLabel(2,"AC+");
   SetIndexLabel(3,"AC-");
   
      
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 

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


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
   int limit, i, counter;
   double tmp=0;
   double X, Y, Z, A, B, C;
   double Range, AvgRange;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;

   limit=CountedBars;
   
   for(i = 1; i <= limit; i++) {
   
      counter=i;
      Range=0;
      AvgRange=0;
      for (counter=i ;counter<=i+9;counter++)
      {
         AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
      }
      Range=AvgRange/10;
       
      X = iCustom(NULL, 0, "AO(AM)", AO_PeriodMA1, AO_PeriodMA2, AO_TypeMA1, AO_TypeMA2, AO_PriceMA1, AO_PriceMA2, AO_TF1, AO_TF2, AO_Shift1, AO_Shift2,0,i);
      Y = iCustom(NULL, 0, "AO(AM)", AO_PeriodMA1, AO_PeriodMA2, AO_TypeMA1, AO_TypeMA2, AO_PriceMA1, AO_PriceMA2, AO_TF1, AO_TF2, AO_Shift1, AO_Shift2,0,i+1);
      Z = iCustom(NULL, 0, "AO(AM)", AO_PeriodMA1, AO_PeriodMA2, AO_TypeMA1, AO_TypeMA2, AO_PriceMA1, AO_PriceMA2, AO_TF1, AO_TF2, AO_Shift1, AO_Shift2,0,i+2);
      
      A = iCustom(NULL, 0, "AC(AM)", AC_PeriodMA1, AC_PeriodMA2, AC_PeriodMA3, AC_TypeMA1, AC_TypeMA2, AC_TypeMA3, AC_PriceMA1, AC_PriceMA2, AO_AC_TF1, AO_AC_TF2, AO_AC_Shift1, AO_AC_Shift2, AO_AC_Shift3,0,i);
      B = iCustom(NULL, 0, "AC(AM)", AC_PeriodMA1, AC_PeriodMA2, AC_PeriodMA3, AC_TypeMA1, AC_TypeMA2, AC_TypeMA3, AC_PriceMA1, AC_PriceMA2, AO_AC_TF1, AO_AC_TF2, AO_AC_Shift1, AO_AC_Shift2, AO_AC_Shift3,0,i+1);
      C = iCustom(NULL, 0, "AC(AM)", AC_PeriodMA1, AC_PeriodMA2, AC_PeriodMA3, AC_TypeMA1, AC_TypeMA2, AC_TypeMA3, AC_PriceMA1, AC_PriceMA2, AO_AC_TF1, AO_AC_TF2, AO_AC_Shift1, AO_AC_Shift2, AO_AC_Shift3,0,i+2);      
            
      CrossUp1[i] = 0;
      CrossDown1[i] = 0;
      CrossUp2[i] = 0;
      CrossDown2[i] = 0;
      
      if ((Y<X) && (Z>Y))
      
         {
         if (i == 1 && flagval1==0)
         {
           flagval1=1;
           flagval2=0;
           if (SoundON) Alert("AO UP =",Ask,"\n Bid=",Bid,"\n Time=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime()),"\n Symbol=",Symbol()," Period=",Period());
           if (EmailON) SendMail("AO UP","AO UP ="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
         }
         CrossUp1[i] = Low[i] - Range*0.5;
      }
      if ((Y>X) && (Z<Y))
      {
         if (i == 1 && flagval2==0)
         {
          flagval2=1;
          flagval1=0;
         if (SoundON) Alert("AO DOWN =",Ask,"\n Bid=",Bid,"\n Date=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime()),"\n Symbol=",Symbol()," Period=",Period());
         if (EmailON) SendMail("AO DOWN","AO DOWN ="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
         }
         CrossDown1[i] = High[i] + Range*0.5;
      }
      
      
      if ((Y<0) && (X>0))
      
         {
         if (i == 1 && flagval1==0)
         {
           flagval1=1;
           flagval2=0;
           if (SoundON) Alert("AO UP x 0 =",Ask,"\n Bid=",Bid,"\n Time=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime()),"\n Symbol=",Symbol()," Period=",Period());
           if (EmailON) SendMail("AO UP x 0","AO UP x 0 ="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
         }
         CrossUp1[i] = Low[i] - Range*0.5;
      }
      if ((Y>0) && (X<0))
      {
         if (i == 1 && flagval2==0)
         {
          flagval2=1;
          flagval1=0;
         if (SoundON) Alert("AO DOWN x 0 =",Ask,"\n Bid=",Bid,"\n Date=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime()),"\n Symbol=",Symbol()," Period=",Period());
         if (EmailON) SendMail("AO DOWN x 0","AO DOWN x 0 ="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
         }
         CrossDown1[i] = High[i] + Range*0.5;
      }
      
      if ((B<A) && (C>B))
      
         {
         if (i == 1 && flagval1==0)
         {
           flagval1=1;
           flagval2=0;
           if (SoundON) Alert("AC UP =",Ask,"\n Bid=",Bid,"\n Time=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime()),"\n Symbol=",Symbol()," Period=",Period());
           if (EmailON) SendMail("AC UP","AC UP ="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
         }
         CrossUp2[i] = Low[i] - Range*0.5;
      }
      if ((B>A) && (C<B))
      {
         if (i == 1 && flagval2==0)
         {
          flagval2=1;
          flagval1=0;
         if (SoundON) Alert("AC DOWN =",Ask,"\n Bid=",Bid,"\n Date=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime()),"\n Symbol=",Symbol()," Period=",Period());
         if (EmailON) SendMail("AC DOWN","AC DOWN ="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
         }
         CrossDown2[i] = High[i] + Range*0.5;
      }
      
      
      if ((B<0) && (A>0))
      
         {
         if (i == 1 && flagval1==0)
         {
           flagval1=1;
           flagval2=0;
           if (SoundON) Alert("AC UP x 0 =",Ask,"\n Bid=",Bid,"\n Time=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime()),"\n Symbol=",Symbol()," Period=",Period());
           if (EmailON) SendMail("AC UP x 0","AC UP x 0 ="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
         }
         CrossUp2[i] = Low[i] - Range*0.5;
      }
      if ((B>0) && (A<0))
      {
         if (i == 1 && flagval2==0)
         {
          flagval2=1;
          flagval1=0;
         if (SoundON) Alert("AC DOWN x 0 =",Ask,"\n Bid=",Bid,"\n Date=",TimeToStr(CurTime(),TIME_DATE)," ",TimeHour(CurTime()),":",TimeMinute(CurTime()),"\n Symbol=",Symbol()," Period=",Period());
         if (EmailON) SendMail("AC DOWN x 0","AC DOWN x 0 ="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime())+" Symbol="+Symbol()+" Period="+Period());
         }
         CrossDown2[i] = High[i] + Range*0.5;
      }
     }

   return(0);
}

Comments