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);
LGUjCrm.png

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.
 

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);
LGUjCrm.png
 
Solution

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.

6AlVf1x.png


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

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

AddLabel(Yes,
    "Min: " + Min
,color.blue);

AddLabel(Yes,
    "Max: " + Max
,color.blue);

AddLabel(Yes,
    "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);
 

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)?
OACESeY.png
 

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)
 

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.
Top