Author: Copyright @ 2011, downspin
BOBB_V2

This script is a custom technical analysis tool designed to visualize market volatility and price movement trends relative to an average price point. Rather than displaying directly on the main price chart, it generates its own dedicated window below the chart to provide a clearer view of how the asset is behaving compared to its recent history.

Core Logic and Components

The script operates by analyzing three primary layers of data:

1. The Baseline Reference (Moving Average) The logic begins by calculating a "base" price point, which represents the average price of the asset over a specific period (set by the user). This acts as the equilibrium point from which all other measurements are derived.

2. Deviation Analysis (Volatility) Once the average price is established, the script calculates how far the current price has strayed from that average. It specifically measures "Standard Deviation," which is a mathematical way to determine if the market is moving in an unusually large way compared to its recent behavior. By measuring these fluctuations, the tool helps identify whether the market is experiencing calm stability or high-intensity volatility.

3. The Weighted Value Calculation Finally, the script transforms this raw price data into three distinct visual lines:

  • Primary Value: This shows the immediate distance between the current price and the baseline average, adjusted to a readable scale.
  • Smoothing Layer: The script takes that primary value and blends it with previous data points to create a smoother trend line. This helps filter out "market noise" (minor, insignificant price flickers) so you can see the broader direction of the move.
  • Standard Deviation Overlay: It plots the calculated volatility levels, allowing you to see at a glance how "stretched" the price is away from its norm.

How it works for the user

In practical terms, this script takes complex raw price data and converts it into a smoothed visual map of market momentum. Instead of looking at messy price candles, you are looking at a representation of "distance" and "speed." It highlights where the price is overextending itself and helps identify when the market is becoming increasingly unstable or returning to its average state.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
BOBB_V2
//+------------------------------------------------------------------+
//|                                                      BOBB_v2.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;
extern int MA_Period=9;

double val[],
       MA[],
       dev[];

int init(){
  SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,val);
  SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,MA);
  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;
    val[i]=(Close[i]-ma)/Point;
    MA[i]=val[i]/MA_Period;
    for(int o=1;o<MA_Period;o++) MA[i]+=val[i+o]/MA_Period;
  }
  return(0);
}

Comments