InnBar_mtf
Download scriptThis tool is designed to identify specific price action patterns known as "Inside Bars" across different timeframes. Its primary purpose is to highlight moments where the price range of a current candle is completely contained within the previous candle's range, which many traders use as a signal of market consolidation or a potential upcoming breakout.
Core Logic and Functionality
The script works by scanning historical price data to compare the highest and lowest points of consecutive candles. Here is the step-by-* Multi-Timeframe Analysis: The tool allows you to monitor these patterns on a higher timeframe than the one you are currently viewing on your chart. For example, while you may be looking at a 5-minute chart, the script can be configured to identify Inside Bars occurring on a 1-hour or daily chart. If the chosen timeframe is smaller than your current view, the script automatically adjusts to your current chart settings to ensure data consistency.
-
Pattern Detection: The logic identifies an "Inside Bar" by checking if the "high" of the current candle is lower than the "high" of the previous candle, and simultaneously, if the "low" of the current candle is higher than the "low" of the previous candle. When both conditions are met, it confirms that the current price action is staying within the boundaries established by the preceding period.
-
Visual Representation: Instead of cluttering your chart with complex lines or moving averages, the script uses a clean, visual approach. It places distinct dots (arrows) on the chart at the exact high and low points of the identified Inside Bars. These are displayed in contrasting colors (Magenta and Medium Violet Red) to make them easily visible to the user.
How it assists the trader
By automatically scanning for these specific price boundaries, the tool removes the manual effort of comparing candle highs and lows across different timeframes. It provides a clear visual cue of "coiled" market activity, helping you spot areas where the market may be preparing for a significant move in either direction.
//+------------------------------------------------------------------+
//| DOSR_Dots.mq4 |
//| Kalenzo |
//| http://www.fxservice.eu |
//+------------------------------------------------------------------+
//mod InnBar mtf
#property copyright "Kalenzo"
#property link "http://www.fxservice.eu"
#property indicator_buffers 2
#property indicator_color1 Magenta
#property indicator_color2 MediumVioletRed
#property indicator_width1 2
#property indicator_width2 2
double val1[];
double val2[];
extern int tf=60;
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexBuffer(0,val1);
SetIndexBuffer(1,val2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(0,158);
SetIndexArrow(1,158);
SetIndexEmptyValue(0,EMPTY_VALUE);
SetIndexEmptyValue(1,EMPTY_VALUE);
SetIndexLabel(0,"insideBar Hi");
SetIndexLabel(1,"insideBar Lo");
if (tf<Period())tf=Period();
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i,bs,limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
limit=MathMax(limit,tf/Period());
for(i=0; i<limit; i++)
{
bs = iBarShift(Symbol(),tf,Time[i]);
double H1 = iHigh(Symbol(),tf,bs+1);
double L1 = iLow(Symbol(),tf,bs+1);
double H = iHigh(Symbol(),tf,bs);
double L = iLow(Symbol(),tf,bs);
if ((H1>H)&&(L1<L))
{
val1[i]=H; val2[i]=L;
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments