Price within 10% of 200sma? ThinkScript
futures io futures trading



Price within 10% of 200sma? ThinkScript


ThinkOrSwim

Created March 1st 2019 by Avestro
Updated December 7th 2019 by salander
looks_oneAvestro with 7 posts (0 thanks)
looks_twoMassive l with 5 posts (2 thanks)
looks_3DaveDoggyDogg with 1 posts (0 thanks)
looks_4salander with 1 posts (0 thanks)
 
trending_up1,369 views
thumb_up2 thanks given
forum15 replies
attach_file0 attachments



Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Price within 10% of 200sma? ThinkScript

  #1 (permalink)
Sherman Oaks California
 
 
Posts: 9 since Mar 2019
Thanks: 0 given, 0 received

Price within 10% of 200sma? ThinkScript

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"

Reply With Quote

Can you help answer these questions
from other members on futures io?
CME trading hits monthly record
Beginners and Introductions
market_cipher5_bg
ThinkOrSwim
Between the spread near closing
Options
vwap strategy
TradeStation
adding labels that always stay on the left on horizonal lines
ThinkOrSwim
 
Best Threads (Most Thanked)
in the last 7 days on futures io
ES futures Spoo-nalysis SP500/SPX
402 thanks
Recession? Depression? Bailout!
187 thanks
Is Orderflow An Outdated Concept?
173 thanks
Coronavirus COVID-19
158 thanks
AMP Futures / AMP Global Review
36 thanks
 
  #2 (permalink)
Legendary Market Wizard
Portland, OR
 
Trading Experience: None
 
Massive l's Avatar
 
Posts: 1,905 since Mar 2011
Thanks: 1,512 given, 3,670 received

I use a chart label but you can turn it into a scan

AddLabel(yes, AsPercent((close - sma200) / sma200), if close > sma200 then color.green else color.red);

Reply With Quote
 
  #3 (permalink)
Sherman Oaks California
 
 
Posts: 9 since Mar 2019
Thanks: 0 given, 0 received



Massive l View Post
I use a chart label but you can turn it into a scan

AddLabel(yes, AsPercent((close - sma200) / sma200), if close > sma200 then color.green else color.red);

How would I turn it into a scan where I can look for stocks that are within 10% of it

Reply With Quote
 
  #4 (permalink)
Legendary Market Wizard
Portland, OR
 
Trading Experience: None
 
Massive l's Avatar
 
Posts: 1,905 since Mar 2011
Thanks: 1,512 given, 3,670 received


Avestro View Post
How would I turn it into a scan where I can look for stocks that are within 10% of it

define it as a variable

Reply With Quote
 
  #5 (permalink)
Sherman Oaks California
 
 
Posts: 9 since Mar 2019
Thanks: 0 given, 0 received


Massive l View Post
define it as a variable

I have literally no coding experience, would you mind posting it here?

Reply With Quote
 
  #6 (permalink)
Legendary Market Wizard
Portland, OR
 
Trading Experience: None
 
Massive l's Avatar
 
Posts: 1,905 since Mar 2011
Thanks: 1,512 given, 3,670 received


Avestro View Post
I have literally no coding experience, would you mind posting it here?

I didn't have coding experience either. I'm trying to help you learn.

Reply With Quote
The following user says Thank You to Massive l for this post:
 
  #7 (permalink)
Sherman Oaks California
 
 
Posts: 9 since Mar 2019
Thanks: 0 given, 0 received


Massive l View Post
I didn't have coding experience either. I'm trying to help you learn.

Come on, Please? Or a scan that scans for wicks rejecting the 200sma

Reply With Quote
 
  #8 (permalink)
Legendary Market Wizard
Portland, OR
 
Trading Experience: None
 
Massive l's Avatar
 
Posts: 1,905 since Mar 2011
Thanks: 1,512 given, 3,670 received


Massive l View Post
I use a chart label but you can turn it into a scan

AddLabel(yes, AsPercent((close - sma200) / sma200), if close > sma200 then color.green else color.red);


 
Code
input price = close;
input length = 200;

def sma = Average(price, length);
def sma_scan_value = ((close - sma) / sma);
Your scan criteria would then be sma_scan_value = .1

I recommend making a set of criteria. <=.1 and >.15 or whatever so you have a range otherswise you'll only get stocks when they hit the absolute value of 10%.

Reply With Quote
The following user says Thank You to Massive l for this post:
 
  #9 (permalink)
Sherman Oaks California
 
 
Posts: 9 since Mar 2019
Thanks: 0 given, 0 received


Massive l View Post
 
Code
input price = close;
input length = 200;

def sma = Average(price, length);
def sma_scan_value = ((close - sma) / sma);
Your scan criteria would then be sma_scan_value = .1

I recommend making a set of criteria. <=.1 and >.15 or whatever so you have a range otherswise you'll only get stocks when they hit the absolute value of 10%.

Appreciate it, working on making the criteria now. That's hard. I'm getting an "at least one plot should be defined" error

Reply With Quote
 
  #10 (permalink)
Sherman Oaks California
 
 
Posts: 9 since Mar 2019
Thanks: 0 given, 0 received



Massive l View Post
 
Code
input price = close;
input length = 200;

def sma = Average(price, length);
def sma_scan_value = ((close - sma) / sma);
Your scan criteria would then be sma_scan_value = .1

I recommend making a set of criteria. <=.1 and >.15 or whatever so you have a range otherswise you'll only get stocks when they hit the absolute value of 10%.

I've also thought about it, How can I make it so that the scan shows when the 200sma is within X percent of Ichimoku()."Span A" then that'd be perfect

Reply With Quote

Reply



futures io Trading Community Platforms and Indicators ThinkOrSwim > Price within 10% of 200sma? ThinkScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now
 

Social Media Predictive Data for Traders w/Joe Gits @ SMA [and Lime Brokerage]

Apr 9
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
ACSIL: a function that returns the price with the highest volume within a bar yonatan Sierra Chart 16 October 12th, 2019 06:24 AM
Convert ThinkScript to ThinkScript API t0757tlr ThinkOrSwim 0 May 20th, 2018 11:09 AM
Price within X percent of high within Y days eddieo ThinkOrSwim 2 March 30th, 2017 09:50 PM
200sma Zobyi Traders Hideout 0 August 11th, 2014 11:00 PM
Prevent strategy from executing trade at the same price level within a session suprsnipes NinjaTrader 1 February 28th, 2010 10:40 PM


All times are GMT -4. The time now is 06:48 AM. (this page content is cached, log in for real-time version)

Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts