nr4id-atr_761

Download script
Author: Rosh
nr4id-atr_761

This indicator is designed to identify specific price action patterns by analyzing the relationship between current market movement and historical volatility. It functions by scanning past price bars to find moments where the market exhibits a unique "quiet" or "contained" behavior relative to the recent trend.

Core Logic and Methodology

The script operates based on three primary conditions that must be met simultaneously for a signal to appear:

1. Price Containment (Inside Bar Detection) The first step the tool performs is identifying an "inside bar." It looks for instances where the high and low of the current candle are both lower than the previous candle's high and higher than its previous candle's low. Essentially, it filters for moments where the price range has contracted, suggesting a period of consolidation or indecision in the market.

2. Volatility Comparison (ATR Analysis) Once a contained bar is found, the script evaluates the "Average True Range" (ATR)—a standard measure of market volatility. It looks at the current candle's volatility and compares it against a specific window of previous candles (defined by the user).

3. Identifying Minimum Volatility The logic specifically seeks out the "minimum" point of volatility within that lookback period. If the current contained bar represents the lowest amount of volatility compared to the preceding bars, the tool marks this as a significant point of interest.

Visual Output

When all these conditions are met—meaning the price has contracted into an inside bar and that specific bar represents the lowest volatility in the recent timeframe—the indicator places a visual marker (a red arrow) on the chart. This signal is plotted at the exact midpoint of that specific candle's high and low prices.

Summary for Traders

In plain terms, this tool helps filter out "noisy" price action. Instead of reacting to every movement, it highlights moments where the market has tightened significantly and reached a state of relative calm compared to the immediate past. It identifies these "low-energy" zones, which traders often use to anticipate upcoming breakouts or trend reversals.

Indicators Used
Indicator of the average true range
Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
nr4id-atr_761
//+------------------------------------------------------------------+
//|                                                    NR4ID-ATR.mq4 |
//|                                                             Rosh |
//|                                    http://forexsystems.ru/phpBB/ |
//+------------------------------------------------------------------+
#property copyright "Rosh"
#property link      "http://forexsystems.ru/phpBB/"
//----
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- input parameters
extern int       PerATR=1;
extern int       PerNR=4;
//---- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,108);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   double tempval,minATR,currATR;
   int counted_bars=IndicatorCounted();
//---- 
   if (counted_bars==0) limit=Bars-MathMax(PerNR,PerATR);
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) limit=Bars-counted_bars;
   limit--;
//---- main loop
   for(int i=limit; i>=0; i--)
     {
      tempval=0.0;
      if ((High[i]<High[i+1])&&(Low[i]>Low[i+1]))
        {
         minATR=iATR(NULL,0,PerATR,i);
         for(int cnt=i+1;cnt<i+PerNR;cnt++)
           {
            currATR=iATR(NULL,0,PerATR,cnt);
            if (currATR<minATR) minATR=currATR;
           }
         if (minATR==iATR(NULL,0,PerATR,i))   tempval=(High[i]+Low[i])/2;
        }
      ExtMapBuffer1[i]= tempval;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments