Waddah_Attar_Dayly_CAMARILLA
Download scriptThis tool is designed to provide traders with specific price level projections based on the Daily Camarilla breakout strategy. It acts as a visual guide on your trading charts, identifying potential support and resistance zones for the current trading day.
Core Logic Overview
The script analyzes the previous full day's price movement to calculate eight specific price levels. These levels are divided into pairs (H1/L1 through H4/L4) that represent key psychological and mathematical turning points where the price might react, stall, or break out.
How the Calculations Work
To determine these levels, the script performs the following steps:
- Range Identification: It first looks at the completed daily candle to find the "High" (the highest price reached) and the "Low" (the lowest price reached). It then calculates the total distance between these two points—this is known as the daily range.
- Reference Point: It uses the previous day's closing price as the baseline from which all other levels are calculated.
- Proportional Projection: The script applies specific percentage-based offsets to that daily range to project new levels:
- H1 & L1: These are the first levels, calculated at a small offset (9%) from the previous close. They often represent the immediate boundaries for the current day's price action.
- H2 & L2: These are intermediate levels calculated at an 18% offset.
- H3 & L3: These are further outer levels calculated at a 27% offset.
- H4 & L4: These are the furthest projections, calculated at a significant 55% offset. They represent major "breakout" zones or deep support/resistance areas.
Visual Representation on Your Chart
Instead of just providing raw numbers, the script automatically draws these levels directly onto your chart:
- Dynamic Lines: It creates eight distinct lines that plot across the screen, allowing you to see how the current price interacts with these historical projections in real-time.
- Color Coding: The script uses a dual-color system to distinguish between different types of levels (typically Green for High/Resistance and Red for Low/Support), making it easier to read at a glance.
- Labels & Markers: It automatically places text labels (such as "H1", "L2", etc.) and price markers at the correct coordinates. This ensures that you always know exactly which level you are looking at without having to manually check the price scale.
Summary for the Trader
In simple terms, this script takes the "DNA" of yesterday's trading day and projects where today's price is likely to behave based on historical volatility. It tells you: "Based on how big the move was yesterday, these are the eight specific floors and ceilings we should watch for today."
//+------------------------------------------------------------------+
//| Waddah Attar Dayly CAMARRILLA |
//| 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_D1;
//----
double H1, L1, H2, L2, H3, L3, H4, L4, 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);
//----
Comment("Dayly CAMARRILLA By eng.Waddah Attar www.metaforex.net");
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("DayH1");
ObjectDelete("DayH2");
ObjectDelete("DayH3");
ObjectDelete("DayH4");
ObjectDelete("DayL1");
ObjectDelete("DayL2");
ObjectDelete("DayL3");
ObjectDelete("DayL4");
ObjectDelete("txtDayH1");
ObjectDelete("txtDayH2");
ObjectDelete("txtDayH3");
ObjectDelete("txtDayH4");
ObjectDelete("txtDayL1");
ObjectDelete("txtDayL2");
ObjectDelete("txtDayL3");
ObjectDelete("txtDayL4");
Comment("");
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));
//----
H1 = iClose(Symbol(), myPeriod,dayi+1) + (Q * 0.09);
L1 = iClose(Symbol(), myPeriod,dayi+1) - (Q * 0.09);
//----
H2 = iClose(Symbol(), myPeriod,dayi+1) + (Q * 0.18);
L2 = iClose(Symbol(), myPeriod,dayi+1) - (Q * 0.18);
//----
H3 = iClose(Symbol(), myPeriod,dayi+1) + (Q * 0.27);
L3 = iClose(Symbol(), myPeriod,dayi+1) - (Q * 0.27);
//----
H4 = iClose(Symbol(), myPeriod,dayi+1) + (Q * 0.55);
L4 = iClose(Symbol(), myPeriod,dayi+1) - (Q * 0.55);
//----
P1Buffer[i] = H1;
SetPrice("DayH1", Time[i], H1, Green);
SetText("txtDayH1", "H1", Time[i], H1, Green);
//----
P2Buffer[i] = L1;
SetPrice("DayL1", Time[i], L1, Red);
SetText("txtDayL1", "L1", Time[i], L1, Red);
//----
P3Buffer[i] = H2;
SetPrice("DayH2", Time[i], H2, Green);
SetText("txtDayH2", "H2", Time[i], H2, Green);
//----
P4Buffer[i] = L2;
SetPrice("DayL2",Time[i],L2,Red);
SetText("txtDayL2","L2",Time[i],L2,Red);
//----
P5Buffer[i] = H3;
SetPrice("DayH3", Time[i], H3, Green);
SetText("txtDayH3", "H3", Time[i], H3, Green);
//----
P6Buffer[i] = L3;
SetPrice("DayL3", Time[i], L3, Red);
SetText("txtDayL3", "L3", Time[i], L3, Red);
//----
P7Buffer[i] = H4;
SetPrice("DayH4", Time[i], H4, Green);
SetText("txtDayH4", "H4", Time[i], H4, Green);
//----
P8Buffer[i] = L4;
SetPrice("DayL4", Time[i], L4, Red);
SetText("txtDayL4", "L4", Time[i], L4, 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