Beno_System
Download scriptThe Beno_System is a technical analysis tool designed for the MetaTrader platform to identify specific price action patterns and potential trend reversals. Rather than relying on standard lagging indicators, this script scans historical price data to pinpoint structural shifts in market behavior by analyzing relationships between highs, lows, opens, and closes over a defined period.
Core Logic and Signal Detection
The system operates by monitoring two primary scenarios: bullish (Upward) and bearish (Downward) momentum shifts. It looks for specific "structural" signatures that suggest the market is moving from one phase to another.
1. Bullish Momentum Identification (Up Signals) To identify a potential upward move, the script looks for a combination of three conditions:
- Sequential Highs: It detects a sequence where previous price peaks are progressively lower than one another (a descending "staircase" of highs).
- Price Recovery: It checks if the current closing price has moved significantly higher than it was ten bars ago.
- Breakout Confirmation: It confirms that the current peak is higher than the immediately preceding peak, suggesting a break in the downward trend.
When these conditions align, the system generates visual cues:
- Upward Arrows: Placed on the chart to highlight the entry point.
- Lower Highs Markers: Identifies the specific peaks that formed the descending pattern.
- Close-to-Close Lines: Draws horizontal reference lines connecting the closing prices of the current bar to those from ten bars ago, visually demonstrating the price recovery gap.
2. Bearish Momentum Identification (Down Signals) Conversely, for downward moves, the script monitors for:
- Sequential Lows: It identifies a sequence where previous price bottoms are progressively higher than one another (an ascending "staircase" of lows).
- Price Decline: It verifies that the current opening price is lower than it was ten bars ago.
- Breakdown Confirmation: It confirms that the current low has dropped below the immediately preceding low, suggesting a break in the upward trend.
When these conditions align, the system provides:
- Downward Arrows: Clearly marked on the chart to signal a potential sell opportunity.
- Higher Lows Markers: Highlights the specific bottoms that formed the ascending pattern.
- Open-to-Open Lines: Draws horizontal reference lines connecting the opening prices of the current bar to those from ten bars ago, illustrating the downward price shift.
Visual Interface and Customization
The script is designed to be highly customizable to suit different trading styles. Users can toggle the visibility of individual components—such as the arrows, the structural markers (Higher Lows/Lower Highs), or the trend lines—allowing for a clean chart that only displays the information most relevant to the trader's strategy. The colors are also distinct (typically Lime for bullish and Red for bearish) to ensure immediate visual recognition during live trading.
//+------------------------------------------------------------------+
//| Beno_System.mq4 |
//| Plamen |
//| http://127.0.0.1 |
//+------------------------------------------------------------------+
#property copyright "Plamen"
#property link "http://127.0.0.1"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Lime
#property indicator_color4 Red
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 2
#property indicator_width4 2
//---- options
extern string UpSignal="===== Up Signal Settings =====";
extern bool ShowUpArrows=true;
extern color UpArrowsColor=Lime;
extern bool ShowLowerHighs=true;
extern color LowerHighsColor=Lime;
extern bool ShowCloseToCloseLines=true;
extern color CloseToCloseLinesColor=Lime;
extern string EndUpSignalSettings="==============================";
extern string DownSignal="==== Down Signal Settings ====";
extern bool ShowDownArrows=true;
extern color DownArrowsColor=Red;
extern bool ShowHigherLows=true;
extern color HigherLowsColor=Red;
extern bool ShowOpenToOpenLines=true;
extern color OpenToOpenLinesColor=Red;
extern string EndDownSignalSettings="==============================";
//---- buffers
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];
int CloseToCloseLinesCounter=0;
int OpenToOpenLinesCounter=0;
int pos=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW, EMPTY, EMPTY, HigherLowsColor);
SetIndexArrow(0,217);
SetIndexBuffer(0,Buffer1);
SetIndexDrawBegin(0, 7);
SetIndexStyle(1,DRAW_ARROW, EMPTY, EMPTY, LowerHighsColor);
SetIndexArrow(1,218);
SetIndexBuffer(1,Buffer2);
SetIndexDrawBegin(1,7);
SetIndexStyle(2,DRAW_ARROW, EMPTY, EMPTY, UpArrowsColor);
SetIndexArrow(2,67);
SetIndexBuffer(2, Buffer3);
SetIndexDrawBegin(2,7);
SetIndexStyle(3,DRAW_ARROW, EMPTY, EMPTY, DownArrowsColor);
SetIndexArrow(3,68);
SetIndexBuffer(3,Buffer4);
SetIndexDrawBegin(3,7);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
int i;
for(i=0; i<=CloseToCloseLinesCounter; i++)
ObjectDelete("CloseToCloseLines"+i);
for(i=0; i<=OpenToOpenLinesCounter; i++)
ObjectDelete("OpentoOpenLines"+i);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
pos=Bars-counted_bars;
while(pos>0)
{
if( (High[pos+1]<High[pos+2])&&(High[pos+2]<High[pos+3]) &&
(Close[pos]>Close[pos+10]) &&
(High[pos]>High[pos+1]) )
{
if(ShowCloseToCloseLines) DisplayCloseToCloseLines();
if(ShowUpArrows) DisplayUpArrows();
if(ShowLowerHighs) DisplayLowerHighs();
}
if( (Low[pos+1]>Low[pos+2])&&(Low[pos+2]>Low[pos+3]) &&
(Open[pos]<Open[pos+10]) &&
(Low[pos]<Low[pos+1]) )
{
if(ShowOpenToOpenLines) DisplayOpenToOpenLines();
if(ShowDownArrows) DisplayDownArrows();
if(ShowHigherLows) DisplayHigherLows();
}
pos--;
}
return(0);
}
//+------------------------------------------------------------------+
void DisplayUpArrows()
{
if(Digits==2)
Buffer3[pos]=Low[pos]-0.30;
else if(Digits==4)
Buffer3[pos]=Low[pos]-0.0030;
}
//+------------------------------------------------------------------+
void DisplayDownArrows()
{
if(Digits==2)
Buffer4[pos]=High[pos]+0.30;
else if(Digits==4)
Buffer4[pos]=High[pos]+0.0030;
}
//+------------------------------------------------------------------+
void DisplayLowerHighs()
{
if(Digits==2)
{
Buffer2[pos+1]=High[pos+1]+0.10;
Buffer2[pos+2]=High[pos+2]+0.10;
Buffer2[pos+3]=High[pos+3]+0.10;
}
else
{
Buffer2[pos+1]=High[pos+1]+0.0010;
Buffer2[pos+2]=High[pos+2]+0.0010;
Buffer2[pos+3]=High[pos+3]+0.0010;
}
}
//+------------------------------------------------------------------+
void DisplayHigherLows()
{
if(Digits==2)
{
Buffer1[pos+1]=Low[pos+1]-0.10;
Buffer1[pos+2]=Low[pos+2]-0.10;
Buffer1[pos+3]=Low[pos+3]-0.10;
}
else
{
Buffer1[pos+1]=Low[pos+1]-0.0010;
Buffer1[pos+2]=Low[pos+2]-0.0010;
Buffer1[pos+3]=Low[pos+3]-0.0010;
}
}
//+------------------------------------------------------------------+
void DisplayCloseToCloseLines()
{
ObjectCreate("CloseToCloseLines"+CloseToCloseLinesCounter, OBJ_TREND, 0, Time[pos+10], Close[pos+10], Time[pos], Close[pos+10]);
ObjectSet("CloseToCloseLines"+CloseToCloseLinesCounter, OBJPROP_COLOR, CloseToCloseLinesColor);
ObjectSet("CloseToCloseLines"+CloseToCloseLinesCounter, OBJPROP_RAY, false);
CloseToCloseLinesCounter++;
ObjectCreate("CloseToCloseLines"+CloseToCloseLinesCounter, OBJ_TREND, 0, Time[pos+10], Close[pos], Time[pos], Close[pos]);
ObjectSet("CloseToCloseLines"+CloseToCloseLinesCounter, OBJPROP_COLOR, CloseToCloseLinesColor);
ObjectSet("CloseToCloseLines"+CloseToCloseLinesCounter, OBJPROP_RAY, false);
CloseToCloseLinesCounter++;
ObjectCreate("CloseToCloseLines"+CloseToCloseLinesCounter, OBJ_TREND, 0, Time[pos+10], Close[pos+10], Time[pos+10], Close[pos]);
ObjectSet("CloseToCloseLines"+CloseToCloseLinesCounter, OBJPROP_COLOR, CloseToCloseLinesColor);
ObjectSet("CloseToCloseLines"+CloseToCloseLinesCounter, OBJPROP_RAY, false);
CloseToCloseLinesCounter++;
}
//+------------------------------------------------------------------+
void DisplayOpenToOpenLines()
{
ObjectCreate("OpenToOpenLines"+OpenToOpenLinesCounter, OBJ_TREND, 0, Time[pos+10], Open[pos+10], Time[pos], Open[pos+10]);
ObjectSet("OpenToOpenLines"+OpenToOpenLinesCounter, OBJPROP_COLOR, OpenToOpenLinesColor);
ObjectSet("OpenToOpenLines"+OpenToOpenLinesCounter, OBJPROP_RAY, false);
OpenToOpenLinesCounter++;
ObjectCreate("OpenToOpenLines"+OpenToOpenLinesCounter, OBJ_TREND, 0, Time[pos+10], Open[pos], Time[pos], Open[pos]);
ObjectSet("OpenToOpenLines"+OpenToOpenLinesCounter, OBJPROP_COLOR, OpenToOpenLinesColor);
ObjectSet("OpenToOpenLines"+OpenToOpenLinesCounter, OBJPROP_RAY, false);
OpenToOpenLinesCounter++;
ObjectCreate("OpenToOpenLines"+OpenToOpenLinesCounter, OBJ_TREND, 0, Time[pos+10], Open[pos+10], Time[pos+10], Open[pos]);
ObjectSet("OpenToOpenLines"+OpenToOpenLinesCounter, OBJPROP_COLOR, OpenToOpenLinesColor);
ObjectSet("OpenToOpenLines"+OpenToOpenLinesCounter, OBJPROP_RAY, false);
OpenToOpenLinesCounter++;
}
//+------------------------------------------------------------------+
Comments