Scanning against DailyRelativeRange

PaulS

New member
VIP
I am trying to capture in my scans Daily Relative Range within 30% of the HOD but can't figure out how. I have tried scanning against the Price Near High Lows but that doesn't seem to withhold stocks lower than that 30% of HOD. I am trying to capture pullbacks within 30% of the HOD. My goal is to add it to my Baseline scan below.

My baseline scan

Price = .50 - 7.00
Volume > 500k
Custom "close greater than DailyOpen


Any recommendations would be welcome.
 
Solution
I am trying to capture in my scans Daily Relative Range within 30% of the HOD but can't figure out how. I have tried scanning against the Price Near High Lows but that doesn't seem to withhold stocks lower than that 30% of HOD. I am trying to capture pullbacks within 30% of the HOD. My goal is to add it to my Baseline scan below.


if you are looking for price to be within 30% of the HOD price, almost all stocks will trigger on almost every bar.

in the image below, it is set to 2.5%

here is a lower study that can be used in a scan (and testing)
set to 2.5%
Code:
# hod_within_xper_01_lower

#https://usethinkscript.com/threads/scanning-against-dailyrelativerange.13213/
#Scanning against DailyRelativeRange
#I am trying to...
I am trying to capture in my scans Daily Relative Range within 30% of the HOD but can't figure out how. I have tried scanning against the Price Near High Lows but that doesn't seem to withhold stocks lower than that 30% of HOD. I am trying to capture pullbacks within 30% of the HOD. My goal is to add it to my Baseline scan below.


if you are looking for price to be within 30% of the HOD price, almost all stocks will trigger on almost every bar.

in the image below, it is set to 2.5%

here is a lower study that can be used in a scan (and testing)
set to 2.5%
Code:
# hod_within_xper_01_lower

#https://usethinkscript.com/threads/scanning-against-dailyrelativerange.13213/
#Scanning against DailyRelativeRange
#I am trying to capture in my scans Daily Relative Range within 30% of the HOD


declare lower;

def na = double.nan;
def bn = barnumber();

input start = 0930;
input end = 1600;
def dayopen = if secondstillTime(start) == 0 then 1 else 0;

#find hod
def hod = if bn == 1 then high
else if dayopen then high
else if high > hod[1] then high
else hod[1];

#input hod_per = 30.0;
input hod_per = 2.5;
def hod_rng_low = hod * (1- (hod_per/100));

def pullback = between(close, hod_rng_low, hod);

plot z = pullback;

#plot zhod = hod;
#zhod.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#zhod.SetDefaultColor(Color.gray);
#zhod.hidebubble();

#plot zhodlow = hod_rng_low;
#zhodlow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#zhodlow.SetDefaultColor(Color.gray);
#zhodlow.hidebubble();

#def top = if pullback then hod else na;
#addcloud(top, hod_rng_low, color.light_gray);
#




an upper study for testing , set to 2.5%
Code:
# hod_within_xper_01_upper

#https://usethinkscript.com/threads/scanning-against-dailyrelativerange.13213/
#Scanning against DailyRelativeRange

#I am trying to capture in my scans Daily Relative Range within 30% of the HOD but can't figure out how. I have tried scanning against the Price Near High Lows but that doesn't seem to withhold stocks lower than that 30% of HOD.
#I am trying to capture pullbacks within 30% of the HOD. My goal is to add it to my Baseline scan below.

# my baseline scan
#Price = .50 - 7.00
#Volume > 500k
#Custom "close greater than DailyOpen


def na = double.nan;
def bn = barnumber();

input start = 0930;
input end = 1600;
def dayopen = if secondstillTime(start) == 0 then 1 else 0;

#find hod
def hod = if bn == 1 then high
else if dayopen then high
else if high > hod[1] then high
else hod[1];

input hod_per = 2.5;
#input hod_per = 30.0;
def hod_rng_low = hod * (1- (hod_per/100));

def pullback = between(close, hod_rng_low, hod);
#plot z = pullback;

plot zhod = hod;
zhod.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
zhod.SetDefaultColor(Color.gray);
zhod.hidebubble();

plot zhodlow = hod_rng_low;
zhodlow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
zhodlow.SetDefaultColor(Color.gray);
zhodlow.hidebubble();

def top = if pullback then hod else na;
addcloud(top, hod_rng_low, color.light_gray);
#

NIO 15min
set to 2.5%
BqrKwUZ.jpg




https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Others/Between
plot Between1 = Between(close, lowLimit, highLimit);


https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Look---Feel/AddCloud
AddCloud(hi, lo, Color.VIOLET, Color.PINK);
the rule will be:
. if hi > lo , then the cloud is violet
. if hi < lo , then the cloud is pink


https://www.investopedia.com/terms/p/pullback.asp
A pullback is a pause or moderate drop in a stock or commodities pricing chart from recent peaks that occur within a continuing uptrend.
 
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
475 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