Waddah Attar Strong Level
Download scriptThis indicator is designed to provide traders with a multi-timeframe visual overview of market structure by identifying significant price levels across various periods. Instead of focusing on a single timeframe, it simultaneously analyzes the Day, 4-Hour (H4), Week, and Month charts to help users understand the broader "strong" trends at a glance.
Core Logic and Functionality
Multi-Timeframe Analysis The script automatically pulls data from four different timeframes: Daily, 4-Hour, Weekly, and Monthly. It processes this data regardless of which chart you are currently viewing, allowing you to see high-level market trends while trading on lower-level price action.
Dynamic Level Calculation For each of the requested timeframes, the script identifies a "strong level" based on historical price changes:
- It looks at the closing prices of recent completed candles.
- It calculates the difference (the range) between these prices.
- It then establishes a primary price point and projects a boundary above and below it based on that calculated range.
- If the market lacks movement (a zero difference), the logic automatically seeks out the next available data point to ensure a level is always established.
Visual Trend Identification To make the data easily readable, the script performs the following actions for each timeframe:
- Color Coding: Each timeframe is assigned a specific color (e.g., Red for Daily, Green for 4-Hour, Blue for Weekly, and Orange for Monthly) to help distinguish between different layers of market influence.
- Trend Labeling: The script automatically determines if the trend for that specific timeframe is "Up" or "Down." It then places a text label on your chart (e.g., "Day Up" or "Month Down") next to the corresponding price levels.
- Price Plotting: It draws horizontal markers at these calculated levels, providing clear visual boundaries for support and resistance across multiple time horizons.
User Customization
The script includes several toggle switches that allow you to customize your view:
- Visibility Toggles: You can choose to show or hide the Day, 4-Hour, Week, and Month levels independently depending on your trading style.
- Backtesting Mode: There is a specific setting to handle how historical data is displayed during non-live trading sessions to ensure the visual history remains consistent.
Summary for the Trader
In essence, this tool acts as a "multi-lens" telescope. It simplifies complex market data by distilling four different timeframes into a set of clearly labeled, color-coded price levels. By showing you where the Weekly or Monthly trends are sitting alongside your current Daily price action, it helps you identify whether the current move is supported by the broader market trend or if it is moving against the dominant direction.
//+------------------------------------------------------------------+
//| Waddah Attar Strong Level |
//| Copyright © 2007, www.metaforex.net |
//| Waddah Attar www.metaforex.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, www.metaforex.net"
#property link "www.metaforex.net"
//----
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Green
#property indicator_color3 Blue
#property indicator_color4 Red
#property indicator_color5 Green
#property indicator_color6 Blue
#property indicator_color7 Orange
#property indicator_color8 Orange
extern bool BackTest=false;
extern bool DrawMonth=true;
extern bool DrawWeek=true;
extern bool DrawDay=true;
extern bool DrawH4=false;
//---- buffers
double P1Buffer[];
double P2Buffer[];
double P3Buffer[];
double P4Buffer[];
double P5Buffer[];
double P6Buffer[];
double P7Buffer[];
double P8Buffer[];
//----
int levelPeriod1 = PERIOD_D1;
int levelPeriod2 = PERIOD_H4;
int levelPeriod3 = PERIOD_W1;
int levelPeriod4 = PERIOD_MN1;
bool FixSunday;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0, P1Buffer);
SetIndexBuffer(1, P2Buffer);
SetIndexBuffer(2, P3Buffer);
SetIndexBuffer(3, P4Buffer);
SetIndexBuffer(4, P5Buffer);
SetIndexBuffer(5, P6Buffer);
SetIndexBuffer(6, P7Buffer);
SetIndexBuffer(7, P8Buffer);
//----
SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 1);
SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 3);
SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, 2);
SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, 1);
SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, 3);
SetIndexStyle(6, DRAW_LINE, STYLE_SOLID, 4);
SetIndexStyle(7, DRAW_LINE, STYLE_SOLID, 4);
//----
Comment("Strong Level By eng.Waddah Attar www.metaforex.net");
FixSunday=false;
for(int i = 0; i <7; i++)
{
if (TimeDayOfWeek(iTime(Symbol(),PERIOD_D1,i))==0)
{
FixSunday=true;
}
}
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("level1");
ObjectDelete("txtlevel1");
ObjectDelete("level2");
ObjectDelete("txtlevel2");
ObjectDelete("level3");
ObjectDelete("txtlevel3");
ObjectDelete("level4");
ObjectDelete("txtlevel4");
ObjectDelete("level5");
ObjectDelete("txtlevel5");
ObjectDelete("level6");
ObjectDelete("txtlevel6");
ObjectDelete("level7");
ObjectDelete("txtlevel7");
ObjectDelete("level8");
ObjectDelete("txtlevel8");
//----
Comment("");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
if(DrawDay) DrawPeriod1();
if(DrawH4) DrawPeriod2();
if(DrawWeek) DrawPeriod3();
if(DrawMonth) DrawPeriod4();
if (BackTest==false)
{
for(int i=1; i < Bars; i++)
{
P1Buffer[i]=P1Buffer[0];
P2Buffer[i]=P2Buffer[0];
P3Buffer[i]=P3Buffer[0];
P4Buffer[i]=P4Buffer[0];
P5Buffer[i]=P5Buffer[0];
P6Buffer[i]=P6Buffer[0];
P7Buffer[i]=P7Buffer[0];
P8Buffer[i]=P8Buffer[0];
}
}
return(0);
}
int DrawPeriod1()
{
int i, ii, counted_bars = IndicatorCounted();
double c1, c2, dc;
string TrendType;
//---- check for possible errors
if(counted_bars < 0)
return(-1);
//---- last counted bar will be recounted
if(counted_bars > 0)
counted_bars--;
int limit = Bars - counted_bars;
//----
for(i = limit - 1; i >= 0; i--)
{
ii = iBarShift(Symbol(), levelPeriod1, Time[i],true);
if (TimeDayOfWeek(Time[i])==1 && FixSunday==true)
{
ii=ii+1;
}
if(ii != -1)
{
c1 = iClose(Symbol(), levelPeriod1, ii + 1);
c2 = iClose(Symbol(), levelPeriod1, ii + 2);
//----
dc = c1 - c2;
//----
if(dc == 0)
{
c2 = iClose(Symbol(), levelPeriod1, ii + 3);
}
//----
dc = c1 - c2;
//----
if(dc == 0)
{
dc = c1;
}
//----
P1Buffer[i] = c1-dc;
P4Buffer[i] = c1+dc;
if (P1Buffer[i]<P4Buffer[i])
{
TrendType="Day Up ";
}
else
{
TrendType="Day Down ";
}
SetPrice("level1", Time[i],P1Buffer[i], Red);
SetText("txtlevel1", TrendType, Time[i], P1Buffer[i], Red);
SetPrice("level4", Time[i],P4Buffer[i], Red);
SetText("txtlevel4", TrendType, Time[i], P4Buffer[i], Red);
//----
}
}
//----
return(0);
}
int DrawPeriod2()
{
int i, ii, counted_bars = IndicatorCounted();
double c1, c2, dc;
string TrendType;
//---- check for possible errors
if(counted_bars < 0)
return(-1);
//---- last counted bar will be recounted
if(counted_bars > 0)
counted_bars--;
int limit = Bars - counted_bars;
//----
for(i = limit - 1; i >= 0; i--)
{
ii = iBarShift(Symbol(), levelPeriod2, Time[i],true);
if(ii != -1)
{
c1 = iClose(Symbol(), levelPeriod2, ii + 1);
c2 = iClose(Symbol(), levelPeriod2, ii + 2);
//----
dc = c1 - c2;
//----
if(dc == 0)
{
c2 = iClose(Symbol(), levelPeriod2, ii + 3);
}
//----
dc = c1 - c2;
//----
if(dc == 0)
{
dc = c1;
}
//----
P2Buffer[i] = c1-dc;
P5Buffer[i] = c1+dc;
if (P2Buffer[i]<P5Buffer[i])
{
TrendType="H4 Up ";
}
else
{
TrendType="H4 Down ";
}
SetPrice("level2", Time[i],P2Buffer[i], Green);
SetText("txtlevel2", TrendType, Time[i], P2Buffer[i], Green);
SetPrice("level5", Time[i],P5Buffer[i], Green);
SetText("txtlevel5", TrendType, Time[i], P5Buffer[i], Green);
//----
}
}
//----
return(0);
}
int DrawPeriod3()
{
int i, ii, counted_bars = IndicatorCounted();
double c1, c2, dc;
string TrendType;
//---- check for possible errors
if(counted_bars < 0)
return(-1);
//---- last counted bar will be recounted
if(counted_bars > 0)
counted_bars--;
int limit = Bars - counted_bars;
//----
for(i = limit - 1; i >= 0; i--)
{
ii = iBarShift(Symbol(), levelPeriod3, Time[i],true);
if(ii != -1)
{
c1 = iClose(Symbol(), levelPeriod3, ii + 1);
c2 = iClose(Symbol(), levelPeriod3, ii + 2);
//----
dc = c1 - c2;
//----
if(dc == 0)
{
c2 = iClose(Symbol(), levelPeriod3, ii + 3);
}
//----
dc = c1 - c2;
//----
if(dc == 0)
{
dc = c1;
}
//----
P3Buffer[i] = c1-dc;
P6Buffer[i] = c1+dc;
if (P3Buffer[i]<P6Buffer[i])
{
TrendType="Week Up ";
}
else
{
TrendType="Week Down ";
}
SetPrice("level3", Time[i],P3Buffer[i], Blue);
SetText("txtlevel3", TrendType, Time[i], P3Buffer[i], Blue);
SetPrice("level6", Time[i],P6Buffer[i], Blue);
SetText("txtlevel6", TrendType, Time[i], P6Buffer[i], Blue);
//----
}
}
//----
return(0);
}
int DrawPeriod4()
{
int i, ii, counted_bars = IndicatorCounted();
double c1, c2, dc;
string TrendType;
//---- check for possible errors
if(counted_bars < 0)
return(-1);
//---- last counted bar will be recounted
if(counted_bars > 0)
counted_bars--;
int limit = Bars - counted_bars;
//----
for(i = limit - 1; i >= 0; i--)
{
ii = iBarShift(Symbol(), levelPeriod4, Time[i],true);
if(ii != -1)
{
c1 = iClose(Symbol(), levelPeriod4, ii + 1);
c2 = iClose(Symbol(), levelPeriod4, ii + 2);
//----
dc = c1 - c2;
//----
if(dc == 0)
{
c2 = iClose(Symbol(), levelPeriod4, ii + 3);
}
//----
dc = c1 - c2;
//----
if(dc == 0)
{
dc = c1;
}
//----
P7Buffer[i] = c1-dc;
P8Buffer[i] = c1+dc;
if (P7Buffer[i]<P8Buffer[i])
{
TrendType="Month Up ";
}
else
{
TrendType="Month Down ";
}
SetPrice("level7", Time[i],P7Buffer[i], Orange);
SetText("txtlevel7", TrendType, Time[i], P7Buffer[i], Orange);
SetPrice("level8", Time[i],P8Buffer[i], Orange);
SetText("txtlevel8", TrendType, Time[i], P8Buffer[i], Orange);
//----
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void SetPrice(string name, datetime Tm, double Prc, color clr)
{
if(ObjectFind(name) == -1)
{
ObjectCreate(name, OBJ_ARROW, 0, Tm, Prc);
ObjectSet(name, OBJPROP_COLOR, clr);
ObjectSet(name, OBJPROP_WIDTH, 1);
ObjectSet(name, OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE);
}
else
{
ObjectSet(name, OBJPROP_TIME1, Tm);
ObjectSet(name, OBJPROP_PRICE1, Prc);
ObjectSet(name, OBJPROP_COLOR, clr);
ObjectSet(name, OBJPROP_WIDTH, 1);
ObjectSet(name, OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE);
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void SetText(string name,string txt,datetime Tm,double Prc,color clr)
{
if(ObjectFind(name) == -1)
{
ObjectCreate(name, OBJ_TEXT, 0, Tm, Prc);
ObjectSetText(name, txt, 10, "Times New Roman", clr);
ObjectSet(name, OBJPROP_CORNER, 2);
}
else
{
ObjectSet(name, OBJPROP_TIME1, Tm);
ObjectSet(name, OBJPROP_PRICE1, Prc);
ObjectSetText(name, txt, 10, "Times New Roman", clr);
ObjectSet(name, OBJPROP_CORNER, 2);
}
}
//+------------------------------------------------------------------+
Comments