Author: Copyright @ 2011, downspin
BOBB_V1

This tool is designed to provide traders with a visual representation of price volatility and its relationship to a specific moving average. Instead of plotting the standard Bollinger Bands directly on the main price chart, this script isolates specific mathematical behaviors into a separate window, making it easier to identify whether current market movements are "extreme" compared to recent history.

Core Logic Overview

The indicator works by calculating how much the current market price deviates from a smoothed average over a set period (the "Bands Period"). It breaks down the data into three primary components:

  • The Moving Average Basis: The script first establishes a baseline by calculating a simple moving average of the closing prices. This represents the "normal" trend of the asset over the chosen timeframe.
  • Volatility Measurement (Standard Deviation): The tool calculates the mathematical variance between the current price and that moving average. By looking at how much the price has "swung" away from the average in the recent past, it determines a volatility score. This is used to set the boundaries for what is considered an unusual price movement.
  • Distance Calculation: Rather than just showing you the bands, the script calculates the specific distance of the current price from that moving average, adjusted by the volatility.

How it Visualizes Data

The logic produces three distinct data streams displayed in a separate window:

  1. Price Deviation: It measures how far the current price is pushed above or below the moving average relative to the current market volatility.
  2. Symmetrical Opposites: It provides mirrored calculations to help traders see the relationship between upward and downward pressure.
  3. Volatility Scaling: By dividing these values by the smallest price unit (Points), it scales the visual data so that it is easy to read regardless of whether you are trading a high-value currency pair or a low-cost asset.

Summary for Traders

In essence, this script acts as an "exaggerator" of market behavior. When the lines in the indicator window move significantly far from the center, it signals that the price is reaching an extreme point relative to its recent history. It allows you to see at a glance if the market is overextended or if it is behaving within normal bounds, helping to identify potential reversal points or periods of high instability.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
BOBB_V1
//+------------------------------------------------------------------+
//|                                                      BOBB_V1.mq4 |
//|                                         Based On Bollinger Bands |
//|                                                   mg@downspin.de |
//+------------------------------------------------------------------+
#property copyright "Copyright @ 2011, downspin"
#property link      "mg@downspin.de"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 DodgerBlue
#property indicator_color2 Red
#property indicator_color3 Orange
#property indicator_level2 0

extern int    BandsPeriod=20;
extern double BandsDeviations=1.0;

double val1[],
       val2[],
       dev[];

int init(){
  SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,val1);
  SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,val2);
  SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,dev);
  return(0);
}

int deinit(){return(0);}

int start(){
  double sum,ma;
  for(int i=Bars-IndicatorCounted();i>=0;i--){
    ma=iMA(NULL,0,BandsPeriod,0,MODE_SMA,PRICE_CLOSE,i);
    sum=0.0;
    for(int k=i+BandsPeriod-1;k>=i;k--) sum+=MathPow(Close[k]-ma,2);
    dev[i]=BandsDeviations*MathSqrt(sum/BandsPeriod)/Point;
    val1[i]=(Close[i]-ma)/Point-dev[i];
    val2[i]=(ma-Close[i])/Point-dev[i];
  }
  return(0);
}

Comments