QQE_with_Alertsd

Download script
Author: Copyright � 2008 Tim Hyder
QQE_with_Alertsd

This indicator is designed to provide traders with a sophisticated visual representation of market momentum and trend direction. By blending several advanced mathematical concepts, it aims to filter out "market noise" and highlight significant shifts in price movement more clearly than standard indicators might achieve on their own.

Core Logic Overview

The script operates by layering multiple layers of data processing to arrive at its final output:

  • Momentum Filtering: The system begins by calculating the Relative Strength Index (RSI), a common tool used to measure the speed and change of price movements. However, instead of showing the raw RSI, the script applies an Exponential Moving Average (EMA) to smooth out the data, focusing on the underlying trend rather than erratic short-term fluctuations.
  • Volatility Integration: To ensure the indicator reacts appropriately to different market conditions, it incorporates a volatility component. It measures the absolute differences between smoothed data points and then applies another layer of smoothing to this "volatility" metric. This helps the indicator understand whether a price move is significant or just minor market "flutter."
  • Dynamic Trend Tracking: The heart of the logic lies in its trend-tracking mechanism. It compares the current smoothed momentum against a calculated threshold. If the momentum moves significantly enough (based on the volatility factor), the script updates its "trend level." This creates a visual line that adapts to the market's pace—expanding during high-volatility trends and tightening during quieter periods.

Visual Output & User Experience

The indicator produces a distinct visual line on your chart. When this line moves, it reflects the current qualitative direction of the market:

  • Trend Identification: It helps traders visualize the "flow" of the market.
  • Threshold Monitoring: There is a designated central level (the equilibrium point). The logic specifically monitors when the trend line crosses above or below this level.

Automated Alert System

Beyond just providing a visual on the chart, the script includes a comprehensive notification system. It is programmed to monitor for "crosses"—specific moments when the trend line moves from one side of your chosen threshold to the other. When these events occur, the script can be configured to provide:

  • On-Screen Pop-ups: Instant visual notifications on your trading platform.
  • Audio Alerts: Sound files to notify you of a crossover without needing to watch the screen constantly.
  • Email Notifications: Optional alerts sent directly to your inbox, providing the symbol name, timeframe, and direction of the cross (Up or Down).

Summary for Traders

Essentially, this tool takes raw price data and puts it through a "refinery." It strips away the minor noise of the market by smoothing the momentum and adjusting for volatility. It then provides you with a clear, moving line that signals when the market is shifting directions, accompanied by optional alerts so you never miss a potential trend change.

Indicators Used
Relative strength indexMoving average indicator
Miscellaneous
Implements a curve of type %1It plays sound alertsIt sends emails
13 Views
0 Downloads
0 Favorites
QQE_with_Alertsd
//+------------------------------------------------------------------+ 
//|   Qualitative Quantitative Estimation Indicator with Alerts      |
//|                                   Copyright © 2006 Roman Ignatov |
//|                                  mailto:roman.ignatov@gmail.com  | 
//|                                                                  |
//| V1.   Completed by Roman Ignatov 2006 (roman.ignatov@gmail.com)  |
//| V2.   Completed by Tim Hyder 2008                                |
//|               a)   Complete Code rewrite                         |
//|               b)   Added Audio, Visual and eMail alerts          | 
//|                                                                  |
//|   Copyright © 2008, Tim Hyder aka Hiachiever                     |
//|                                                                  |
//|   PO BOX 768, Hillarys, Western Australia, Australia, 6923       |
//|                                                                  |
//|   GIFTS AND DONATIONS ACCEPTED                                   | 
//|   All my indicators should be considered donationware. That is   |
//|   you are free to use them for your personal use, and are        |
//|   under no obligation to pay for them. However, if you do find   |
//|   this or any of my other indicators help you with your trading  |
//|   then any Gift or Donation as a show of appreciation is         |
//|   gratefully accepted.                                           |
//|                                                                  |
//|   Gifts or Donations also keep me motivated in producing more    |
//|   great free indicators. :-)                                     |
//|                                                                  |
//|   PayPal - hiachiever@gmail.com                                  |  
//+------------------------------------------------------------------+ 
//mod+alert delay
#property copyright "Copyright © 2008 Tim Hyder"
#property link      "mailto:hiachiever@gmail.com"
//----
#define vers    "09.Feb.2008"
#define major   1
#define minor   0
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_style1 STYLE_SOLID
#property indicator_width1 2
#property indicator_color2 Yellow
#property indicator_style2 STYLE_DOT
#property indicator_level1 50
#property indicator_levelcolor Aqua
#property indicator_levelstyle STYLE_DOT
//----
extern string NOTESETTINGS=" --- INDICATOR SETTINGS ---";
extern int SF=5;
extern string NOTEALERTS=" --- Alerts ---";
extern int AlertLevel=50;
extern int AlertDelay=0;

extern bool MsgAlerts=true;
extern bool SoundAlerts=true;
extern string SoundAlertFile="alert.wav";
extern bool eMailAlerts=false;
//----
int RSI_Period=14;
int Wilders_Period;
int StartBar, LastAlertBar;
datetime LastAlertTime;
double TrLevelSlow[];
double AtrRsi[];
double MaAtrRsi[];
double Rsi[];
double RsiMa[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   Wilders_Period=RSI_Period * 2 - 1;
   if (Wilders_Period < SF)
      StartBar=SF;
   else
      StartBar=Wilders_Period;
//----
   IndicatorBuffers(6);
   SetIndexBuffer(0, RsiMa);
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexLabel(0, "Value 1");
   SetIndexDrawBegin(0, StartBar);
   SetIndexStyle(1, DRAW_LINE, STYLE_DOT);
   SetIndexBuffer(1, TrLevelSlow);
   SetIndexLabel(1, "Value 2");
   SetIndexDrawBegin(1, StartBar);
   SetIndexBuffer(2, AtrRsi);
   SetIndexBuffer(3, MaAtrRsi);
   SetIndexBuffer(4, Rsi);
   IndicatorShortName(StringConcatenate("QQE(", SF, ")"));
//----
   LastAlertBar=Bars-1;
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int counted, i;
   double rsi0, rsi1, dar, tr, dv;
//----
   if(Bars<=StartBar)
      return(0);
//----      
   counted=IndicatorCounted();
   if(counted < 1)
      for(i=Bars - StartBar; i < Bars; i++)
        {
         TrLevelSlow[i]=0.0;
         AtrRsi[i]=0.0;
         MaAtrRsi[i]=0.0;
         Rsi[i]=0.0;
         RsiMa[i]=0.0;
        }
   counted=Bars - counted - 1;
//----
   for(i=counted; i>=0; i--)
      Rsi[i]=iRSI(NULL, 0, RSI_Period, PRICE_CLOSE, i);
   for(i=counted; i>=0; i--)
     {
      RsiMa[i]=iMAOnArray(Rsi, 0, SF, 0, MODE_EMA, i);
      AtrRsi[i]=MathAbs(RsiMa[i + 1] - RsiMa[i]);
     }
   for(i=counted; i>=0; i--)
      MaAtrRsi[i]=iMAOnArray(AtrRsi, 0, Wilders_Period, 0, MODE_EMA, i);
//----
   i=counted + 1;
   tr=TrLevelSlow[i];
   rsi1=iMAOnArray(Rsi, 0, SF, 0, MODE_EMA, i);
   while(i > 0)
     {
      i--;
      rsi0=iMAOnArray(Rsi, 0, SF, 0, MODE_EMA, i);
      dar=iMAOnArray(MaAtrRsi, 0, Wilders_Period, 0, MODE_EMA, i) * 4.236;
      dv=tr;
      if (rsi0 < tr)
        {
         tr=rsi0 + dar;
         if (rsi1 < dv)
            if (tr > dv)
               tr=dv;
        }
      else if (rsi0 > tr)
           {
            tr=rsi0 - dar;
            if (rsi1 > dv)
               if (tr < dv)
                  tr=dv;
           }
      TrLevelSlow[i]=tr;
      rsi1=rsi0;
     }
   int d=AlertDelay;
   if ((RsiMa[i+1+d]<AlertLevel && RsiMa[i+d]>AlertLevel) ||(RsiMa[i+1+d]>AlertLevel && RsiMa[i+d]<AlertLevel) )
     {
      string base="QQE: "+Symbol()+ ", TF: " + TF2Str(Period());
      string Subj=base + ", " + AlertLevel + " level Cross Up";
      if (RsiMa[i+1+d]>AlertLevel && RsiMa[i+d]<AlertLevel) Subj=base + " " +  AlertLevel + " level Cross Down";
      string Msg=Subj + " @ " + TimeToStr(TimeLocal(),TIME_SECONDS);
      if (Bars>LastAlertBar)
        {
         LastAlertBar=Bars;
         DoAlerts(Msg,Subj);
        }
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void DoAlerts(string msgText,string eMailSub)
  {
   if (MsgAlerts) Alert(msgText);
   if (SoundAlerts)  PlaySound(SoundAlertFile);
   if (eMailAlerts) SendMail(eMailSub, msgText);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
string TF2Str(int period)
  {
   switch(period)
     {
      case PERIOD_M1: return("M1");
      case PERIOD_M5: return("M5");
      case PERIOD_M15: return("M15");
      case PERIOD_M30: return("M30");
      case PERIOD_H1: return("H1");
      case PERIOD_H4: return("H4");
      case PERIOD_D1: return("D1");
      case PERIOD_W1: return("W1");
      case PERIOD_MN1: return("MN");
     }
   return(Period());
  }
//+------------------------------------------------------------------+

Comments