wlxBWWiseMan-1
Download scriptThe BW-wiseMan-1 is a technical analysis tool designed to identify specific price action patterns on a trading chart. It functions by scanning historical price data and comparing it against a set of predefined conditions involving trend indicators, price averages, and momentum checks.
How the Logic Works
The script operates by constantly monitoring the relationship between the current market price and three distinct "Alligator" moving average lines. These lines act as a boundary for the market's trend. To generate a signal, the tool looks for moments where the price breaks out of these boundaries in a very specific way.
Identification of Bullish Signals (Upward Trend)
The tool searches for a potential upward move when all of the following conditions are met simultaneously:
- Boundary Breakout: The lowest price of the current candle must be higher than all three components of the Alligator indicator (Lips, Teeth, and Jaw). This suggests the price is moving significantly above the established trend.
- Price Position: The closing price of the candle must be situated in the lower half of its total range (the distance between its high and low points).
- Momentum Confirmation: The tool then looks back at a specific number of previous candles (defined by the "back" setting). It confirms the signal only if the current candle's high is strictly greater than the highs of those previous candles, ensuring that the move has actual upward momentum and isn't just a temporary fluctuation.
- Visual Output: If all these conditions are satisfied, a Yellow arrow appears above the candle.
Identification of Bearish Signals (Downward Trend)
Conversely, the tool identifies potential downward moves by looking for these conditions:
- Boundary Breakout: The highest price of the current candle must be lower than all three components of the Alligator indicator. This indicates the price is dropping significantly below the trend boundaries.
- Price Position: The closing price of the candle must be situated in the upper half of its total range.
- Momentum Confirmation: Similar to the bullish logic, the tool checks back through previous candles. It validates the signal only if the current candle's low is strictly lower than the lows of those previous candles, confirming a downward "break" in price action.
- Visual Output: If these conditions are met, an OrangeRed arrow appears below the candle.
User Customization
The tool allows for two primary adjustments to fine-tune how it interacts with your chart:
- Updown Offset: This controls the visual distance of the arrows from the candles, ensuring they do not overlap with other price labels or markers on your screen.
- Back Analysis: This determines how many previous candles the script must "look back" at to confirm that the current price movement is genuinely stronger than what came before it.
//+------------------------------------------------------------------+
//| BW-wiseMan-1.mq4 |
//| Copyright © 2005, wellx |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, wellx"
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Yellow
#property indicator_color2 OrangeRed
extern int updown=5; //ñìåùåíèå èíäèêàòîðà ÷òîáû íå íàëåçàëíà äðóãèå çíà÷êè
extern int back=2; // êîë-âî áàðîâ äëÿ àíàëèçà íàçàä
//---- buffers
double BWWM1Up[];
double BWWM1Down[];
int pos=0;
int i=0;
bool contup=true,contdown=true;
//+-----------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,140);
SetIndexBuffer(0,BWWM1Up);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,140);
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);
}
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;
}
}
if (contdown) BWWM1Down[pos]=(Low[pos]-updown*Point);
}
pos--;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments