NR7 Paintbar for Think or Swim

nr7_paintbar

Here is a Thinkscript indicator to flag if a bar is an NR7 (narrowest range bar in the last 7 bars). I first read about them back in the day on TraderMike’s site. Usually, decreasing volatility and range foreshadows increasing volatility and range. An NR7 can alert you to this pause in price movement. In this indicator, a yellow dot above the bar signifies that the bar is NR7.

Here is the code:

# NR7 Paintbar
# By Prospectus @ https://readtheprospectus.wordpress.com
#
def range = high – low;
def na=double.nan;
#
# Define how you want the value plotted.
# I chose 30% of bar range above the bar high.
# Change plotter to whatever you want to customize it.
#
def plotter=high+range*0.3;
#
# Define an NR7–narrowest in the last 7 bars (including itself):
#
def isnr7 = (range <= range[1] and range <= range[2] and range <= range[3] and range <= range[4] and range <= range[5] and range <= range[6]);
#
# Define the plot:
# (Will paint if NR7, no paint if not)
#
plot nr7 = if isnr7 then plotter else na;
#
# Formatting:
#
nr7.SetDefaultColor(Color.yellow);
nr7.setstyle(curve.points);
nr7.setlineWeight(3);

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: