Alert For ZZ SuperTrend's_v1
Download scriptThis script is designed to act as a multi-timeframe monitoring system that identifies strong trend shifts by analyzing several different time horizons simultaneously. Instead of relying on a single price chart, it synchronizes data from four specific intervals: 5 minutes, 15 minutes, 30 minutes, and 60 minutes.
Core Logic and Functionality
Multi-Timeframe Synchronization The tool works by pulling information from four separate "SuperTrend" indicators across different timeframes. By checking all four at once, the script ensures that a signal is only valid when there is a consensus across the market's short, medium, and long-term trends.
Trend Detection Mechanics The logic focuses on identifying moments of "confluence." It looks for specific conditions where:
- The current price action across all four timeframes has moved into a bullish (Up) or bearish (Down) state.
- At least one of those timeframes has just transitioned from the opposite direction in the previous candle.
Essentially, it waits for the moment when all four timeframes "agree" on a direction, specifically catching the point where they are aligning into a unified movement.
Alerting System To ensure the user doesn't miss these high-probability shifts, the script features an automated notification system:
- Visual/Audio Alerts: When the conditions for a synchronized move are met, the system triggers a specific sound file and generates a pop-up alert on the trading platform.
- Signal Filtering: The script includes a "cooldown" logic (a status flag). This prevents the system from sending repeated alerts for the same price movement, ensuring you only get notified at the start of a new trend shift rather than being bombarded with notifications every second.
Summary for the User
Think of this tool as a "Trend Validator." It filters out the noise of individual timeframes. Instead of reacting to a small 5-minute jump that might be meaningless, it waits until the 5, 15, 30, and 60-minute trends are all moving in harmony. When they do, it alerts you immediately, signaling a potential high-momentum move in the market.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| Alert For ZZ SuperTrend's.mq4 |
//| Copyright © 2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
extern string SoundName = "email.wav";
extern int ShowDays = 100;
int AlertIsAGo = 10;
double prevtime = 0, top = 8500000000, bot = 7700;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int ShowBars = ((1440/Period())*ShowDays);
if (ShowBars >= Bars) ShowBars = Bars - 50;
//---- indicator calculation
for(int i=ShowBars; i>=0; i--)
{
if (prevtime != Time[0])
{ RefreshRates(); prevtime = Time[0]; AlertIsAGo = 0;
}
double AlwaysLookingUp = 0, AlwaysLookingDn = 0;
double first2 = iCustom(Symbol(),0,"ZZ MTF Super_Trend 5 MIN", 1,i);
double secon2 = iCustom(Symbol(),0,"ZZ MTF Super_Trend 15 MIN",1,i);
double third2 = iCustom(Symbol(),0,"ZZ MTF Super_Trend 30 MIN",1,i);
double fourt2 = iCustom(Symbol(),0,"ZZ MTF Super_Trend 60 MIN",1,i);
double first21 = iCustom(Symbol(),0,"ZZ MTF Super_Trend 5 MIN", 1,i+1);
double secon21 = iCustom(Symbol(),0,"ZZ MTF Super_Trend 15 MIN",1,i+1);
double third21 = iCustom(Symbol(),0,"ZZ MTF Super_Trend 30 MIN",1,i+1);
double fourt21 = iCustom(Symbol(),0,"ZZ MTF Super_Trend 60 MIN",1,i+1);
if (first2 > top && secon2 > top && third2 > top && fourt2 > top && fourt21 < top) AlwaysLookingUp = 10;
if (first2 > top && secon2 > top && third2 > top && third21 < top && fourt2 > top) AlwaysLookingUp = 10;
if (first2 > top && secon2 > top && secon21 < top && third2 > top && fourt2 > top) AlwaysLookingUp = 10;
if (first2 > top && first21 < top && secon2 > top && fourt2 > top && fourt2 > top) AlwaysLookingUp = 10;
if (first2 < bot && secon2 < bot && third2 < bot && fourt2 < bot && fourt21 > bot) AlwaysLookingDn = 10;
if (first2 < bot && secon2 < bot && third2 < bot && third21 > bot && fourt2 < bot) AlwaysLookingDn = 10;
if (first2 < bot && secon2 < bot && secon21 > bot && third2 < bot && fourt2 < bot) AlwaysLookingDn = 10;
if (first2 < bot && first21 > bot && secon2 < bot && fourt2 < bot && fourt2 < bot) AlwaysLookingDn = 10;
}
if ( (AlertIsAGo <= 0) && (AlwaysLookingUp > 0) )
{ PlaySound(SoundName); AlertIsAGo = 10;
Alert(" Up Up Up Up ",Symbol());
}
if ( (AlertIsAGo <= 0) && (AlwaysLookingDn > 0) )
{ PlaySound(SoundName); AlertIsAGo = 10;
Alert(" Dn Dn Dn Dn ",Symbol());
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments