This tool is designed to help traders visualize key price boundaries on a chart by identifying specific "high" and "low" zones based on recent market activity. Instead of just showing the exact peak or valley of the price, it creates a buffered zone that helps identify potential resistance and support levels.
How it Works
The indicator operates by looking at a specific window of time (defined by a user-set number of previous candles). Within this window, it performs two primary calculations:
1. Identifying Upper Boundaries (Resistance) The script looks back at the highest price reached within the specified period. It then subtracts a small, precise amount from that peak to create a "ceiling" line. This represents a level where the price has recently peaked, serving as a visual guide for where the market might face upward pressure or struggle to break through.
2. Identifying Lower Boundaries (Support) Simultaneously, the script looks back at the lowest price reached within that same period. It adds a small amount to that valley to create a "floor" line. This represents a level where the price has recently bottomed out, acting as a visual guide for where the market might find a base and potentially bounce back up.
Visual Representation
On your chart, these calculations are displayed as two distinct lines:
- The Green Line: Represents the upper boundary (the "ceiling").
- The Red Line: Represents the lower boundary (the "floor").
By following these lines, traders can get a clearer sense of the current market's range. Rather than reacting to every minor price fluctuation, the indicator provides a smoother visual of where the market has historically "turned around" over the most recent trend.
//+------------------------------------------------------------------+
//| CanadosIndicator.mq4 |
//| Copyright © 2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
extern int N1=10;
extern double N2=0.004;
//---- buffers
double HHV1_N2[];
double LLV1_N2[];
int i;
int init()
{
IndicatorBuffers(2);
//---- drawing settings
SetIndexStyle(0,DRAW_LINE,EMPTY,2);
SetIndexBuffer(0, HHV1_N2);
SetIndexStyle(1,DRAW_LINE,EMPTY,2);
SetIndexBuffer(1, LLV1_N2);
return(0);
}
int start()
{
int 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 i=Bars-counted_bars;
while(i>=0)
{
HHV1_N2[i]=High[Highest(NULL,0,MODE_HIGH,N1,i)]-N2;
LLV1_N2[i]=Low[Lowest(NULL,0,MODE_LOW,N1,i)]+N2;
i--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments