Support and Resistance_v4

Download script
Author: Support and Resistance Barry_Stander_4@yahoo.com
Support and Resistance_v4

This tool is designed to automatically identify and visualize key price levels on your trading chart, specifically focusing on Support and Resistance zones. In trading, these are the areas where the price has historically struggled to move past—support acts as a "floor" where buying interest is strong, while resistance acts as a "ceiling" where selling pressure increases.

How the Logic Works

The script operates by scanning the historical price action of the market to find significant turning points. It utilizes a mathematical method to detect "fractals," which are specific peaks and valleys in the price movement.

  • Identifying Resistance (The Ceiling): The tool looks for instances where the price reaches a local high point and then pulls back. When it detects one of these peaks, it marks that level as a point of resistance. On your chart, these are highlighted in Red.
  • Identifying Support (The Floor): Simultaneously, the script scans for local lows—points where the price dipped but then rebounded. It identifies these as support levels and highlights them in Blue.

Visual Behavior on Your Chart

Instead of just marking a single point in time, the logic is designed to carry those values forward across the chart.

  1. Detection: When the script finds a new high (Resistance) or a new low (Support), it captures that specific price coordinate.
  2. Persistence: Once a level is identified, the tool "remembers" that price level. If the price moves without creating a new significant peak or valley, the indicator maintains the previous level's position on the chart.
  3. Continuous Mapping: This creates a visual trail of important price zones, allowing you to see at a glance where the market has historically reacted, helping you gauge where the price might stall or reverse in the future.

In short, this script automates the process of "drawing lines" by constantly monitoring the market's history and highlighting the most important structural boundaries for your trading analysis.

Indicators Used
Fractals
Miscellaneous
Implements a curve of type %1
14 Views
0 Downloads
0 Favorites
Support and Resistance_v4
//+------------------------------------------------------------------+
//|                Support and Resistance                            |
//|                Copyright © 2004/5     Barry Stander              |
//|                http://www.4Africa.net/4meta/                     |
//+------------------------------------------------------------------+

#property copyright "Support and Resistance             Barry_Stander_4@yahoo.com"
#property link      "http://www.4Africa.net/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 init()
  {
//----
   IndicatorBuffers(2);

   SetIndexArrow(0, 119);
   SetIndexStyle(0,DRAW_ARROW,STYLE_DOT,1,Red);
   SetIndexBuffer(0, v1);
   SetIndexLabel(0,"Resistance");

   SetIndexArrow(1, 119);
   SetIndexStyle(1,DRAW_ARROW,STYLE_DOT,1,Blue);
   SetIndexBuffer(1, v2);
   SetIndexLabel(1,"Support");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int 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