The DXWeekSnR script is a specialized technical analysis tool designed to identify significant price levels and historical price action on the weekly timeframe. It functions by scanning historical market data to pinpoint specific candles that represent key structural "Support and Resistance" zones.
Core Logic and Functionality
1. Dynamic Breakout Detection The script constantly monitors the current market price relative to the previous week's boundaries (the High, Low, Open, and Close prices). It is designed to recognize when the price moves outside of these established ranges. When a breakout occurs—meaning the price climbs above the previous high or drops below the previous low—the script triggers its primary search logic.
2. Historical Contextual Scanning Once a breakout is detected, the tool does not simply mark the current movement. Instead, it performs an automated "look-back" across a vast range of historical data (up to 1,000 bars). It searches for the specific historical candle where the current price action overlaps with previous market activity. By identifying these intersections, the script helps traders find the most relevant historical references for the current price movement.
3. Visual Mapping and Color Coding After identifying the relevant historical data points, the script draws four distinct horizontal trend lines on your chart to represent the Open, Close, High, and Low of that significant period. To make these insights easier to interpret at a glance, it uses a dynamic color-coding system:
- Yellow-Green: Indicates bullish momentum (where the closing price was higher than the opening price).
- Red: Indicates bearish momentum (where the closing price was lower than the opening price).
4. Information Dashboard In addition to the visual lines on the chart, the script includes a decorative display element. This provides a branded "overlay" on the screen, ensuring that the technical data is presented in a clean, organized manner without cluttering the main workspace.
Summary for the User
Essentially, this tool automates the tedious process of looking back through weeks of charts to find where the current price is interacting with historical zones. It highlights these key "Supply and Demand" levels automatically, changing color based on whether the historical move was positive or negative, allowing you to see structural market shifts more clearly.
//+------------------------------------------------------------------+
//| DXWeekSnR |
//| Copyright 2012, dXerof |
//+------------------------------------------------------------------+
#property copyright "dXerof"
#property link "http://free-bonus-deposit.blogspot.com/"
#property indicator_chart_window
extern int TF=10080;
extern color Lcolor= Red;
extern int CountSnR=4;
extern int CountBar=1000;
extern int start=0;
int CountLine=5;
bool UseBP=False;
double BPSize=30;
bool SnR=True;
double fiborat=1.00061803;
string Name;
double poen;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
if(Digits==2 || Digits==4) poen=Point; else poen=10*Point;
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("Open");
ObjectDelete("Close");
ObjectDelete("High");
ObjectDelete("Low");
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
double Hi=iHigh(Symbol(),TF,1);
double Lo=iLow(Symbol(),TF,1);
double Cl=iClose(Symbol(),TF,1);
double Op=iOpen(Symbol(),TF,1);
//Above hi
if(Close[0]>Hi || Close[0]<Lo)
{
for(int i=1; i<CountBar; i++)
{
if(Close[0]>iLow(Symbol(),TF,i) && Close[0]<iHigh(Symbol(),TF,i))
{
double iHi=iHigh(Symbol(),TF,i);
double iLo=iLow(Symbol(),TF,i);
double iCl=iClose(Symbol(),TF,i);
double iOp=iOpen(Symbol(),TF,i);
datetime date=iTime(Symbol(),TF,i);
Op=iOp;
Cl=iCl;
Hi=iHi;
Lo=iLo;
break;
}
}
}
//Below Low
if(Close[0]<Lo)
{
for(i=1; i<CountBar; i++)
{
if(Close[0]<iHigh(Symbol(),TF,i) && Close[0]>iLow(Symbol(),TF,i))
{
iHi=iHigh(Symbol(),TF,i);
iLo=iLow(Symbol(),TF,i);
iCl=iClose(Symbol(),TF,i);
iOp=iOpen(Symbol(),TF,i);
date=iTime(Symbol(),TF,i);
Op=iOp;
Cl=iCl;
Hi=iHi;
Lo=iLo;
break;
}
}
}
ObjectDelete("Open");
ObjectDelete("Close");
ObjectDelete("High");
ObjectDelete("Low");
if(Cl>Op) Lcolor=YellowGreen; else Lcolor=Red;
draw("Open",date,Op,Lcolor,1);
draw("Close",date,Cl,Lcolor,1);
draw("High",date,Hi,Lcolor,1);
draw("Low",date,Lo,Lcolor,1);
date=iTime(Symbol(),TF,i);
dpkfx();
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void draw(string Line,int TimeStart,double Price,color line_clr,int line_width)
{
ObjectCreate(Line,OBJ_TREND,0,TimeStart,Price,CurTime(),Price);
ObjectSet(Line,OBJPROP_COLOR,line_clr);
ObjectSet(Line,OBJPROP_STYLE,STYLE_DOT);
ObjectSet(Line,OBJPROP_WIDTH,line_width);
ObjectSet(Line,OBJPROP_BACK,True);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void dpkfx()
{
int ipos=3;
int xpos=30;
double vol=(iHigh(Symbol(),1440,0)-iLow(Symbol(),1440,0))/Point;
int st=1;
stats("line","------------------",9,"Arial",White,ipos,xpos-1,45);
stats("dpkforex","dXerof Oye",12,"Impact",Lime,ipos,xpos,30);
stats("line2","------------------",9,"Arial",White,ipos,xpos-1,21);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void stats(string tname,string word,int fsize,string ftype,color tcolor,int posxy,int posx,int posy)
{
ObjectCreate(tname,OBJ_LABEL,0,0,0);
ObjectSetText(tname,word,fsize,ftype,tcolor);
ObjectSet(tname,OBJPROP_CORNER,posxy);
ObjectSet(tname,OBJPROP_XDISTANCE,posx);
ObjectSet(tname,OBJPROP_YDISTANCE,posy);
}
//+------------------------------------------------------------------+
Comments