BW-wiseMan-1 Alert_001
Download scriptThis script is designed as a technical analysis tool for the MetaTrader trading platform. Its primary purpose is to identify specific moments in market momentum where price action interacts with a complex moving average trend system, signaling potential buying or selling opportunities.
Core Logic Overview
The tool functions by scanning historical and real-time price data to detect "breakout" behaviors. It compares the current price movement against three distinct layers of a moving average indicator (commonly known as an Alligator). These three layers represent different speeds of market trends: the "Lips," "Teeth," and "Jaw."
How it Identifies Signals
The script looks for two specific types of market conditions:
1. Bullish Signals (Potential Upside) For the tool to trigger a visual signal upward, four specific conditions must be met simultaneously:
- Price Position: The lowest price of the current candle must be higher than all three trend layers (Lips, Teeth, and Jaw). This indicates that the price has broken out above the established "ceiling" of the trend.
- Candle Structure: The closing price must be in the lower half of the candle's total range.
- Momentum Confirmation: The script performs a look-back analysis on previous candles. It ensures that the current high is higher than the highs of the preceding candles (based on a user-defined number of bars). This confirms that the price is actively moving upward rather than just fluctuating sideways.
2. Bearish Signals (Potential Downside) Conversely, for a downward signal, the following conditions are required:
- Price Position: The highest price of the current candle must be lower than all three trend layers. This suggests the price has broken below the "floor" of the trend.
- Candle Structure: The closing price must be in the upper half of the candle's total range.
- Momentum Confirmation: Similar to the bullish logic, the script checks previous bars to ensure the current low is lower than the lows of the preceding candles, confirming a consistent downward push.
Visual and Audio Alerts
When the logic confirms one of these two scenarios, the script performs three actions:
- Visual Markers: It places a gold arrow on the chart at a specific distance above or below the candle to highlight the entry point.
- Audio Notifications: It triggers a system sound alert to notify the trader immediately in real-time.
- Dynamic Filtering: The user can adjust how many past candles the script inspects to "verify" the momentum, allowing for more conservative or aggressive signal filtering depending on their trading style.
//+------------------------------------------------------------------+
//| BW-wiseMan-1 Alert.mq4 |
//| Copyright © 2008, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Gold
#property indicator_color2 Gold
extern int updown=5; //ñìåùåíèå èíäèêàòîðà ÷òîáû íå íàëåçàëíà äðóãèå çíà÷êè
extern int back=2; // êîë-âî áàðîâ äëÿ àíàëèçà íàçàä
//---- buffers
double BWWM1Up[];
double BWWM1Down[];
extern bool SoundON=false;
int pos=0;
int i=0;
bool contup=true,contdown=true;
//+-----------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,232);
SetIndexBuffer(0,BWWM1Up);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,232);
SetIndexBuffer(1,BWWM1Down);
SetIndexEmptyValue(1,0.0);
IndicatorDigits(6);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int cbars=IndicatorCounted();
if (cbars<0) return(-1);
if (cbars>0) cbars--;
//---- TODO: add your code here
//if (cbars == 0) return(0);
pos=cbars;
while (pos > 0)
{
BWWM1Up[pos]=NULL;
BWWM1Down[pos]=NULL;
if (
(Low[pos]> iAlligator(NULL,0,13,8,8,5,5,3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORLIPS, pos))
&&
(Low[pos]> iAlligator(NULL,0,13,8,8,5,5,3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORTEETH, pos))
&&
(Low[pos]> iAlligator(NULL,0,13,8,8,5,5,3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORJAW, pos))
&&
(Close[pos]<((High[pos]+Low[pos])/2))
)
{
contup=true;
for(i=1; i <= back ;i++)
{
if (High[pos]<=High[pos+i])
{
contup=false;
break;
}
}
if (contup) BWWM1Up[pos]=(High[pos]+updown*Point);
PlaySound("Alert.wav");
}
if (
(High[pos]< iAlligator(NULL,0,13,8,8,5,5,3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORLIPS, pos))
&&
(High[pos]< iAlligator(NULL,0,13,8,8,5,5,3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORTEETH, pos))
&&
(High[pos]< iAlligator(NULL,0,13,8,8,5,5,3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORJAW, pos))
&&
(Close[pos]>((High[pos]+Low[pos])/2))
)
{
contdown=true;
for(i=1; i <= back ;i++)
{
if (Low[pos]>=Low[pos+i])
{
contdown=false;
break;
PlaySound("Alert.wav");
}
}
if (contdown) BWWM1Down[pos]=(Low[pos]-updown*Point);
PlaySound("Alert.wav");
}
pos--;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments