STARC Bands_v2

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

This technical tool is designed to provide traders with a visual representation of market volatility and trend direction directly on their trading charts. By analyzing historical price action, it calculates three distinct dynamic lines that form a "band" or "channel" around the current market price.

How the Logic Works

The core logic of this indicator relies on three primary components:

1. The Central Trend Line (Moving Average) At the heart of the tool is a moving average calculation. Instead of simply looking at the most recent price, it looks back at a specific number of previous data points (the "MA Period") to calculate a smoothed average price. This serves as the baseline, helping traders identify the general direction of the market—whether it is currently trending upward, downward, or remainingsideways.

2. The Volatility Measurement (ATR) To determine how wide the bands should be, the script uses an Average True Range (ATR) calculation. This measures how much the price typically fluctuates over a set period. By incorporating this, the tool ensures that the bands expand during periods of high market activity (high volatility) and contract during quieter market conditions.

3. The Dynamic Bands (Upper and Lower) The "bands" are created by taking the central trend line and adding or subtracting a multiple of the volatility measurement from it.

  • The Upper Band represents a price level set above the average, adjusted for current volatility.
  • The Lower Band represents a price level set below the average, also adjusted for current volatility.

Summary of Visual Output

When you view this on a chart, you see three lines moving in harmony:

  • A Middle Line representing the smoothed "fair value" of the asset.
  • An Upper and Lower Bound that creates a visual corridor.

The primary purpose of this logic is to help traders visualize the "normal" range of price movement. When prices stay within these bands, the market may be in a stable trend; when prices move toward or outside of these bounds, it can signal significant momentum shifts or potential exhaustion in the current price trend.

Indicators Used
Moving average indicatorIndicator of the average true range
Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
STARC Bands_v2
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//| 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=6;
extern int ATR_Period=15;
extern double KATR=2;
extern int Shift=1;
extern color UpperColor=Red;
extern color MiddleColor=White;
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,1,UpperColor);
  SetIndexBuffer(1,UpperBuffer);
  SetIndexStyle(2,DRAW_LINE,0,1,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