# Range % change by daily bars

#### Mike12

##### New member
Hey guys could someone help me to code this:

price simple moving avarange in is for intraday . I would like to add to the option for daily
BARS.

Thanks!

Last edited:
Solution
Try this maybe

Code:
``````Input Days = 30;
Input Min = -8;
Input Max = 18;
def PC = ((Close - Close[Days]) / Close[Days]) * 100;
plot Scan = Between(PC, Min, Max);``````

#### Joshua

##### Well-known member
VIP
I don't quite understand the question. What do you mean by daily % range - my guess would be the range between the high and low, is this correct? If so, as a percentage of what exactly? It needs to be "anchored" to some value for comparison, for lack of a better word. The prior day's close might be a good candidate as its static throughout the day, but you may need to be more specific.

Either way, its not going to look like the picture. Custom script filters can not generate those types of +/- interface elements or the blue graph thing, but you can bring up a separate edit window that's more similar to editing the inputs/settings of a chart indicator.

#### Mike12

##### New member
amm....No. don't meaned for sma of the the bars.

Last edited:

#### Joshua

##### Well-known member
VIP
I still can't quite understand what you've written, but try this as a lower study, and see if it fits what you're after.
Try it on a daily chart of SPY, that's what I used to write it, the values in the graph should be easily visible there.

Code:
``````declare lower;
Input Days = 30;
Input Min = 5;
Input Max = 10;
plot PC1 = ((Close - Close[Days]) / Close[Days]) * 100;
plot Scan = Between(PC1, Min, Max);``````

#### Mike12

##### New member
Hi joshua, Thank you for replay.

I'm not looking for a Chart Study.
I'm looking for a script to scan.
this script not work when i insert it on (study edit).

#### Joshua

##### Well-known member
VIP
I understand, but first, I want you to look at this code as a chart study, so that you can see what is happening. Then, you can tell me if its right or wrong, or what needs to be changed. This code is only a guess, because I do not understand your original question.

#### Mike12

##### New member
Yes. i run it's as a chart study.
it's showing under the volume as a "zigzag" line.
it's not what i searh for. i also tray to run it as a scanner - not work.

#### Mike12

##### New member
I understand, but first, I want you to look at this code as a chart study, so that you can see what is happening. Then, you can tell me if its right or wrong, or what needs to be changed. This code is only a guess, because I do not understand your original question.
What you meaning "do not understand your original question" - I try to put it another way:

i just want to translate e - to script - for scanner - not for chart as a stusy.

Last edited:

#### Joshua

##### Well-known member
VIP
Try this maybe

Code:
``````Input Days = 30;
Input Min = -8;
Input Max = 18;
def PC = ((Close - Close[Days]) / Close[Days]) * 100;
plot Scan = Between(PC, Min, Max);``````

#### Mike12

##### New member
Cool... THX! checking....seam it's not work...
this script return the symbole "EFC" and many more..... - that decline over 20% in last 30 days.

Last edited:

#### Joshua

##### Well-known member
VIP
Assuming this is in fact what you're trying to do, check your settings; min, max, aggregation, etc.

Code:
``````declare upper;
Input Days = 30;
Input Min = -8;
Input Max = 18;
def PC = ((Close - Close[Days]) / Close[Days]) * 100;
plot Scan = Between(PC, Min, Max);

"Percent change over " + days + " days: " + PC
,color.blue);

"Min: " + Min
,color.blue);

"Max: " + Max
,color.blue);

"Shows up in scan: " + (if Scan then "Yes" else "No")
,color.blue);

plot start =
if !isNaN(Close[-(Days - 1)]) and isNaN(close[-Days]) then close
else if !isNaN(close) and isNaN(close[-1]) then close
else double.nan
;
start.enableApproximation();
start.setdefaultColor(color.blue);``````

ma 5,10,14

Last edited:

#### Mike12

##### New member
Is it possible to cancel the digits after the dot? so the number appears round?
Which lines in the code should be removing for removing the blue line under the chart? (except for set it not displayed in the settings)?

#### Joshua

##### Well-known member
VIP
Change "plot scan" to "def scan"

Change this:
"Percent change over " + days + " days: " + PC
to:
"Percent change over " + days + " days: " + Round(PC,0)

#### Mike12

##### New member
Change "plot scan" to "def scan"

Change this:
"Percent change over " + days + " days: " + PC
to:
"Percent change over " + days + " days: " + Round(PC,0)
awesome!! Thank you so much josua.

#### Mike12

##### New member
change from thef bars (include EXT hours)
e.g: for (change (include extended houres)

Last edited:

#### Joshua

##### Well-known member
VIP
def HH = Highest(High,300);
def PD = ((Close - HH) / HH) * 100;
plot Scan = PD <= -10;

THX

Last edited:

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?