fq_head_fake

Download script
Author: FX Quick Route, �2014
fq_head_fake

The FQ - Head Fake script is a specialized technical analysis tool designed to identify specific price action patterns that suggest a "fakeout"—a situation where the market makes a move in one direction only to reverse quickly. The logic behind this script focuses on detecting moments of exhaustion or deceptive movement to help traders spot potential reversal opportunities.

Core Logic and Detection Mechanism

The script scans historical price data (up to a user-defined number of past candles) to identify two specific types of "Head Fake" signals:

1. Bullish Head Fake (Potential Sell Signal) The tool looks for a specific sequence where the market creates a deceptive upward move. It identifies this by checking:

  • A recent increase in the closing price.
  • A previous downward trend in the lows.
  • Crucially, it detects if the "wick" or the distance between the highest point and the closing price is significantly larger than it was on the previous candle. Essentially, it looks for a sharp push upward that fails to sustain its momentum, signaling that buyers may be exhausted and a downward move could follow.

2. Bearish Head Fake (Potential Buy Signal) Conversely, the script looks for deceptive downward moves. It identifies these by checking:

  • A recent decrease in the closing price.
  • A previous upward trend in the highs.
  • It monitors if the "wick" or distance between the closing price and the lowest point is significantly larger than on the preceding candle. This suggests that while the price dropped sharply, it failed to find new buyers at those levels, potentially indicating a rebound to the upside.

Visual and Notification System

To ensure these signals are actionable for the user, the script provides several layers of feedback:

  • On-Chart Markers: The script places visual arrows directly on your trading chart. Green markers highlight potential Bullish Head Fakes, while Red markers indicate Bearish Head Fakes.
  • Dynamic Offsets: To ensure the arrows do not overlap with the candles, the script automatically calculates a small visual gap based on current market volatility (ATR).
  • Real-Time Alerts: When a new signal is detected, the script can be configured to notify you instantly via three different channels:
    • Pop-up Alerts: Standard windows within the trading platform.
    • Email Notifications: Direct messages sent to your registered email.
    • Push Notifications: Mobile alerts sent directly to your device.
  • On-Screen Commentary: The script provides a text summary on the chart, clearly stating the type of signal detected and the specific price level at which it occurred.

Summary for the User

Rather than just following general trends, this tool acts as a "warning system." It filters through the noise of the market to find specific price geometries where the "head" of a move appears stronger than the actual closing strength, providing traders with a data-driven way to spot potential trend reversals.

Indicators Used
Indicator of the average true range
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
4 Views
0 Downloads
0 Favorites
fq_head_fake
//+------------------------------------------------------------------+
//|                                                   FQ - Head Fake |
//|                                     Copyright 2014, fxquickroute |
//|                                      http://www.fxquickroute.com |
//+------------------------------------------------------------------+
#property copyright     "FX Quick Route, ©2014"
#property link          "www.fxquickroute.com"
#property description   "FQ - Head Fake"
#property version       "1.00"
#property strict
//+----------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1  clrGreen
#property indicator_color2  clrRed
#property indicator_width1  0
#property indicator_width2  0
//+----------------------+
input string    Name                = "FQ Head Fake";
input string    Author              = "www.fxquickroute.com";
input int       BarsToAnalyze       = 1000;
input bool      AlertOn             = True;
input bool      AlertEmail          = True;
input bool      PushNotification    = True;
//+----------------------+
double   bull_head[];
double   bear_head[];
datetime last_time;         
bool     first_alert_off;  
bool     signal_on;  
string   position;       
//+----------------------+
int OnInit(void)
   {
      Reset();
      SetIndexBuffer(0,bear_head); 
      SetIndexStyle(0,DRAW_ARROW); 
      SetIndexArrow(0,233);
      SetIndexLabel(0,"Bear HeadFake");
      SetIndexBuffer(1,bull_head); 
      SetIndexStyle(1,DRAW_ARROW); 
      SetIndexArrow(1,234);
      SetIndexLabel(1,"Bull HeadFake");
      return(INIT_SUCCEEDED);
   }
//+----------------------+
void Reset()
   {
      last_time         = 0;
      first_alert_off   = true;  
      signal_on         = false;
      position          = "";       
   }
//+----------------------+
void OnDeinit(const int reason)
   {
      if(reason==1)Alert(AuthorComment());
   }
//+----------------------+
int OnCalculate
(
   const int        rates_total,
   const int        prev_calculated,
   const datetime   &time[],
   const double     &open[],
   const double     &high[],
   const double     &low[],
   const double     &close[],
   const long       &tick_volume[],
   const long       &volume[],
   const int        &spread[]
)
{
//+----------------------+  
   if(prev_calculated==0){ArrayInitialize(bear_head, EMPTY_VALUE);ArrayInitialize(bull_head, EMPTY_VALUE);}
   int limit=rates_total-prev_calculated;  
   if (rates_total<3) return(0); 

   Comment(AuthorComment());

   //Loop   
   for(int shift=limit; shift >= 1 && !IsStopped() ; shift--)
   {
      //Ignore Bars
      if(shift<=BarsToAnalyze)
      {
         //Drawing Offset
         double offset = iATR(NULL,0,1,shift)/5;
         
         if (Close[shift]>Close[shift+1] && Low[shift+1]>Low[shift+2] && (High[shift]-Close[shift])>(High[shift+1]-Close[shift+1])) 
         {
         bull_head[shift] = High[shift]+offset;
         signal_on = true;
         position  = "Bull Head Fake Signal, Possible Sell @"+DoubleToStr(Close[shift],Digits);
         }
         
         else if (Close[shift]<Close[shift+1] && High[shift+1]<High[shift+2] && (Close[shift]-Low[shift])>(Close[shift+1]-Low[shift+1]))
         {
         bear_head[shift] = Low[shift]-offset;
         signal_on = true;
         position  = "Bear Head Fake Signal, Possible Buy @"+DoubleToStr(Close[shift],Digits);
         } 
         
         else
         { 
         bull_head[shift] = EMPTY_VALUE;
         bear_head[shift] = EMPTY_VALUE;
         signal_on = false;
         }  
           
      }
   }//END LOOP 
   //ALERTS
   if (last_time != Time[0]) 
      {  
            if (signal_on && first_alert_off == FALSE) 
               {       
                  if (AlertOn)         Alert             ("FQ - Head Fake: " + Symbol() +" "+ position ); 
                  if (AlertEmail)      SendMail          ("FQ - Head Fake",    Symbol() +" "+ position );      
                  if (PushNotification)SendNotification  ("FQ - Head Fake: " + Symbol() +" "+ position );
                  
                  Comment("FQ - Head Fake: " + Symbol() +" "+ position );   
               }   
         last_time=Time[0];
         first_alert_off=FALSE;     
      }     
//+----------------------+     
return(rates_total);
}
//+----------------------+ 
string AuthorComment()
   {
      return("© www.fxquickroute.com");
   }
//+----------------------+ 

Comments