Silver-channels+
Download scriptThe Silver-channels indicator is a technical analysis tool designed to provide traders with visual price boundaries and structural levels on a trading chart. Instead of relying on a single moving average or price point, this script calculates several distinct "channels" based on historical price volatility.
Core Logic and Functionality
The script operates by scanning the market history to identify specific price extremes—the highest highs and lowest lows—over a defined period. Once these extremes are established, it calculates four different types of price channels:
- Silver Channels: These are primary internal boundaries calculated using a specific percentage of the price range. They provide a "buffer" zone that helps traders identify potential areas of support and resistance.
- Sky Channels: Similar to the Silver channels, these use a different percentage threshold, offering an alternative set of price levels for identifying trend strength or exhaustion.
- Zen Channels: These represent the absolute outer boundaries (the highest high and the lowest low) of the analyzed period. They serve as the ultimate "ceiling" and "floor" for the current market structure.
- Future Channels: This logic projects a boundary outward beyond the current high/low range. It acts as an extension, helping traders visualize where price might head if the current momentum continues to expand in a specific direction.
How it Processes Data
- Range Analysis: The tool looks back at a set number of candles (the "period") to determine the total price movement (the distance between the highest and lowest points).
- Proportional Mapping: It then takes that total movement and divides it into smaller segments based on pre-set percentages. For example, if a market moves 100 pips, the script will mark lines at specific intervals (like 38.2 or 61.8) relative to those highs and lows.
- Dynamic Adjustment: As new candles form and price action changes, the indicator recalculates these boundaries. This ensures that the channels move in sync with the evolving market structure rather than remaining static.
Visual Representation
The script outputs eight distinct lines on your chart, categorized by color. These lines allow you to see a multi-layered view of the market:
- Internal Structure: The Silver and Sky lines provide "inner" zones where price often reacts or consolidates.
- External Boundaries: The Zen lines show the hard limits of recent history.
- Expansion Zones: The Future lines suggest potential targets for breakout movements.
By providing these various layers of data simultaneously, the indicator helps traders visualize whether the market is currently "trapped" within a specific range, breaking out toward new extremes, or finding equilibrium between multiple support and resistance levels.
//+------------------------------------------------------------------+
//| Silver-channels.mq4 |
//| Copyright © 2004, AlexSilver |
//| http://viac.ru/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, AlexSilver"
#property link "http://viac.ru/"
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Silver
#property indicator_color2 Silver
#property indicator_color3 SkyBlue
#property indicator_color4 SkyBlue
#property indicator_color5 YellowGreen
#property indicator_color6 YellowGreen
#property indicator_color7 Magenta
#property indicator_color8 Magenta
//---- input parameters
extern int Shift=3;
extern int TSP=9;
extern int SSP=26;
extern double SilvCh=38.2;
extern double SkyCh=23.6;
extern double ZenCh=0;
extern double FutCh=61.8;
//---- buffers
double SCH_BufferH[];
double SCH_BufferL[];
double Sky_BufferH[];
double Sky_BufferL[];
double Zen_BufferH[];
double Zen_BufferL[];
double Fut_BufferL[];
double Fut_BufferH[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,SCH_BufferH);
SetIndexDrawBegin(0,SSP+Shift-1);
SetIndexShift(0,Shift);
SetIndexLabel(0,"Silver-channel High");
//----
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,SCH_BufferL);
SetIndexDrawBegin(1,SSP+Shift-1);
SetIndexShift(1,Shift);
SetIndexLabel(1,"Silver-channel Low");
//----
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,Sky_BufferH);
SetIndexDrawBegin(2,SSP+Shift-1);
SetIndexShift(2,Shift);
SetIndexLabel(2,"Sky-channel High");
//----
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,Sky_BufferL);
SetIndexDrawBegin(3,SSP+Shift-1);
SetIndexShift(3,Shift);
SetIndexLabel(3,"Sky-channel Low");
//----
SetIndexStyle(4,DRAW_LINE);
SetIndexBuffer(4,Zen_BufferH);
SetIndexDrawBegin(4,SSP+Shift-1);
SetIndexShift(4,Shift);
SetIndexLabel(4,"Zen-channel High");
//----
SetIndexStyle(5,DRAW_LINE);
SetIndexBuffer(5,Zen_BufferL);
SetIndexDrawBegin(5,SSP+Shift-1);
SetIndexShift(5,Shift);
SetIndexLabel(5,"Zen-channel Low");
//----
SetIndexStyle(6,DRAW_LINE);
SetIndexBuffer(6,Fut_BufferL);
SetIndexDrawBegin(6,SSP+TSP-1);
SetIndexShift(6,TSP);
SetIndexLabel(6,"Future-channel Low");
//----
SetIndexStyle(7,DRAW_LINE);
SetIndexBuffer(7,Fut_BufferH);
SetIndexDrawBegin(7,SSP+TSP-1);
SetIndexShift(7,TSP);
SetIndexLabel(7,"Future-channel High");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Silver-channels |
//+------------------------------------------------------------------+
int start()
{
int i,k;
int counted_bars=IndicatorCounted(); // òåêóùèé áàð äëÿ ðàñ÷åòà èíäèêàòîðà
double high,low,price;
//----
if(Bars<=SSP) return(0); // åñëè áàðîâ ìåíüøå Êèäæóí-ïåðèîäà íàôèã
//---- initial zero
if(counted_bars<1) // åñëè òåêóùèé áàð ìåíüøå åäèíèöû - íàôèã ñ ïëÿæà, óñòàíàâëèâàåì âñå â íóëè
{
for(i=1;i<=SSP;i++) SCH_BufferH[Bars-i]=0; SCH_BufferL[Bars-i]=0; Sky_BufferH[Bars-i]=0; Sky_BufferL[Bars-i]=0; Zen_BufferH[Bars-i]=0; Zen_BufferL[Bars-i]=0; Fut_BufferL[Bars-i]=0; Fut_BufferH[Bars-i]=0;
}
//----
i=Bars-SSP;
if(counted_bars>SSP) i=Bars-counted_bars-1;
while(i>=0)
{
high=High[i]; low=Low[i]; k=i-1+SSP;
while(k>=i)
{
price=High[k];
if(high<price) high=price;
price=Low[k];
if(low>price) low=price;
k--;
}
SCH_BufferL[i+Shift]=low+(high-low)*SilvCh/100;
SCH_BufferH[i+Shift]=high-(high-low)*SilvCh/100;
Sky_BufferL[i+Shift]=low+(high-low)*SkyCh/100;
Sky_BufferH[i+Shift]=high-(high-low)*SkyCh/100;
Zen_BufferL[i+Shift]=low;
Zen_BufferH[i+Shift]=high;
Fut_BufferL[i]=low-(high-low)*FutCh/100;
Fut_BufferH[i]=high+(high-low)*FutCh/100;
i--;
} i=Shift-1;
while(i>=0)
{
high=High[0]; low=Low[0]; k=SSP-Shift+i;
while(k>=0)
{
price=High[k];
if(high<price) high=price;
price=Low[k];
if(low>price) low=price;
k--;
}
SCH_BufferL[i]=low+(high-low)*SilvCh/100;
SCH_BufferH[i]=high-(high-low)*SilvCh/100;
Sky_BufferL[i]=low+(high-low)*SkyCh/100;
Sky_BufferH[i]=high-(high-low)*SkyCh/100;
Zen_BufferL[i]=low;
Zen_BufferH[i]=high;
i--;
}
}
//+------------------------------------------------------------------+
Comments