Waddah_Attar_Weekly_Pivot_Fibo_Second

Download script
Author: Copyright � 2007, www.metaforex.net
Waddah_Attar_Weekly_Pivot_Fibo_Second

This technical tool is designed to provide traders with a structured visual map of potential price boundaries on a trading chart. It functions by calculating specific "Pivot" levels based on weekly market data, helping users identify zones where the price might encounter resistance or support.

Core Logic and Functionality

The script operates by analyzing the price action of the previous week to project key levels onto the current chart. Here is a breakdown of how that logic flows:

1. Data Gathering The tool specifically looks at the weekly timeframe. It identifies the high, low, opening, and closing prices from the preceding week. By focusing on this specific timeframe, the tool ensures that the levels generated are based on significant historical price movements rather than minor, short-term fluctuations.

2. Pivot Calculation From the data gathered above, the script calculates two primary components:

  • The Range: It determines the total distance between the previous week's highest and lowest points.
  • The Pivot Point (PP): It calculates a central "balance" price based on the average of the previous week's highs, lows, opens, and closes.

3. Level Projection Once the Pivot Point and the Range are established, the script projects eight distinct lines (levels) across the chart. These are divided into two categories:

  • Resistance Levels (Green): These represent "ceilings" where the price might struggle to move higher. The script calculates these by adding specific multipliers of the weekly range to the Pivot Point.
  • Support Levels (Red): These represent "floors" where the price might find a base and potentially bounce upward. The script calculates these by subtracting those same multipliers from the Pivot Point.

4. Multiplier Variations The tool uses different mathematical weights for its levels. This provides a comprehensive "map" of the market, showing both immediate zones of interest (closer to the pivot) and more extended, extreme zones (further away from the pivot).

5. Visual Presentation To make this data actionable for a human trader, the script automatically draws:

  • Continuous Lines: Visual paths that allow you to see how these levels move over time.
  • Dynamic Labels & Arrows: The tool places specific markers and text labels (such as WR4, WS4, etc.) directly on the price points. This allows for quick identification of which level is which without having to manually interpret the chart's geometry.

In summary, this script automates the complex math required to project weekly supply and demand zones, translating raw historical data into a clear visual roadmap for identifying potential trading opportunities.

Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains close prices for each barSeries array that contains open prices of each bar
Miscellaneous
Implements a curve of type %1
16 Views
0 Downloads
0 Favorites
Waddah_Attar_Weekly_Pivot_Fibo_Second
//+------------------------------------------------------------------+
//|                                               Waddah Attar Pivot |
//|                               Copyright © 2007, ww.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 Green
#property indicator_color2 Red
#property indicator_color3 Green
#property indicator_color4 Red
#property indicator_color5 Green
#property indicator_color6 Red
#property indicator_color7 Green
#property indicator_color8 Red
//---- buffers
double P1Buffer[];
double P2Buffer[];
double P3Buffer[];
double P4Buffer[];
double P5Buffer[];
double P6Buffer[];
double P7Buffer[];
double P8Buffer[];
//----
int myPeriod = PERIOD_W1;
//----
double PP, R4, S4, R5, S5, R6, S6, R7, S7, Q;
//+------------------------------------------------------------------+
//| 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, 1);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 1);
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 1);
   SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, 1);
   SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, 1);
   SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, 1);
   SetIndexStyle(6, DRAW_LINE, STYLE_SOLID, 1);
   SetIndexStyle(7, DRAW_LINE, STYLE_SOLID, 1);
//----   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectDelete("WeekR4");
   ObjectDelete("WeekR5");
   ObjectDelete("WeekR6");
   ObjectDelete("WeekR7");
//----
   ObjectDelete("WeekS4");
   ObjectDelete("WeekS5");
   ObjectDelete("WeekS6");
   ObjectDelete("WeekS7");
//----
   ObjectDelete("txtWeekR4");
   ObjectDelete("txtWeekR5");
   ObjectDelete("txtWeekR6");
   ObjectDelete("txtWeekR7");
//----   
   ObjectDelete("txtWeekS4");
   ObjectDelete("txtWeekS5");
   ObjectDelete("txtWeekS6");
   ObjectDelete("txtWeekS7");
//----   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i, dayi, counted_bars = IndicatorCounted();
//---- 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--)
     {
       dayi = iBarShift(Symbol(), myPeriod, Time[i], false);
       Q = (iHigh(Symbol(), myPeriod,dayi + 1) - iLow(Symbol(), myPeriod, 
            dayi + 1));
       PP = (iHigh(Symbol(), myPeriod, dayi + 1) + 
             iLow(Symbol(), myPeriod, dayi + 1) +
             iClose(Symbol(), myPeriod, dayi + 1) +
             iOpen(Symbol(), myPeriod, dayi)) / 4;
       //----    
       R4 = PP + (Q * 0.62);
       S4 = PP - (Q * 0.62);
       //----
       R5 = PP + (Q * 0.76);
       S5 = PP - (Q * 0.76);
       //----
       R6 = PP + (Q * 1);
       S6 = PP - (Q * 1);
       //----
       R7 = PP + (Q * 1.23);
       S7 = PP - (Q * 1.23);
       //----
       P1Buffer[i] = R4;
       SetPrice("WeekR4", Time[i], R4, Green);
       SetText("txtWeekR4", "WR4", Time[i], R4, Green);
       //----
       P2Buffer[i] = S4;
       SetPrice("WeekS4", Time[i], S4, Red);
       SetText("txtWeekS4", "WS4", Time[i], S4, Red);
       //----
       P3Buffer[i] = R5;
       SetPrice("WeekR5", Time[i], R5, Green);
       SetText("txtWeekR5", "WR5", Time[i], R5, Green);
       //----
       P4Buffer[i] = S5;
       SetPrice("WeekS5", Time[i], S5, Red);
       SetText("txtWeekS5", "WS5", Time[i], S5, Red);
       //----
       P5Buffer[i] = R6;
       SetPrice("WeekR6", Time[i], R6, Green);
       SetText("txtWeekR6", "WR6", Time[i], R6, Green);
       //----
       P6Buffer[i] = S6;
       SetPrice("WeekS6", Time[i], S6, Red);
       SetText("txtWeekS6", "WS6", Time[i], S6, Red);
       //----
       P7Buffer[i] = R7;
       SetPrice("WeekR7", Time[i], R7, Green);
       SetText("txtWeekR7", "WR7", Time[i], R7, Green);
       //----
       P8Buffer[i] = S7;
       SetPrice("WeekS7", Time[i], S7, Red);
       SetText("txtWeekS7", "WS7", Time[i], S7, Red);
    }
//----
   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