BB_Support_Up

Download script
Author: Copyright � 2010, basisforex@gmail.com
BB_Support_Up

This tool is designed to provide traders with a comprehensive visual overview of market volatility and price boundaries across multiple timeframes simultaneously. By consolidating various layers of data into a single chart window, it helps users identify significant support and resistance levels without having to switch between different charts manually.

Core Functionality

The logic operates by calculating Bollinger Bands—a technical analysis tool used to measure market volatility—across four distinct dimensions of time. Rather than showing just one set of bands for the current chart you are viewing, this script projects data from three higher-order timeframes onto your current screen.

How it Works

  • Multi-Timeframe Analysis: The script automatically identifies the appropriate "next steps" in time based on your current view (e.g., if you are on a 5-minute chart, it pulls data from 15-minute, 1-hour, and 4-hour charts). It then maps these larger trends onto your small-scale chart.
  • Upper and Lower Boundaries: For every timeframe analyzed, the script generates two distinct lines:
    • Upper Bands: These represent the ceiling of price action based on volatility.
    • Lower Bands: These represent the floor or "support" levels of price action.
  • Visual Differentiation: To ensure the trader can distinguish between these different layers of data, the script uses a color-coded system:
    • Yellow: Represents the nearest higher timeframe.
    • Blue: Represents the intermediate higher timeframe.
    • Black: Represents the broadest, long-term timeframe.

Practical Application for Traders

By displaying these multiple sets of bands at once, the script allows you to see "confluence." For example, if a price is approaching a Black line (long-term) and a Blue line (medium-term) at the same time, it suggests a high-probability zone where the market may react.

In essence, this tool simplifies complex market analysis by providing a "big picture" perspective, allowing you to see how immediate price movements relate to much larger historical trends in one cohesive visual layout.

Indicators Used
Bollinger bands indicator
Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
BB_Support_Up
/*------------------------------------------------------------------+
 |                                                BB_Support_Up.mq4 |
 |                                                 Copyright © 2010 |
 |                                             basisforex@gmail.com |
 +------------------------------------------------------------------*/
#property copyright "Copyright © 2010, basisforex@gmail.com"
#property link      "basisforex@gmail.com"
//-----
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 White
#property indicator_color2 Yellow
#property indicator_color3 Blue
#property indicator_color4 Black
#property indicator_color5 White
#property indicator_color6 Yellow
#property indicator_color7 Blue
#property indicator_color8 Black
//-----
extern int        n0Period    = 20;
extern int        n0Deviation = 2;
extern int        n1Period    = 20;
extern int        n1Deviation = 2;
extern int        n2Period    = 20;
extern int        n2Deviation = 2;
extern int        n3Period    = 20;
extern int        n3Deviation = 2;
//-----
extern int        MaShift     = 0;
extern int        PRICE_Ma    = 6;
//-----
double U0[];
double U1[];
double U2[];
double U3[];
double D0[];
double D1[];
double D2[];
double D3[];
//+------------------------------------------------------------------+
int init()
 {
   SetIndexShift(0, MaShift);
   SetIndexShift(1, MaShift);
   SetIndexShift(2, MaShift);
   SetIndexShift(3, MaShift);
   SetIndexShift(4, MaShift);
   SetIndexShift(5, MaShift);
   SetIndexShift(6, MaShift);
   SetIndexShift(7, MaShift);
   //-----
   SetIndexBuffer(0, U0);
   SetIndexBuffer(1, U1);
   SetIndexBuffer(2, U2);
   SetIndexBuffer(3, U3);
   SetIndexBuffer(4, D0);
   SetIndexBuffer(5, D1);
   SetIndexBuffer(6, D2);
   SetIndexBuffer(7, D3);
   //-----
   SetIndexStyle(0, DRAW_LINE);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexStyle(2, DRAW_LINE);
   SetIndexStyle(3, DRAW_LINE);
   SetIndexStyle(4, DRAW_LINE);
   SetIndexStyle(5, DRAW_LINE);
   SetIndexStyle(6, DRAW_LINE);
   SetIndexStyle(7, DRAW_LINE);
   //-----
   return(0);
 }
//+------------------------------------------------------------------+
string GetNextTF(int curTF)
 {
   switch(curTF)
    {
      case 1:
        return("5=15#30");
        break;
      case 5:
        return("15=30#60");
        break; 
      case 15:
        return("30=60#240");
        break;
      case 30:
        return("60=240#1440");
        break;
      case 60:
        return("240=1440#10080");
        break;
      case 240:
        return("1440=10080#43200");
        break;        
    }
 }
//+------------------------------------------------------------------+
int start()
 {
   int limit;
   int counted_bars = IndicatorCounted();
   if(counted_bars < 0) return(-1);
   if(counted_bars > 0) counted_bars--;
   limit = Bars - counted_bars;
   string T = GetNextTF(Period());
   int tf1 = StrToDouble(StringSubstr(T, 0, StringFind(T, "=", 0)));
   int tf2 = StrToDouble(StringSubstr(T, StringFind(T, "=", 0) + 1, StringFind(T, "#", 0)));
   int tf3 = StrToDouble(StringSubstr(T, StringFind(T, "#", 0) + 1, StringLen(T)));
   Comment(tf1, " Yellow  ", "\n", tf2, " Blue ", "\n", tf3, " Black");
   for(int i = 0; i < limit; i++)
    {
      U0[i]   = iBands(NULL, Period(), n0Period, n0Deviation, 0, PRICE_Ma, MODE_UPPER, i);
      U1[i]   = iBands(NULL, tf1, n1Period, n1Deviation, 0, PRICE_Ma, MODE_UPPER, i / (tf1 / Period()));
      U2[i]   = iBands(NULL, tf2, n2Period, n2Deviation, 0, PRICE_Ma, MODE_UPPER, i / (tf2 / Period()));
      U3[i]   = iBands(NULL, tf3, n3Period, n3Deviation, 0, PRICE_Ma, MODE_UPPER, i / (tf3 / Period()));
      //-----
      D0[i]  = iBands(NULL, Period(), n0Period, n0Deviation, 0, PRICE_Ma, MODE_LOWER, i);
      D1[i]  = iBands(NULL, tf1, n1Period, n1Deviation, 0, PRICE_Ma, MODE_LOWER, i / (tf1 / Period()));
      D2[i]  = iBands(NULL, tf2, n2Period, n2Deviation, 0, PRICE_Ma, MODE_LOWER, i / (tf2 / Period()));
      D3[i]  = iBands(NULL, tf3, n3Period, n3Deviation, 0, PRICE_Ma, MODE_LOWER, i / (tf3 / Period()));
    }    
   //-----
   return(0);
 }
//+------------------------------------------------------------------+

Comments