XO_Alert
Download scriptThis script is designed to function as an automated monitoring tool for MetaTrader, specifically aimed at identifying precise entry points by analyzing multiple timeframes simultaneously. Instead of looking at a single chart in isolation, the logic leverages a multi-timeframe approach to ensure that a trade signal is synchronized across different speeds of market movement.
Core Logic Overview
The script operates by pulling data from a specialized external indicator (ZZ MTF XO A) across four distinct timeframes: 1-minute (5m), 15-minute, 30-minute, and 1-hour. By examining these different "speeds" of the market at once, the tool seeks to confirm that the overall trend and immediate momentum are moving in the same direction.
How the Signals Work
The script monitors two specific types of signals: Long (Buy) and Short (Sell). For a signal to be triggered, it looks for a very specific "coincidence" between the current market state and the previous state:
- Green Signal (Long/Buy): The system checks if the current data points for all four timeframes are active (non-zero). Simultaneously, it verifies that at least one of those same timeframes showed no signal in the immediately preceding period. This acts as a "trigger" or "breakout" logic, identifying the exact moment the market shifts into an active buying state across multiple scales.
- Red Signal (Short/Sell): The logic mirrors the green signal but focuses on the red data points. It looks for the moment where all four timeframes transition into an active selling state from a previously neutral or inactive state.
Key Features
- Multi-Timeframe Synchronization: By requiring confirmation from the 5m, 15m, 30m, and 60m periods, the script helps filter out "noise" that might appear on a single small timeframe but isn't supported by the larger trend.
- Real-Time Alerts: Once the specific conditions are met (the transition from inactive to active across all monitored timeframes), the script instantly generates an on-screen alert with the current symbol, timeframe, and the latest market price.
- Single-Trigger Protection: The script includes a mechanism to ensure that once an alert is triggered for a specific candle, it does not repeat the same alert immediately, ensuring you are notified of new movements rather than being bombarded with notifications on the same bar.
//+------------------------------------------------------------------+
//| XO_EA_FTP.mq4 |
//| Kalenzo |
//| bartlomiej.gorski@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link "bartlomiej.gorski@gmail.com"
#property indicator_chart_window
int mode;
extern int barToCheck = 1;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
double xo60g = iCustom(Symbol(),0,"ZZ MTF XO A",60,5,0,barToCheck);//green 60
double xo60r = iCustom(Symbol(),0,"ZZ MTF XO A",60,5,1,barToCheck);//red 60
double xo30g = iCustom(Symbol(),0,"ZZ MTF XO A",30,5,0,barToCheck);//green 30
double xo30r = iCustom(Symbol(),0,"ZZ MTF XO A",30,5,1,barToCheck);//red 30
double xo15g = iCustom(Symbol(),0,"ZZ MTF XO A",15,5,0,barToCheck);//green 15
double xo15r = iCustom(Symbol(),0,"ZZ MTF XO A",15,5,1,barToCheck);//red 15
double xo5g = iCustom(Symbol(),0,"ZZ MTF XO A",0,7,0,barToCheck);//green 5
double xo5r = iCustom(Symbol(),0,"ZZ MTF XO A",0,7,1,barToCheck);//red 5
double pxo60g = iCustom(Symbol(),0,"ZZ MTF XO A",60,5,0,barToCheck+1);//green 60
double pxo60r = iCustom(Symbol(),0,"ZZ MTF XO A",60,5,1,barToCheck+1);//red 60
double pxo30g = iCustom(Symbol(),0,"ZZ MTF XO A",30,5,0,barToCheck+1);//green 30
double pxo30r = iCustom(Symbol(),0,"ZZ MTF XO A",30,5,1,barToCheck+1);//red 30
double pxo15g = iCustom(Symbol(),0,"ZZ MTF XO A",15,5,0,barToCheck+1);//green 15
double pxo15r = iCustom(Symbol(),0,"ZZ MTF XO A",15,5,1,barToCheck+1);//red 15
double pxo5g = iCustom(Symbol(),0,"ZZ MTF XO A",0,7,0,barToCheck+1);//green 5
double pxo5r = iCustom(Symbol(),0,"ZZ MTF XO A",0,7,1,barToCheck+1);//red 5
//green open signal
if(Bars>mode && xo60g != 0 && xo30g != 0 && xo15g != 0 && xo5g != 0 && (pxo60g == 0 || pxo30g == 0 || pxo15g == 0 || pxo5g == 0) )
{
Alert(Symbol()+" "+Period()+" XO Long ",Bid);
mode = Bars;
}//red open signal
else if(Bars>mode && xo60r != 0 && xo30r != 0 && xo15r != 0 && xo5r != 0 && (pxo60r == 0 || pxo30r == 0 || pxo15r == 0 || pxo5r == 0) )
{
Alert(Symbol()+" "+Period()+" XO Short ",Bid);
mode = Bars;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments