Waddah Attar Hidden Level

Download script
Author: Copyright � 2007, Waddah Attar waddahattar@hotmail.com
Waddah Attar Hidden Level

This tool is designed to provide traders with a visual representation of key price levels based on daily market movements. Instead of relying on standard averages, it identifies "hidden" structural levels by analyzing the relationship between previous daily candles and the current price action.

Core Logic Overview

The script scans the historical data of the daily charts to determine specific price boundaries. Its primary goal is to establish a zone of interest where the market might encounter resistance or support based on the behavior of the preceding trading day.

How it Calculates Levels

The logic follows a systematic process to identify five distinct price points:

  1. Daily Reference: The script looks back at the completion of the previous daily candle to determine if the market closed higher or lower than it opened.
  2. Dynamic Boundary Identification: Based on that daily movement, the script calculates two primary "anchor" levels (represented by Red and Green lines). These are derived by finding the midpoint between specific price extremes—such as the high and the close, or the open and the low—depending on the direction of the day's trend.
  3. Central Equilibrium: It establishes a central balance point (a Blue dotted line) which represents the exact middle ground between the two primary boundaries.
  4. Fibonacci Proportions: To provide more granular detail, the script applies a specific mathematical ratio (0.618) to the distance between the primary boundaries. This creates two additional "hidden" levels that highlight potential areas of high-precision interest within the daily range.

Visual Representation

The script translates these complex calculations into a clear visual layout on your chart:

  • Primary Boundaries: Distinct solid lines show the main upper and lower limits of the current price structure.
  • Secondary Levels: Dotted lines indicate the central equilibrium and the refined Fibonacci-based zones.
  • Real-Time Updating: These levels are designed to update dynamically as the current price moves, allowing you to see how the "hidden" structure of the market shifts in real-time relative to the previous day's performance.

Key Features for the User

  • Automated Calculation: The tool removes the manual work of calculating midpoints and Fibonacci ratios, providing these levels instantly as they appear.
  • Market Structure Awareness: By focusing on the daily candle behavior, it helps traders understand the "memory" of the market—how yesterday's movement influences today's price limits.
  • Consistency: The script includes specific logic to handle weekend gaps, ensuring that the levels remain consistent and don't provide misleading data when the markets are closed on Sundays.
Price Data Components
Series array that contains open time of each barSeries array that contains open prices of each barSeries array that contains close prices for each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
Waddah Attar Hidden Level
//+------------------------------------------------------------------+
//|                                      Waddah Attar Hidden Level   |
//|           Copyright © 2007, Waddah Attar waddahattar@hotmail.com |
//|                             Waddah Attar waddahattar@hotmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, Waddah Attar waddahattar@hotmail.com"
#property link      "waddahattar@hotmail.com"
//---- 
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Red
#property indicator_color2 Green
#property indicator_color3 Blue
#property indicator_color4 Blue
#property indicator_color5 Blue

//---- buffers
double P1Buffer[];
double P2Buffer[];
double P3Buffer[];
double P4Buffer[];
double P5Buffer[];
//---- 

bool FixSunday;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexBuffer(0, P1Buffer);
   SetIndexBuffer(1, P2Buffer);
   SetIndexBuffer(2, P3Buffer);
   SetIndexBuffer(3, P4Buffer);
   SetIndexBuffer(4, P5Buffer);
//---- 
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(2, DRAW_LINE, STYLE_DOT, 1);
   SetIndexStyle(3, DRAW_LINE, STYLE_DOT, 1);
   SetIndexStyle(4, DRAW_LINE, STYLE_DOT, 1);
//---- 
   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("hlevel1");
   ObjectDelete("hlevel2");
   ObjectDelete("hlevel3");
   ObjectDelete("hlevel4");
   ObjectDelete("hlevel5");
//---- 
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
  DrawPeriod();
  return(0);
}
  
int DrawPeriod()
{
   int i, ii, counted_bars = IndicatorCounted();
   double c1, c2;
//---- 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(), PERIOD_D1, Time[i],true);
     if (TimeDayOfWeek(Time[i])==1 && FixSunday==true)
     {
       ii=ii+1;
     }

     if(ii != -1)
     {
       if(iClose(Symbol(), PERIOD_D1, ii + 1)>=iOpen(Symbol(), PERIOD_D1, ii + 1))
       {
         c1 = (iHigh(Symbol(), PERIOD_D1, ii + 1)-iClose(Symbol(), PERIOD_D1, ii + 1))/2+iClose(Symbol(), PERIOD_D1, ii + 1);
         c2 = (iOpen(Symbol(), PERIOD_D1, ii + 1)-iLow(Symbol(), PERIOD_D1, ii + 1))/2+iLow(Symbol(), PERIOD_D1, ii + 1);
       }
       else
       {
         c1 = (iHigh(Symbol(), PERIOD_D1, ii + 1)-iOpen(Symbol(), PERIOD_D1, ii + 1))/2+iOpen(Symbol(), PERIOD_D1, ii + 1);
         c2 = (iClose(Symbol(), PERIOD_D1, ii + 1)-iLow(Symbol(), PERIOD_D1, ii + 1))/2+iLow(Symbol(), PERIOD_D1, ii + 1);
       }
       P1Buffer[i] = c1;
       P2Buffer[i] = c2;
       P3Buffer[i] = (c1+c2)/2;
       P4Buffer[i] = c1+(c1-c2)*0.618;
       P5Buffer[i] = c2-(c1-c2)*0.618;
    }
    SetPrice("hlevel1", Time[0],P1Buffer[0], Red);
    SetPrice("hlevel2", Time[0],P2Buffer[0], Green);
    SetPrice("hlevel3", Time[0],P3Buffer[0], Blue);
    SetPrice("hlevel4", Time[0],P4Buffer[0], Blue);
    SetPrice("hlevel5", Time[0],P5Buffer[0], Blue);
  }
  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);
     } 
  }

Comments