IBS
Download scriptThis technical tool is designed to provide traders with a visual representation of price positioning within specific candle ranges, smoothed over time to identify broader market trends. It functions by analyzing the relationship between where the price closes and the total range of price movement during each individual bar.
How the Logic Works
1. Determining Relative Price Position The core of this script begins by looking at each individual price candle. For every candle, it calculates the distance between the highest and lowest points reached. It then determines exactly where the closing price sits within that specific range. This effectively creates a percentage-based "location" score: if the price closes near the top of the candle's range, the value is high; if it closes near the bottom, the value is low.
2. Smoothing the Data Because individual candle movements can be volatile and "noisy," the script applies a mathematical smoothing process to these location scores. It takes the average position over a specific period (which can be customized by the user). This transformation turns erratic price movements into a fluid, continuous line.
3. Normalization for Clarity To make the data easier to read on a standard scale, the final result is scaled to a 0–100 range. This allows the trader to see a clear percentage of where the "average" closing price sits relative to the recent trading range.
Visual Interpretation
The indicator appears in a separate window below the main price chart. By observing the line's movement between the predefined levels (40 and 60), users can monitor market momentum:
- When the line trends toward the upper limits, it suggests that prices are closing consistently toward the top of their respective ranges.
- When the line trends toward the lower limits, it indicates that prices are closing closer to the bottom of their ranges.
- The smoothed nature of the line helps filter out minor fluctuations, allowing the user to focus on more significant shifts in market sentiment.
//+------------------------------------------------------------------+
//| IBS.mq4 |
//| Rosh |
//| http://www.investo.ru/forum/viewtopic.php?t=127513 |
//+------------------------------------------------------------------+
#property copyright "Rosh"
#property link "http://www.investo.ru/forum/viewtopic.php?t=127513"
//----
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 1
#property indicator_color1 Red
#property indicator_level1 40
#property indicator_level2 60
//---- input parameters
extern int Per=5;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
IndicatorShortName("IBS ("+Per+") ");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
int i,limit;
if (counted_bars==0) limit=Bars-1;
if (counted_bars>0) limit=Bars-counted_bars;
double delitel;
limit--;
for(i=limit;i>=0;i--)
{
delitel=High[i]-Low[i];
if (delitel>0) ExtMapBuffer2[i]=(Close[i]-Low[i])/delitel;
else ExtMapBuffer2[i]=0.0;
}
for(i=limit;i>=0;i--)
{
ExtMapBuffer1[i]=iMAOnArray(ExtMapBuffer2,0,Per,0,MODE_SMA,i)*100.0;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments