NRTR_ATR_STOP

Download script
NRTR_ATR_STOP

This technical indicator is designed to provide a visual representation of market trends by identifying key reversal points based on price volatility. Rather than just following every minor price fluctuation, the logic focuses on capturing significant "swings" in the market to help traders see the broader direction of the price movement.

How the Logic Works

1. Volatility-Based Buffering The script utilizes a specific measurement called the Average True Range (ATR) to determine how much the market typically moves. By multiplying this value by a user-defined coefficient, the tool establishes a "buffer zone." This ensures that the indicator doesn't react to insignificant noise but instead waits for a price movement large enough to be considered a meaningful trend change.

2. Dynamic Trend Tracking The system operates like a toggle switch between two states: "UP" and "DOWN."

  • When in an Upward Trend, the script tracks the most recent significant "low" point.
  • When in a Downward Trend, it tracks the most recent significant "high" point.

3. Identifying Reversals The script constantly monitors the current price against the previous trend boundary:

  • If the market is currently in a downward trend but the price climbs above the established high boundary (plus the volatility buffer), the system recognizes a breakout. It then switches the mode to "Up" and creates a new baseline.
  • Conversely, if the market is in an upward trend but the price drops below the established low boundary (minus the volatility buffer), it recognizes a breakdown. It then switches the mode to "Down" and establishes a new high-side baseline.

4. Continuous Line Smoothing To keep the visual representation clean and professional, the indicator doesn't just jump from point to point. If the price remains within the current trend's boundaries (meaning no reversal has occurred), the script carries forward the previous level. This results in a "staircase" effect on your chart, where the lines remain flat during periods of stability and only shift when the market makes a significant move in the opposite direction.

Visual Representation

The result is two distinct colored lines on your chart:

  • One line represents the Support/Low boundaries (typically shown in Blue).
  • The other line represents the Resistance/High boundaries (typically shown in Red).

By observing these lines, a user can quickly see which direction the market "momentum" is currently favoring based on structural price changes rather than temporary fluctuations.

Indicators Used
Indicator of the average true range
12 Views
0 Downloads
0 Favorites
NRTR_ATR_STOP
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers  2
#property indicator_color1 Blue
#property indicator_color2 Red

extern int ATR=50;
extern int Coeficient=3;

double Up[],Dn[];
//+------------------------------------------------------------------+
int init()
{
  SetIndexBuffer(0,Up);
  SetIndexStyle (0,DRAW_LINE);
  SetIndexEmptyValue(0,0.0);
  SetIndexLabel (0,"Up");

  SetIndexBuffer(1,Dn);
  SetIndexStyle (1,DRAW_LINE);
  SetIndexEmptyValue(1,0.0);
  SetIndexLabel (1,"Dn");

  return(0);
}
int deinit() { return(0); }
//+------------------------------------------------------------------+
int start()
{
  int i,limit;
  double REZ;
  string MODE="UP";

  limit=Bars-ATR;
  for(i=limit; i>=0; i--)
  {
    Dn[i]=0; Up[i]=0;
    REZ=Coeficient*iATR(NULL,0,ATR,i);
    if(MODE=="DOWN" &&  Low[i]>Dn[i+1]) { Up[i+1]= Low[i+1]-REZ; MODE="UP";   }
    if(MODE=="UP"   && High[i]<Up[i+1]) { Dn[i+1]=High[i+1]+REZ; MODE="DOWN"; }

    if(MODE=="UP")
    {
      if(Low[i+1]>Up[i+1]+REZ) Up[i]=Low[i+1]-REZ;
		  else Up[i]=Up[i+1];
		}

    if(MODE=="DOWN")
    {
     	if(High[i+1]<Dn[i+1]-REZ) Dn[i]=High[i+1]+REZ;
	    else Dn[i]=Dn[i+1];
	  }
  }
  return(0);
}
//+------------------------------------------------------------------+

Comments