Percent Bollinger Bands_v1

Download script
Author: ��� ����� �. aka KimIV
Percent Bollinger Bands_v1

This tool is designed to provide traders with a unique perspective on price action by measuring where the current market price sits in relation to its recent volatility limits. Instead of showing traditional price lines, it calculates a relative percentage of "market position" within a specific trading range.

How the Logic Works

1. Defining the Volatility Boundaries The script looks at a set period of historical data (the "MA Period") to determine the market's current boundaries. It identifies two critical levels:

  • The Lower Limit: The floor of the recent price movement.
  • The Upper Limit: The ceiling of the recent price movement.

These boundaries are calculated based on standard deviations, which help filter out "noise" and identify where the price is reaching extreme highs or lows relative to its normal behavior.

2. Calculating the Relative Position Once the tool establishes the "floor" and the "ceiling," it performs a mathematical comparison for every price point on your chart. It takes the current closing price and determines exactly how far it has traveled from the bottom limit toward the top limit.

3. The Visual Output Rather than displaying complex overlapping lines, the result is expressed as a normalized value. This allows you to see the market's momentum in a simplified format:

  • If the value is near the bottom of its range, the price is trading close to its recent "floor."
  • If the value is toward the top, the price is pushing against its recent "ceiling."

Key Takeaways for Traders

By using this logic, you can more easily visualize "overextended" markets. It transforms standard volatility data into a clear picture of where the price currently lives within its immediate range. This helps in identifying whether the market is reaching an exhaustion point or if there is still significant room for movement in a specific direction.

Indicators Used
Bollinger bands indicator
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
Percent Bollinger Bands_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                      Percent Bollinger Bands.mq4 |
//|                                           Êèì Èãîðü Â. aka KimIV |
//|                                              http://www.kimiv.ru |
//+------------------------------------------------------------------+
#property copyright "Êèì Èãîðü Â. aka KimIV"
#property link      "http://www.kimiv.ru"

#property indicator_separate_window
//---- input parameters
extern int MA_Period=20;
extern int Deviation=2;
//---- indicator buffers
double ExtMapBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() {
  SetIndexStyle(0, DRAW_LINE);
  IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));
  SetIndexBuffer(0, ExtMapBuffer);
  return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
  int i, counted_bars = IndicatorCounted();
  double dn, up;
  if(Bars<=MA_Period) return(0);
//---- check for possible errors
  if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
  if (counted_bars>0) counted_bars--;
//---- 
  i = Bars - MA_Period - 1;
  if(counted_bars>=MA_Period) i = Bars - counted_bars - 1;
  while(i>=0) {
    dn = iBands(NULL,0,MA_Period,Deviation,0,PRICE_LOW,MODE_LOWER,i);
    up = iBands(NULL,0,MA_Period,Deviation,0,PRICE_HIGH,MODE_UPPER,i);
    ExtMapBuffer[i] = (Close[i] - dn) / (up - dn);
    i--;
  }
//----
  return(0);
}
//+------------------------------------------------------------------+

Comments