$ROLLING_RANGE
Download scriptOverview of the Rolling Range Indicator
The Rolling Range is a specialized technical analysis tool designed to measure and visualize price momentum over a specific, customizable timeframe. Instead of looking at every minor fluctuation in the market, this indicator simplifies the data into a clear representation of how far the price has moved from a fixed starting point in the past.
How It Works
The logic behind this script follows a straightforward three-step process to calculate "price distance":
1. Establishing the Reference Points The indicator looks at two specific moments in time on your chart:
- The Current Price: It identifies where the market is trading right now (the most recent closing price).
- The Historical Starting Point: Based on a user-defined setting (the number of "Bars Ago"), it identifies a specific opening price from the past.
2. Calculating the Distance (The "Range") Once these two points are identified, the script calculates the mathematical difference between them. It measures how much the price has increased or decreased from that historical starting point up to the current moment.
To ensure this measurement is practical for trading, the result is converted into "Points"—the smallest unit of price movement available in your specific market (such as pips or ticks).
3. Visualizing the Movement The final result is plotted on your chart as a continuous line. This line represents the net change in price over your chosen window.
Key Takeaways for Traders
- Momentum Tracking: By observing the height and direction of the line, you can quickly see how aggressively the market is moving relative to where it started a few bars ago.
- Customizable Sensitivity: You have control over the "memory" of the indicator. By adjusting the Bars Ago setting, you can choose whether you want to see the price range relative to the very recent past (short-term momentum) or a broader historical window (medium-term trends).
- Simplified Analysis: The tool filters out the "noise" of minor price ticks and focuses purely on the net displacement of the market over your chosen duration.
//+------------------------------------------------------------------+
//| $ROLLING_RANGE |
//| |
//| |
//| Copyright © 2008, Avery T. Horton, Jr. aka TheRumpledOne |
//| |
//| PO BOX 43575, TUCSON, AZ 85733 |
//| |
//| GIFT AND DONATIONS ACCEPTED |
//| |
//| therumpldone@gmail.com |
//+------------------------------------------------------------------+
//| |
//| go to www.kreslik.com for the latest indicator updates |
//+------------------------------------------------------------------+
//| |
//| Use www.efxgroup.com as your forex broker... |
//| ...tell them therumpledone sent you! |
//+------------------------------------------------------------------+
#property copyright "Avery T. Horton, Jr. aka TheRumpledOne © 2008"
#property link "www.kreslik.com"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 White
//---- input parameters
//extern int myPeriod = 5 ;
extern int myBarsAgo = 5 ;
//---- buffers
double _Value[];
double cClose, pOpen, xDiff;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(1);
SetIndexBuffer(0,_Value);
SetIndexStyle(0,DRAW_LINE);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
cClose = iClose(NULL,0,0) ;
pOpen = iOpen(NULL,0,myBarsAgo) ;
xDiff = (cClose - pOpen) / Point ;
/*
if ( xDiff > myBarsAgo ) _Value[0] = 1; else {
if ( xDiff < myBarsAgo ) _Value[0] = -1; else _Value[0] = 0; }
*/
_Value[0] = xDiff;
return( 0 );
}
//+------------------------------------------------------------------+
Comments