Author: IZZY
VTS_G2

This tool is designed to provide a visual representation of price dynamics by calculating specific volatility boundaries and identifying extreme price levels on a trading chart. Here is a breakdown of how the logic works in plain terms:

Core Concept: Volatility-Based Boundaries

The script begins by establishing two primary "buffer zones" around the current market price. It uses the Average True Range (ATR)—a common tool that measures how much a currency or asset typically moves over a specific period—to determine these levels.

By multiplying this measurement by a user-defined multiplier, the tool calculates an upper and lower boundary for each price candle. Think of these as "expected limits" based on current market volatility:

  • The Lower Boundary: The current closing price minus the volatility factor.
  • The Upper Boundary: The current closing price plus the volatility factor.

Recursive Price Extremes

The most unique aspect of this script is how it processes those boundaries once they are created. Instead of simply showing you a single line, the tool performs a series of consecutive mathematical comparisons between each new price point and the one preceding it.

It works like a "ladder" of filters:

  1. It compares the current lower boundary with the previous one to find the highest peak.
  2. It takes that result and compares it again to the next, repeatedly finding new highs and lows.
  3. This process repeats through eight distinct layers of calculations.

The Final Result

By running these comparisons over and over, the script effectively "smooths out" the noise of the market. It filters out minor price fluctuations to highlight significant structural shifts in the data.

For a trader, this means the visual output helps identify where price has historically struggled to break through or where it has reached a significant point of exhaustion. Rather than reacting to every small tick, the logic aims to show you the broader "envelope" of price action, helping to define the underlying structure of the market's movement.

Indicators Used
Indicator of the average true range
15 Views
0 Downloads
0 Favorites
VTS_G2
//+------------------------------------------------------------------+
//|                                                          VTS.mq4 |
//|                                                             IZZY |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "IZZY"
#property link      ""

#define MAXBARSCOUNT 15000

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Aqua
#property indicator_color2 Magenta
#property indicator_color3 Aqua
#property indicator_color4 Magenta
#property indicator_color5 Aqua
#property indicator_color6 Magenta
#property indicator_color7 Aqua
#property indicator_color8 Magenta
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
//extern int Sb = 300;
extern int    PeriodAtr = 10;
extern double kATR      = 2.0;

double VTS[MAXBARSCOUNT];
double VTS1[MAXBARSCOUNT];
double VTS2[MAXBARSCOUNT];
double VTS3[MAXBARSCOUNT];
double VTS4[MAXBARSCOUNT];
double VTS5[MAXBARSCOUNT];
double VTS6[MAXBARSCOUNT];
double VTS7[MAXBARSCOUNT];
double VTS8[MAXBARSCOUNT];
double VTS9[MAXBARSCOUNT];
double VTS10[MAXBARSCOUNT];
double VTS11[MAXBARSCOUNT];
double VTS12[MAXBARSCOUNT];
double VTS13[MAXBARSCOUNT];
double VTS14[MAXBARSCOUNT];
double VTS15[MAXBARSCOUNT];


int init()
  {
//---- indicators
   IndicatorBuffers(8);
   SetIndexBuffer(0, VTS8);
   SetIndexBuffer(1, VTS9);
   SetIndexBuffer(2, VTS10);
   SetIndexBuffer(3, VTS11);
   SetIndexBuffer(4, VTS12);
   SetIndexBuffer(5, VTS13);
   SetIndexBuffer(6, VTS14);
   SetIndexBuffer(7, VTS15);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int start()
  {
   int    counted_bars=IndicatorCounted();
//----   
   
int    StartBars = Bars - counted_bars+1;
   //if (StartBars<Sb) StartBars = Sb;
   for(int i = StartBars; i>=0; i--){
       VTS[i] = (Close[i]-kATR*iATR(NULL,0,PeriodAtr,i));
       VTS1[i]= (Close[i]+kATR*iATR(NULL,0,PeriodAtr,i));
       }
   for(i = StartBars-1; i>0; i--){
       VTS2[i]= MathMax(VTS[i],VTS[i+1]);
       VTS3[i]= MathMin(VTS1[i],VTS1[i+1]);
       VTS4[i]= MathMax(VTS2[i],VTS2[i+1]);//VTS2[i+1];
       VTS5[i]= MathMin(VTS3[i],VTS3[i+1]);//VTS3[i+1];
       VTS6[i]= MathMax(VTS4[i],VTS4[i+1]);//VTS4[i+1];
       VTS7[i]= MathMin(VTS5[i],VTS5[i+1]);//VTS5[i+1];
       VTS8[i]= MathMax(VTS6[i],VTS6[i+1]);//VTS6[i+1];
       VTS9[i]= MathMin(VTS7[i],VTS7[i+1]);//VTS7[i+1];
       VTS10[i]= MathMax(VTS8[i],VTS8[i+1]);//VTS8[i+1];
       VTS11[i]= MathMin(VTS9[i],VTS9[i+1]);//VTS9[i+1];
       VTS12[i]= MathMax(VTS10[i],VTS10[i+1]);//VTS10[i+1];
       VTS13[i]= MathMin(VTS11[i],VTS11[i+1]);//VTS11[i+1]; 
       VTS14[i]= MathMax(VTS12[i],VTS12[i+1]);//VTS10[i+1];
       VTS15[i]= MathMin(VTS13[i],VTS13[i+1]);//VTS11[i+1]; 
       }
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments