InnOutBar_mtf_v1

Download script
Author: Kalenzo
InnOutBar_mtf_v1

This tool is designed to act as a visual signal on your trading charts, identifying specific structural movements in price action by comparing current data against a higher timeframe. Instead of looking only at the immediate price fluctuations, it analyzes how the "higher" price bars are forming relative to one another to identify significant expansion or contraction.

Core Logic and Functionality

The script operates by looking at two distinct categories of price movement:

1. Internal Expansion (High/Low Inclusion) The tool monitors instances where a candle's range is completely contained within the previous higher timeframe candle. When this occurs, it flags a specific type of internal activity. It looks for moments where the high of the current bar is lower than the previous high, and the low of the current bar is higher than the previous low. This effectively identifies a "narrowing" or "internalizing" of price movement.

2. External Expansion (Breakout/Expansion) Conversely, the script identifies moments when the price breaks out of the boundaries established by the previous higher timeframe candle. It looks for scenarios where the current bar's high is greater than the previous high, while simultaneously its low is also lower than the previous low. This signifies a significant "expansion" or "breakout" in price movement across both directions.

Visual Representation

The indicator translates these logical conditions into visual markers on your chart:

  • Input/Internal Signals: When the price shows internal containment (the first logic mentioned), it places specific colored dots to alert you to this consolidation.
  • Output/External Signals: When the price breaks out of the previous boundaries, it places a different set of colored dots to highlight the expansion.

Multi-Timeframe Awareness

One of the key features of this script is its ability to look "ahead" into a larger timeframe than what you currently have on your screen. By using a user-definable timeframe setting (such as one hour), the tool can project these signals onto your current chart. This allows traders to see how much "room" the price has left within a larger structural cycle without having to manually switch back and forth between different charts.

Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
Miscellaneous
Implements a curve of type %1
16 Views
0 Downloads
0 Favorites
InnOutBar_mtf_v1
//+------------------------------------------------------------------+
//|                                                    DOSR_Dots.mq4 |
//|                                                          Kalenzo |
//|                                          http://www.fxservice.eu |
//+------------------------------------------------------------------+
//mod InnOutBar mtf
#property copyright "Kalenzo"
#property link      "http://www.fxservice.eu"
#property indicator_buffers 4
#property indicator_color1 Magenta
#property indicator_color2 MediumVioletRed
#property indicator_color3 DodgerBlue
#property indicator_color4 RoyalBlue
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
//----
double val1[];
double val2[];
double val3[];
double val4[];
//----
extern int tf=60;
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexBuffer(0,val1);
   SetIndexBuffer(1,val2);
   SetIndexBuffer(2,val3);
   SetIndexBuffer(3,val4);
   //
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexStyle(3,DRAW_ARROW);
   //
   SetIndexArrow(0,158);
   SetIndexArrow(1,158);
   SetIndexArrow(2,158);
   SetIndexArrow(3,158);
   //
   SetIndexEmptyValue(0,EMPTY_VALUE);
   SetIndexEmptyValue(1,EMPTY_VALUE);
   SetIndexEmptyValue(2,EMPTY_VALUE);
   SetIndexEmptyValue(3,EMPTY_VALUE);
   //
   SetIndexLabel(0,"in hi");
   SetIndexLabel(1,"in lo");
   SetIndexLabel(2,"out hi");
   SetIndexLabel(3,"out lo");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars+(tf/Period());
//----
   for(int i=0; i<limit; i++)
     {
      int 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;
        }
      if ((H1<H)&&(L1>L))
        {
         val3[i]=H; val4[i]=L;
        }
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments