Gann HiLo ActivatorV2_Alert_Email_v1.1_001

Author: Poul Trade Forum
Gann HiLo ActivatorV2_Alert_Email_v1.1_001

Overview of the HiLo Activator Logic

The HiLo Activator is a technical analysis tool designed to help traders visualize market trends and identify potential entry or exit points. It operates by calculating specific price boundaries based on historical highs and lows, then comparing these boundaries against moving averages to determine the current "sentiment" of the market.

Core Functional Mechanics

The logic of this script can be broken down into three main components:

1. Trend Identification (Highs and Lows) The tool analyzes two primary data points: the average of the highest prices and the average of the lowest prices over a specific look-back period. By observing where the current price sits in relation to these averages, the script identifies whether the market is currently in an "upward" or "downward" state.

2. Visual Representation (Dots vs. Lines) Users can choose how they want this information displayed on their trading chart:

  • Dots Mode: The script places distinct visual markers (dots) at the price levels where the trend is shifting. This is useful for traders who prefer to see specific "pivot" points.
  • Line Mode: Instead of individual dots, the script draws a continuous line following the trend. This provides a smoother visual flow of the market’s direction.

3. The "Activator" Filter (Moving Average Comparison) What makes this tool an "Activator" is its secondary layer of logic. It doesn't just track the high/low trend; it also calculates a standard Moving Average (MA) based on closing prices.

  • The script checks if the High/Low trend is interacting with this Moving Average.
  • If the trend confirms a specific position relative to the Moving Average, the tool identifies this as a significant market signal.

Notification System

To ensure traders do not miss these movements, the script includes an automated alert system. When the logic detects a crossover or a trend shift that meets its specific criteria, it can perform three actions simultaneously:

  • Visual Alert: A pop-up notification appears on the trading platform.
  • Audio Alert: An audible sound file is played to grab the trader's attention.
  • Email Notification: If configured, the script sends an automated email to the user, providing a summary of the trend change even if they are away from their computer.

Summary for the Trader

In essence, this tool filters out market noise by focusing on the relationship between price extremes (Highs/Lows) and the general trend (Moving Average). It tells you not just where the price is going, but when the momentum has shifted enough to warrant your attention.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1It plays sound alertsIt issuies visual alerts to the screenIt sends emails
8 Views
0 Downloads
0 Favorites
Gann HiLo ActivatorV2_Alert_Email_v1.1_001
//+------------------------------------------------------------------+
//|                                               HoLo Activator.mq4 |
//|                               Copyright © 2004, Poul_Trade_Forum |
//|                                                         Aborigen |
//|                                          http://forex.kbpauk.ru/ |
//+------------------------------------------------------------------+
// Modified Aug14,2007 Kenneth Hookham to provide solid line option

#property copyright "Poul Trade Forum"
#property link      "http://forex.kbpauk.ru/"
#property copyright "Gann + MA cross alert and email function added by Sadly at http://www.forex-tsd.com/"
#property copyright "Gann MA Mode input settings added by Sadly at http://www.forex-tsd.com/"
#property indicator_chart_window
#property indicator_buffers 3

#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Navy


//---- input parameters
extern int R=10; // default value for auslanco system
extern int Gann_MA_mode = MODE_SMA; // MODE_SMA 0 Simple moving average, MODE_EMA 1 Exponential moving average, MODE_SMMA 2 Smoothed moving average, MODE_LWMA 3 Linear weighted moving average. 
extern bool dots=true;
extern bool line=false;
extern bool Alert_On = false;
extern bool Email_on = false;
extern int  MA_Period = 5;
extern int  MA_method = MODE_SMA;



//---- buffers
double HighBuffer[];
double LowBuffer[];
double LineBuffer[];
double VALUE1,VALUE2,VALUE11,VALUE22;
double MA_Period_val;
int old_Swing;
string AlertMSG = "Gann HiLo Activator alert";
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   if(dots)
   {
   SetIndexStyle(0,DRAW_ARROW,EMPTY,1,Blue);
   SetIndexStyle(1,DRAW_ARROW,EMPTY,1,Red);
   
   SetIndexArrow(0, 0x9F);
   SetIndexArrow(1, 0x9F);

   SetIndexBuffer(0,HighBuffer);
   SetIndexBuffer(1,LowBuffer);

   SetIndexEmptyValue(0,0);
   SetIndexEmptyValue(1,0);
   }
   if(line)
   {
   SetIndexStyle(2,DRAW_LINE,EMPTY,2,Navy);
   SetIndexBuffer(2,LineBuffer);
   SetIndexEmptyValue(2,0);
   }   
//---- name for DataWindow and indicator subwindow label
   short_name="HiLoV2";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);

//----
   SetIndexDrawBegin(0,10);
//----

   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
 ObjectsDeleteAll(0);   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted(),i,shift,Swing;
   

//---- TODO: add your code here
i=(Bars-counted_bars)-1;

for (shift=i; shift>=0;shift--)
{


VALUE1=iMA(NULL,0,R,0,Gann_MA_mode,PRICE_HIGH,shift+1);
VALUE2=iMA(NULL,0,R,0,Gann_MA_mode,PRICE_LOW,shift+1);
MA_Period_val=iMA(NULL,0,MA_Period,0,MA_method,PRICE_CLOSE,shift+1);

if (Close[shift+1]<VALUE2 ) Swing=-1;
if (Close[shift+1]>VALUE1 ) Swing=1;
if(dots)
{
if (Swing==1) { 
   HighBuffer[shift]=VALUE2;
   LowBuffer[shift]=0;  
   if(VALUE1 > MA_Period_val){ 
      if(Alert_On && Swing != old_Swing){
         PlaySound("Alert.wav");
         Alert("HiLo dot below MA", MA_Period);
         old_Swing = Swing;
         if (Email_on) SendMail(AlertMSG,"Dot below MA"+MA_Period);
      }
   }  
}
if (Swing==-1) {
   LowBuffer[shift]=VALUE1;
   HighBuffer[shift]=0; 
   if(VALUE2 < MA_Period_val){ 
      if(Alert_On && Swing != old_Swing){ 
         PlaySound("Alert.wav");
         Alert("HiLo dot above MA", MA_Period);
         old_Swing = Swing;
         if (Email_on) SendMail(AlertMSG,"Dot above MA"+MA_Period);
      }
   }  
}

}

if(line)
{
if (Swing==1) { 
   LineBuffer[shift]=VALUE2;   
   if(VALUE1 > MA_Period_val){ 
      if(Alert_On && Swing != old_Swing){ 
         PlaySound("Alert.wav");
         Alert("HiLo line X below MA", MA_Period);
         old_Swing = Swing;
         if (Email_on) SendMail(AlertMSG,"Line below MA"+MA_Period);
         }
   }  
}


if (Swing==-1) { 
   LineBuffer[shift]=VALUE1;  
   if(VALUE2 < MA_Period_val){ 
      if(Alert_On && Swing != old_Swing){
         PlaySound("Alert.wav");
         Alert("HiLo line X above MA", MA_Period);
         old_Swing = Swing;
         if (Email_on) SendMail(AlertMSG,"Line above MA"+MA_Period);
         }
   }  
}
}


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

Comments