Support and Resistance (Barry)_004
Download scriptThis tool is designed to automatically identify and visualize key price levels on your trading chart, specifically focusing on Support and Resistance zones. In the world of trading, these are the areas where the price has historically struggled to move past (Resistance) or where it has consistently found a floor and bounced back up (Support).
How the Logic Works
The script operates by analyzing historical price movement to find specific "turning points." Here is the step-by-step breakdown of its logic:
1. Identifying Turning Points (Fractals) The tool scans the market data to locate "fractals." Think of a fractal as a local peak or valley. A peak occurs when the price reaches a high point and then reverses downward; a valley occurs when the price hits a low point and begins to move upward.
2. Detecting Resistance (The Ceilings) To identify Support and Resistance, the script looks for these upper peaks. Whenever it detects a significant high point in the price history, it marks that level as Resistance. Visually, this is represented on your chart as red markers, indicating areas where the price might face selling pressure.
3. Detecting Support (The Floors) Simultaneously, the script scans for lower valleys. When the price hits a significant low and begins to move back up, it marks that level as Support. These are displayed on your chart as blue markers, highlighting areas where buyers might step in to prevent the price from falling further.
4. Maintaining Continuity One of the key features of this logic is its ability to carry over these levels. Instead of just showing a single dot and letting it disappear, the script "remembers" the most recent significant peak or valley. If the current price action doesn't create a new high or low, the tool holds onto the previous level, allowing you to see a continuous line of trend behavior across the chart.
Summary for Traders
By automating this process, the script removes the guesswork from identifying where major price reactions occur. It provides a clear visual map:
- Red Markers: Alert you to potential "ceilings" where the market might stall or drop.
- Blue Markers: Alert you to potential "floors" where the market might find its footing and rise.
//+------------------------------------------------------------------+
//| Support and Resistance |
//| Copyright © 2004 Barry Stander |
//| http://myweb.absa.co.za/stander/4meta/ |
//+------------------------------------------------------------------+
#property copyright "Click here: Barry Stander"
#property link "http://myweb.absa.co.za/stander/4meta/"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- buffers
double v1[];
double v2[];
double val1;
double val2;
int i;
int init()
{
IndicatorBuffers(2);
//---- drawing settings
SetIndexArrow(0, 250);
SetIndexArrow(1, 250);
SetIndexStyle(0,DRAW_ARROW,STYLE_DOT,0,Red);
SetIndexDrawBegin(0,i-1);
SetIndexBuffer(0, v1);
SetIndexLabel(0,"Resistance");
SetIndexStyle(1,DRAW_ARROW,STYLE_DOT,0,Blue);
SetIndexDrawBegin(1,i-1);
SetIndexBuffer(1, v2);
SetIndexLabel(1,"Support");
return(0);
}
int start()
{
i=Bars;
while(i>=0)
{
val1 = iFractals(NULL, 0, MODE_UPPER,i);
if (val1 > 0)
v1[i]=High[i];
else
v1[i] = v1[i+1];
val2 = iFractals(NULL, 0, MODE_LOWER,i);
if (val2 > 0)
v2[i]=Low[i];
else
v2[i] = v2[i+1];
i--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments