VKW_Bands_-_IBS2
Download scriptThe VKW Bands indicator is a specialized technical analysis tool designed to help traders visualize price action dynamics and potential trend boundaries. Instead of appearing directly on the main price chart, it operates in a separate window, providing a distinct perspective on where the market's "momentum" sits relative to its recent history.
How the Logic Works
The indicator functions through a multi-step calculation process that transforms raw price data into a smoothed set of visual bands:
1. Relative Positioning First, the script analyzes every candle to determine where the closing price sits within the high-to-low range of that specific period. It essentially asks: "Is the price currently closer to the top or the bottom of its current movement?" This creates a baseline value based on the price's internal position.
2. Signal Smoothing To remove "noise" (random, jagged price fluctuations), the script applies a Simple Moving Average (SMA) to these relative positions over a specific timeframe. This turns erratic movements into a cleaner line that represents the general trend of the price's positioning.
3. Identifying Extremes (The Bands) The logic then looks back over a predefined range of historical data to identify the highest and lowest points reached by that smoothed signal. These extremes act as the "ceiling" and "floor" for the indicator.
4. Final Smoothing for Clarity Finally, the script applies one last layer of smoothing to these maximum and minimum boundaries. This ensures that the resulting bands move fluidly across the screen rather than jumping abruptly, making it easier for a trader to identify supported levels or resistance zones.
Summary of Visual Output
- The Center Line: Represents the smoothed average of where the price is currently trading within its range.
- The Bands: Act as dynamic boundaries. When the price action pushes toward these bands, it suggests that the market is reaching an extreme relative to recent history, potentially signaling a period of exhaustion or a shift in trend direction.
//+------------------------------------------------------------------+
//| VKW Bands.mq4.mq4
//| Rosh
//| http://www.investo.ru/forum/viewtopic.php?p=188196&sid=3564b6effe75d85c5526211453ddb860#188196
//+------------------------------------------------------------------+
#property copyright "Rosh"
#property link "http://www.investo.ru/forum/viewtopic.php?p=188196&sid=3564b6effe75d85c5526211453ddb860#188196"
//----
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Blue
#property indicator_color3 Red
//---- input parameters
extern int RangePeriod=25;
extern int SmoothPeriod=3;
extern int SmoothMode=MODE_SMA;
extern int Per=5;
//---- buffers
double ExtMapBuffer0[];
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(6);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexDrawBegin(0,SmoothPeriod);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexDrawBegin(1,SmoothPeriod);
SetIndexStyle(2,DRAW_LINE);
SetIndexDrawBegin(2,SmoothPeriod);
SetIndexBuffer(2,ExtMapBuffer0);
SetIndexBuffer(3,ExtMapBuffer3);
SetIndexBuffer(4,ExtMapBuffer4);
SetIndexBuffer(5,ExtMapBuffer5);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
int limit,limit1,cnt,n_max,n_min;
if (counted_bars==0)
{
limit=Bars-RangePeriod;
limit1=limit-SmoothPeriod;
}
if (counted_bars>0)
{
limit=Bars-counted_bars;
limit1=limit;
}
limit--;
limit1--;
for(cnt=limit; cnt>=0;cnt--)
{
double delitel=High[cnt]-Low[cnt];
if (delitel>0) ExtMapBuffer5[cnt]=(Close[cnt]-Low[cnt])/delitel;
else ExtMapBuffer5[cnt]=0.0;
}
for(cnt=limit;cnt>=0;cnt--)
{
ExtMapBuffer0[cnt]=iMAOnArray(ExtMapBuffer5,0,Per,0,MODE_SMA,cnt)*100.0;
}
for(cnt=limit; cnt>=0;cnt--)
{
n_max=ArrayMaximum(ExtMapBuffer0,RangePeriod,cnt);
n_min=ArrayMinimum(ExtMapBuffer0,RangePeriod,cnt);
ExtMapBuffer3[cnt]=ExtMapBuffer0[n_max];
ExtMapBuffer4[cnt]=ExtMapBuffer0[n_min];
}
for(cnt=limit1; cnt>=0;cnt--)
{
ExtMapBuffer1[cnt]=iMAOnArray(ExtMapBuffer3,0,SmoothPeriod,0,SmoothMode,cnt);
ExtMapBuffer2[cnt]=iMAOnArray(ExtMapBuffer4,0,SmoothPeriod,0,SmoothMode,cnt);
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments