STARC Bands_v1

Download script
Author: Copyright � 2005, scorpion@fxfisherman.com
STARC Bands_v1

This tool is designed to provide a visual roadmap of market price action by identifying the "center" of the current trend and its surrounding boundaries. By analyzing historical price data, it generates three distinct lines on your trading chart to help you visualize price volatility and potential equilibrium points.

How the Logic Works

The script operates based on three core components:

1. The Baseline (Moving Average) At its heart, the tool calculates a "Middle" line. It looks back at a specific number of previous price candles and calculates a smoothed average of their closing prices. This represents the current momentum; if the market is trending up, this line climbs, and if it is falling, the line drops. It acts as the primary anchor for all other calculations.

2. Measuring Market Volatility (ATR) To determine how wide the "bands" should be, the tool measures the recent range of price movement—specifically, how much the price has been swinging up and down over a set period. This ensures that the bands expand during times of high market activity (high volatility) and tighten during quieter periods (low volatility).

3. Defining the Boundaries (Upper and Lower Bands) The tool then projects two outer lines (the Upper and Lower bands) based on the Baseline and the Volatility measurements:

  • The Upper Band: This is created by adding a specific multiplier of the volatility to the Baseline. It represents a "ceiling" or an overextended price point.
  • The Lower Band: This is created by subtracting that same multiplier from the Baseline. It represents a "floor" or a bottomed-out price point.

Summary for Traders

By combining these three elements, the script creates a dynamic "channel." The space between the Upper and Lower bands represents the normal range of market movement. When the price stays within these bands, the market is behaving normally according to its recent history. When the price pushes toward or beyond these boundaries, it signals that the market is reaching an extreme point relative to its average behavior.

Indicators Used
Moving average indicatorIndicator of the average true range
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
STARC Bands_v1
//+------------------------------------------------------------------+
//| STARCBands.mq4                                                   |
//| Copyright © 2005, scorpion@fxfisherman.com                       |
//| http://www.fxfisherman.com/                                      |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, scorpion@fxfisherman.com"
#property link "http://www.fxfisherman.com/"

#property indicator_chart_window
#property indicator_buffers 3

//---- indicator parameters
extern int MA_Period=13;
extern int ATR_Period=21;
extern double KATR=2;
extern int Shift=1;
extern color UpperColor=Red;
extern color MiddleColor=Red;
extern color LowerColor=Red;

//---- buffers
double MovingBuffer[];
double UpperBuffer[];
double LowerBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
  //---- indicators
  SetIndexStyle(0,DRAW_LINE,0,1,MiddleColor);
  SetIndexBuffer(0,MovingBuffer);
  SetIndexStyle(1,DRAW_LINE,0,3,UpperColor);
  SetIndexBuffer(1,UpperBuffer);
  SetIndexStyle(2,DRAW_LINE,0,3,LowerColor);
  SetIndexBuffer(2,LowerBuffer);
  //----
  SetIndexDrawBegin(0,MA_Period+Shift);
  SetIndexDrawBegin(1,ATR_Period+Shift);
  SetIndexDrawBegin(2,ATR_Period+Shift);
  //----
  return(0);
}

//+------------------------------------------------------------------+
//| Bollinger Bands |
//+------------------------------------------------------------------+
int start()
{
  int i,k,counted_bars=IndicatorCounted();
  
  //----
  if(Bars<=MA_Period) return(0);
  
  //---- initial zero
  if(counted_bars<1)
  for(i=1;i<=MA_Period;i++)
  {
    MovingBuffer[Bars-i]=EMPTY_VALUE;
    UpperBuffer[Bars-i]=EMPTY_VALUE;
    LowerBuffer[Bars-i]=EMPTY_VALUE;
  }
  
  //----
  int limit=Bars-counted_bars;
  if(counted_bars>0) limit++;
  for(i=0; i<limit; i++)
  {
    MovingBuffer[i] = iMA(NULL,0,MA_Period,Shift,MODE_EMA,PRICE_CLOSE,i);
    UpperBuffer[i] = MovingBuffer[i] + (KATR * iATR(NULL,0,ATR_Period,i+Shift));
    LowerBuffer[i] = MovingBuffer[i] - (KATR * iATR(NULL,0,ATR_Period,i+Shift));
  }
  
  //----
  return(0);
}

//+----------scorpion@fxfisherman.com--------------------------------+

Comments