Narrow Range Day NR7 Indicator for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
This indicator identifies stocks with the narrowest high to low range for the past 7 days (NR7). Range contraction leads to range expansion.

Similar to the NR4 and Double Inside Day strategy, you can play the breakout when the stock move above the high of the narrow range day or short it when the stock breakdown from the low of the narrow range day.

yGVMdQp.png


thinkScript Code

Code:
# AI_Prospectus_NRx_Paintbar_with_NRx_2
#
# NR-X Paintbar
# By Prospectus
#
# AlphaInvestor - 11/19/2016 - Added NRX-2 (a la Bulkowski) if there are two NRX bars in a row
#
# Input the number of bars to check (default 7):
#
input x=7;
#
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 NR-X: narrowest in the last X bars (including itself):
#
def isnrX = if lowest(range,x-1)==range then 1 else 0;
#
# Define the plot:
# (Will paint if NR-X, no paint if not)
#
plot nrX = if isnrX then plotter else na;
#
# Formatting:
#
nrX.SetDefaultColor(Color.white);
nrX.setstyle(curve.points);
nrX.setlineWeight(1);

def plotter2=high+range*0.6;
plot nrX2 = if isnrx and isnrx[1] then plotter2 else na;
nrX2.SetDefaultColor(Color.yellow);
nrX2.setstyle(curve.points);
nrX2.setlineWeight(3);

# End Study

Shareable Link

https://tos.mx/6So0Xv
 

Attachments

  • yGVMdQp.png
    yGVMdQp.png
    76.1 KB · Views: 175

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

@Sammy800 I found this:

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);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
315 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top