Six_Consecutive_SA

Download script
Author: Written by MagnumFreak
Six_Consecutive_SA

This tool is designed to help traders identify specific momentum patterns on a trading chart by monitoring the opening prices of consecutive candles. Its primary purpose is to detect "streaks"—specifically when the price moves in the same direction for six consecutive bars.

How the Logic Works

The script continuously scans the historical data on your chart, looking at the relationship between the current candle and the six preceding candles. It evaluates two specific conditions:

  • Downward Trends: If the opening price of each of the last six candles is consistently lower than the one before it, the tool identifies a sustained downward move.
  • Upward Trends: If the opening price of each of the last six candles is consistently higher than the one before it, the tool identifies a sustained upward move.

Visual and Audible Feedback

When the script detects one of these six-candle streaks, it provides immediate feedback in three ways:

  1. Visual Markers: The tool places distinct arrows directly on your chart to highlight exactly where the pattern occurred. These markers help you quickly spot historical trends at a glance.
  2. Instant Alerts: If enabled, the software will trigger an audible alert sound and a pop-up notification on your trading platform the moment a new six-candle streak is completed.
  3. Email Notifications: For traders who are away from their desks, the script can send an automated email. This notification informs you that a significant trend has formed in either direction, allowing you to react even if you aren't actively watching the screen.

Smart Notification Handling

To ensure you aren't overwhelmed with constant notifications, the logic includes a "memory" feature. It is designed to only send one alert or email per trend. Once the price movement breaks and a new pattern begins, the system resets itself, preparing to notify you of the next occurrence.

Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screenIt sends emails
7 Views
0 Downloads
0 Favorites
Six_Consecutive_SA
//+------------------------------------------------------------------+
//|                                              Six_Consecutive.mq4 |
//|                      Copyright © 2008, MagnumFreak               |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Written by MagnumFreak"
#property link      ""

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_width1 3
#property indicator_width2 3

extern bool Email_Enabled = true;
extern bool Alert_Enabled = true;
//---- buffers
double GoingUp[];
double GoingDown[];
bool AlertSent,EmailSent;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,217);
   SetIndexBuffer(0,GoingUp);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,218);
   SetIndexBuffer(1,GoingDown);
   SetIndexEmptyValue(1,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   for(int i = Bars; i>=0; i--)
      {
      if(Open[i] > Open[i+1] &&
         Open[i+1] > Open[i+2] &&
         Open[i+2]> Open[i+3] &&
         Open[i+3] > Open[i+4] &&
         Open[i+4] > Open[i+5] &&
         Open[i+5] > Open[i+6]) GoingDown[i] = High[i]+(7*Point);
      if(Open[i] < Open[i+1] &&
         Open[i+1] < Open[i+2] &&
         Open[i+2]< Open[i+3] &&
         Open[i+3] < Open[i+4] &&
         Open[i+4] < Open[i+5] &&
         Open[i+5] < Open[i+6]) GoingUp[i] = Low[i]-(7*Point);
      }
//----

   if (Alert_Enabled && (GoingDown[0] != 0 || GoingUp[0] !=0) && !AlertSent)
      {
      Alert(Symbol() + " 6 Consecutive Candles");
      AlertSent=true;
      }
   if (Email_Enabled && (GoingDown[0] != 0 || GoingUp[0] !=0) && !EmailSent)
      {
      SendMail(Symbol() + " 6 Consecutive Candles","Six Consecutive Candles Opened In the Same Direction");
      EmailSent=true;
      }
      
   if(GoingDown[0] == 0 && GoingUp[0] == 0 )
      {
      EmailSent=false;
      AlertSent=false;
      }
   return(0);
  }
//+------------------------------------------------------------------+

Comments