Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Price within 10% of 200sma? ThinkScript
Updated December 7, 2019
Top Posters
looks_one
Avestro
with 7 posts (0 thanks)
looks_two
Massive l
with 5 posts (2 thanks)
looks_3
DaveDoggyDogg
with 1 posts (0 thanks)
looks_4
salander
with 1 posts (0 thanks)
trending_up
6,459 views
thumb_up
2 thanks given
group
6 followers
forum
15 posts
attach_file
0 attachments
Price within 10% of 200sma? ThinkScript
March 2nd, 2019, 04:40 PM
OR/USA
Legendary /NQ Trader
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106
Avestro
Appreciate it, working on making the criteria now. That's hard. I'm getting an "at least one plot should be defined" error
change the def = to plot =
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
March 2nd, 2019, 04:47 PM
Sherman Oaks California
Posts: 7 since Mar 2019
Thanks Given: 0
Thanks Received: 0
Massive l
change the def = to plot =
Still having issues
1. Scan that looks for 200SMA not moving average but Simple Moving Average to be within x% of Ichimoku (). "Span A"
2. Scan that looks for wicks rejecting 200SMA
March 2nd, 2019, 05:18 PM
London UK
Experience: Beginner
Platform: CQG
Broker: S5
Trading: Futures
Posts: 5,988 since Sep 2015
Thanks Given: 15,515
Thanks Received: 15,458
@Avestro
You have created three or more threads for the same issue. I am going to close all the others as duplicate.
Please do not create others or they will be considered junk posting which is against the site's terms.
July 4th, 2019, 03:59 PM
Los Angeles,CA USA
Posts: 16 since Mar 2017
Thanks Given: 0
Thanks Received: 7
Avestro
Price within X percent of 200sma?
So I am working on a project where I need to add a custom study in my scan that will scan for stocks that have closes within (whatever %) of the 200sma.
I've tried to write it out visually here for those who want to see it
Close is within 10% of SimpleMovingAvg("length") = 200)."
SMA "
here you go, here is the complete code
to change the percent just change 0.10 to whatever percent you want. 0.10 defines 10%
Code
#Code Below price is within 10 Percent of 200SMA
#
def ma = SimpleMovingAvg(close,200);
def percent = ma*0.10;
plot scan = absvalue(close - ma) <= percent;
July 7th, 2019, 07:36 AM
Minneapolis Minnesota
Posts: 24 since Jul 2019
Thanks Given: 0
Thanks Received: 13
Avestro
Price within X percent of 200sma?
So I am working on a project where I need to add a custom study in my scan that will scan for stocks that have closes within (whatever %) of the 200sma.
I've tried to write it out visually here for those who want to see it
Close is within 10% of SimpleMovingAvg("length") = 200)."
SMA "
Reference this in the scanner. It will return if price is inside the desired percentage above or below the selected moving average
Code
declare lower;
input percentWithin = 10;
input price = close;
input length = 200;
input avgType = AverageType.SIMPLE;
def ma = MovingAverage(avgType, price, length);
plot WithinPercent = Between(price,
ma * (1 - (percentWithin / 100)),
ma * (1 + (percentWithin / 100)));
December 7th, 2019, 04:02 PM
orlando+florida/unitedstates
Experience: Intermediate
Platform: TS, TOS
Broker: TS, TDA, TW
Trading: Micros, Options
Posts: 15 since Jan 2019
Thanks Given: 12
Thanks Received: 5
I need a similar study that shows a user-defined percentage band around the price bars itself?
Nube
Reference this in the scanner. It will return if price is inside the desired percentage above or below the selected
moving average
Code
declare lower;
input percentWithin = 10;
input price = close;
input length = 200;
input avgType = AverageType.SIMPLE;
def ma = MovingAverage(avgType, price, length);
plot WithinPercent = Between(price,
ma * (1 - (percentWithin / 100)),
ma * (1 + (percentWithin / 100)));
Last Updated on December 7, 2019