ADX_Filter_sBar_mtf
Download scriptThe ADX Filter SideBar is a specialized technical analysis tool designed to help traders visualize market momentum and trend direction through a multi-layered filtering system. Instead of just providing raw numbers, this script translates complex market data into clear visual cues on your chart, allowing you to identify high-probability trading zones at a glance.
Core Functionality
The logic of the script revolves around three primary analytical pillars: Momentum Strength, Trend Direction, and Multi-Timeframe Awareness.
1. Momentum & Trend Dynamics
The tool utilizes the ADX (Average Directional Index) to determine if the market is currently moving with strength or remains in aSideways "choppy" state. It breaks this down into three distinct visual signals:
- Trend Strength: The script monitors whether the ADX value is increasing or decreasing. If the momentum is gaining strength, it highlights an upward trend; if it is losing steam, it signals a downward shift.
- Volatility Filtering: By comparing the current ADX against a user-defined "Level," the tool can identify periods of low activity. This helps traders avoid "fakeouts" by highlighting when the market lacks the necessary energy to sustain a significant move.
- Directional Bias: It further separates the movement into Positive (Up) and Negative (Down) components, helping you see which direction the current pressure is leaning toward.
2. Multi-Timeframe Integration
One of the most sophisticated aspects of this script is its ability to look "beyond" the current chart. While you may be trading on a small timeframe (like 5 minutes), the script can pull data from higher timeframes (such as Hourly or Daily). This allows you to see the "Big Picture"—ensuring that your short-term trades are aligned with the broader market trend.
3. Visual Communication
The logic is designed to minimize "analysis paralysis." Rather than forcing you to interpret multiple overlapping lines, the script uses a coordinate-based system to plot specific markers (Arrows and Dots) on your sidebar. These markers act as a shorthand:
- Positioning: The indicators are placed at specific "bar positions" so they remain organized and easy to read as the price moves.
- Customizable Styles: You can choose between lines or dots depending on your preference for visual clarity, ensuring the tool fits your specific trading layout.
How it helps your trading
By combining these elements, the ADX Filter SideBar acts as a secondary confirmation layer. It tells you:
- Is the market moving? (Strength)
- In which direction is it moving? (Bias)
- Is the move supported by the higher timeframes? (Context)
This allows for a more disciplined approach to entering and exiting trades, filtering out weak signals and helping you stay on the right side of the market trend.
//+------------------------------------------------------------------+
//| ADX Filter SideBar based on SAR Color Bar.mq4|
//+------------------------------------------------------------------+
//2008fxtsd ki
#property copyright "Kalenzo Code adapted by cja"
#property link "http://www.foreksik.prv.pl"
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Yellow
#property indicator_color4 Lime
#property indicator_color5 Orchid
#property indicator_width1 3
#property indicator_width2 3
#property indicator_width3 3
#property indicator_width4 4
#property indicator_width5 4
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_maximum 77
#property indicator_minimum 1
double ADX_buff[],ADX_Up[],ADX_Dn[],PADX_buff[],NADX_buff[];//buffers
extern int TimeFrame = 0;
extern int ADX_Period = 14;
extern int ADX_Level = 20;
extern int sBarLevel = 5;
extern bool _ADXstyleLine = false;
extern bool pADXstyleLine = false;
extern bool nADXstyleLine = true;
extern int MaxBarsToCount = 1500;
extern string note_sBarLevel = "sBarLevel:1-77(bar position)";
extern string note_ADXstyle = " ADXstyle: Line/Dot";
extern string note_TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN";
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexBuffer(0,PADX_buff);
SetIndexStyle (0,DRAW_ARROW);
SetIndexArrow (0,167);//110
SetIndexEmptyValue (0,EMPTY_VALUE);
SetIndexBuffer(1,NADX_buff);
SetIndexStyle (1,DRAW_ARROW);
SetIndexArrow (1,167);
SetIndexEmptyValue (1,EMPTY_VALUE);
if (_ADXstyleLine) SetIndexStyle(2,DRAW_LINE);
else {SetIndexStyle (2,DRAW_ARROW);
SetIndexArrow (2,158);
SetIndexEmptyValue (2,EMPTY_VALUE);}
SetIndexBuffer(2,ADX_buff);
if (pADXstyleLine) SetIndexStyle(3,DRAW_LINE);
else { SetIndexStyle (3,DRAW_ARROW);
SetIndexArrow (3,158);
SetIndexEmptyValue (3,EMPTY_VALUE);}
SetIndexBuffer(3,ADX_Up);
if (nADXstyleLine) SetIndexStyle(4,DRAW_LINE);
else {SetIndexStyle (4,DRAW_ARROW);
SetIndexArrow (4,158);
SetIndexEmptyValue (4,EMPTY_VALUE);}
SetIndexBuffer(4,ADX_Dn);
switch(TimeFrame)
{
case 1 : string TimeFrameStr="M1"; break;
case 5 : TimeFrameStr="M5"; break;
case 15 : TimeFrameStr="M15"; break;
case 30 : TimeFrameStr="M30"; break;
case 60 : TimeFrameStr="H1"; break;
case 240 : TimeFrameStr="H4"; break;
case 1440 : TimeFrameStr="D1"; break;
case 10080 : TimeFrameStr="W1"; break;
case 43200 : TimeFrameStr="MN"; break;
default : TimeFrameStr="TF0";
}
TimeFrame = MathMax(TimeFrame, Period());
IndicatorShortName("ADX("+ADX_Period+")Filter sBar["+TimeFrameStr+"]");
SetIndexLabel(0,"posDI ["+TimeFrame+"]Up");
SetIndexLabel(1,"negDI ["+TimeFrame+"]Down");
SetIndexLabel(2,"ADX ["+TimeFrame+"] Level < "+ADX_Level+"");
SetIndexLabel(3,"ADX ["+TimeFrame+"] Up");
SetIndexLabel(4,"ADX ["+TimeFrame+"] Down");
SetIndexDrawBegin(0,2);
SetIndexDrawBegin(1,2);
SetIndexDrawBegin(2,2);
SetIndexDrawBegin(3,2);
SetIndexDrawBegin(4,2);
return(0);
}
//+---
int deinit()
{
return(0);
}
//+-------
int start()
{
int i,y,limit;
datetime TimeArray[];
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
limit = MathMax (limit,TimeFrame/Period());
limit = MathMin (limit,MaxBarsToCount);
for(i =0, y=0; i<limit; i++)
{
if (Time[i]<TimeArray[y]) y++;
double ADX =iADX(NULL,TimeFrame,ADX_Period,0,0,y);
double ADX1=iADX(NULL,TimeFrame,ADX_Period,0,0,y+1);
double PADX=iADX(NULL,TimeFrame,ADX_Period,0,1,y);
double NADX=iADX(NULL,TimeFrame,ADX_Period,0,2,y);
if(ADX >ADX1)
{
ADX_Up[i] = sBarLevel;
ADX_Dn[i] = EMPTY_VALUE;
}
else
{
ADX_Up[i] = EMPTY_VALUE;
ADX_Dn[i] = sBarLevel;
}
if(ADX < ADX_Level) ADX_buff[i]= sBarLevel+5;
if(PADX > NADX) PADX_buff[i]=sBarLevel+2;
if(PADX < NADX) NADX_buff[i]=sBarLevel+2;
}
return(0);
}
//+-------------------------------------------------------------
Comments