stochbolli

This tool is designed to provide a specialized visual analysis of market momentum by layering two well-known technical indicators into a single combined view. Instead of looking at price movements directly, this script focuses on the "strength" of the price movement and then applies a volatility filter over that strength.

How the Logic Works

1. The Foundation: Stochastic Momentum The core layer of this indicator is based on the Stochastic Oscillator. In simple terms, this identifies where the current price sits relative to its recent high and low range. It helps traders understand if a market is "overbought" (moving too fast in one direction) or "oversold" (moving too fast in the opposite direction).

2. The Overlay: Bollinger Band Analysis The unique logic of this script lies in what it does next. Instead of applying standard volatility bands to the actual price of an asset, it applies Bollinger Bands directly to the Stochastic values.

By doing this, the indicator creates a "channel" around the momentum line. This allows you to see not just where the momentum is, but whether that momentum is behaving normally or if it is reaching extreme, volatile limits.

What the Visuals Represent

  • The Momentum Line: This represents the primary flow of the market's strength.
  • The Upper and Lower Boundaries: These act as "envelopes." When the momentum line touches or breaks through these boundaries, it suggests that the current price movement is reaching an extreme level based on recent volatility.
  • The Middle Line: This serves as a baseline for the momentum, helping to identify the average trend of the oscillator's movement.

Summary for the User

In essence, this script functions as a "volatility filter for momentum." It helps you visualize when the market’s internal strength is stretching too far in one direction. Rather than just telling you if a price is high or low, it tells you if the speed and strength of the current move are becoming statistically unusual compared to recent history.

Indicators Used
Stochastic oscillator
Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
stochbolli
#property  copyright "Copyright © 2007, Matt Edmonds."
#property  link      "matt.edmonds@gmail.com"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 4
#property  indicator_color1  Yellow
#property  indicator_color2  White
#property  indicator_color3  White
#property  indicator_color4  White



extern int StochasticPeriod=1;
extern int BollingerPeriod=10;
extern int BollingerDeviation = 1;
extern int BollingerShift = 0;

extern int BarsToUse = 500;

//---- indicator buffers
double Stochastic[];
double BollingerUpper[];
double BollingerLower[];
double BollingerMiddle[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 2 additional buffers are used for counting.
   IndicatorBuffers(4);
   
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);
   SetIndexStyle(3,DRAW_LINE,STYLE_DOT,1);
   
   SetIndexBuffer(0,Stochastic);
   SetIndexLabel(0,"Stochastic Bollinger Bands");
   SetIndexBuffer(1,BollingerUpper);
   SetIndexBuffer(2,BollingerLower);
   SetIndexBuffer(3,BollingerMiddle);
   SetIndexLabel(3,"Bollinger Middle");
      
//---- name for DataWindow and indicator subwindow label
 IndicatorShortName("Stochastic Bollinger Bands");
   
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Calculations                                    |
//+------------------------------------------------------------------+
int start()
  {
 //  int limit;
   int i;
   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--;
 //  limit=Bars-counted_bars;
 
//---- main loop
   for(i=0; i<BarsToUse; i++)
   {
     Stochastic[i]= iStochastic(NULL, 0, StochasticPeriod, 1, 3, MODE_SMA, 0, MODE_MAIN, i);
    }
  
//---- done

   for(i=0; i<BarsToUse; i++)
   {  
     BollingerLower[i] = iBandsOnArray(Stochastic,0,BollingerPeriod,BollingerDeviation,BollingerShift,MODE_LOWER,i); 
     BollingerUpper[i] = iBandsOnArray(Stochastic,0,BollingerPeriod,BollingerDeviation,BollingerShift,MODE_UPPER,i); 
     BollingerMiddle[i] = iBandsOnArray(Stochastic,0,BollingerPeriod,BollingerDeviation,BollingerShift,MODE_MAIN,i); 
   }   
   
   return(0);
  }
//+------------------------------------------------------------------+



Comments