IBS_v1
Download scriptThe IBS (Important Bar Strength) indicator is a visual tool designed to measure the relative strength of price movement within specific time frames. Instead of looking at the raw price of an asset, this script evaluates the internal dynamics of individual candlesticks to help traders identify momentum and positioning.
How the Logic Works
The indicator operates through a two-step calculation process to translate price action into a readable percentage scale:
1. Identifying Relative Position (Candle Strength) First, the logic analyzes every individual candle on the chart. It determines where the closing price sits in relation to the high and low points of that specific candle. By calculating the distance between the close and the low relative to the total size of the candle's range, the script assigns a value based on how "strong" the move was.
- If a candle closes near its high, it represents strong bullish momentum.
- If a candle closes near its low, it represents bearish pressure.
- The result is essentially a localized percentage of where the price "settled" for that period.
2. Smoothing the Data (Trend Analysis) Because raw candle data can be volatile and "noisy," the script applies a smoothing technique to these individual percentages. It looks at a user-defined number of previous periods (the "Per" parameter) and calculates a Simple Moving Average of those strengths. This transforms erratic jumps into a flowing line, making it easier to see the underlying trend of momentum rather than just reacting to single outliers.
Visual Representation
The final output is displayed in a separate window beneath your main chart, ranging from 0 to 100. The indicator provides two key visual references:
- 40% Level: Often used as a baseline for moderate strength.
- 60% Level: Used to identify more pronounced momentum.
By observing where the smoothed line sits relative to these levels, traders can gain a clearer perspective on whether the current market sentiment is leaning toward buying pressure or selling pressure over a specific timeframe.
//+------------------------------------------------------------------+
//| 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