Price within 10% of 200sma? ThinkScript - ThinkOrSwim | futures io social day trading
futures io futures trading


Price within 10% of 200sma? ThinkScript
Updated: Views / Replies:161 / 12
Created: by Avestro Attachments:0

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)
Trading Apprentice
Sherman Oaks California
 
Trading Experience: Intermediate
Platform: ThinkOrSwim
 
Posts: 7 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
 
  #2 (permalink)
Life's short, risk it all
Portland, OR
 
Trading Experience: None
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: ESNQYMRTYCLNGGCHGPA6J
 
Massive l's Avatar
 
Posts: 1,677 since Mar 2011
Thanks: 1,112 given, 2,560 received
Forum Reputation: Legendary

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)
Trading Apprentice
Sherman Oaks California
 
Trading Experience: Intermediate
Platform: ThinkOrSwim
 
Posts: 7 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)
Life's short, risk it all
Portland, OR
 
Trading Experience: None
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: ESNQYMRTYCLNGGCHGPA6J
 
Massive l's Avatar
 
Posts: 1,677 since Mar 2011
Thanks: 1,112 given, 2,560 received
Forum Reputation: Legendary


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)
Trading Apprentice
Sherman Oaks California
 
Trading Experience: Intermediate
Platform: ThinkOrSwim
 
Posts: 7 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)
Life's short, risk it all
Portland, OR
 
Trading Experience: None
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: ESNQYMRTYCLNGGCHGPA6J
 
Massive l's Avatar
 
Posts: 1,677 since Mar 2011
Thanks: 1,112 given, 2,560 received
Forum Reputation: Legendary


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
 
  #7 (permalink)
Trading Apprentice
Sherman Oaks California
 
Trading Experience: Intermediate
Platform: ThinkOrSwim
 
Posts: 7 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)
Life's short, risk it all
Portland, OR
 
Trading Experience: None
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: ESNQYMRTYCLNGGCHGPA6J
 
Massive l's Avatar
 
Posts: 1,677 since Mar 2011
Thanks: 1,112 given, 2,560 received
Forum Reputation: Legendary


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
 
  #9 (permalink)
Trading Apprentice
Sherman Oaks California
 
Trading Experience: Intermediate
Platform: ThinkOrSwim
 
Posts: 7 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)
Trading Apprentice
Sherman Oaks California
 
Trading Experience: Intermediate
Platform: ThinkOrSwim
 
Posts: 7 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 > > > > 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)
 

The Evoluton of HFT & Retail Impact w/John Grady

Elite only
 

Day Trading Oil Futures: Reducing Risk & Increasing Profits w/DTN IQFeed

Mar 26
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert ThinkScript to ThinkScript API t0757tlr ThinkOrSwim Programming 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 1 August 11th, 2014 11:00 PM
ACSIL: a function that returns the price with the highest volume within a bar yonatan Sierra Chart Programming 14 September 25th, 2012 07:07 PM
Prevent strategy from executing trade at the same price level within a session suprsnipes NinjaTrader Programming 1 February 28th, 2010 10:40 PM


Tags
average, code, coding, ichimoku, moving average, scan, sma, stocks, thinkorswim, thinkorswim coding, thinkscript, tos, variable, wicks

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

Copyright © 2019 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business, 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
Page generated 2019-03-18 in 0.15 seconds with 13 queries on phoenix