Can someone help creating scan code in ThinkorSwim? - futures io
futures io

Can someone help creating scan code in ThinkorSwim?

Discussion in ThinkOrSwim

    1. trending_up 9,573 views
    2. thumb_up 1 thanks given
    3. group 4 followers
    1. forum 2 posts
    2. attach_file 0 attachments

Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

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

Search this Thread

Can someone help creating scan code in ThinkorSwim?

(login for full post details)
  #1 (permalink)
Chicago IL
Posts: 1 since Feb 2013
Thanks: 0 given, 0 received

Scan stocks on the short side

[type = stock] and [country = us] and[daily ema(60,daily volume) > 300000] and
[daily low > yesterday's daily low] and
[yesterday's daily low > 2 days ago daily low] and
[SMA(10, close) < EMA(30, close)]and
[daily close > daily SMA(10,daily close)]and
[daily close < daily EMA(30,daily close)]and
[weekly sma(10,weekly close) < weekly ema(30,weekly close)]and
[ADX Line(10) > 20.0]and
[close >= 10]

Scan stocks on the Long side

[type = stock] and [country = us] and[daily ema(60,daily volume) > 300000] and
[daily high < yesterday's daily high] and
[yesterday's daily high < 2 days ago daily high] and
[sma(10, close) > ema(30, close)]and
[daily close > daily ema(30,daily close)]and
[daily close < daily sma(10,daily close)]and
[daily close > daily sma(200,daily close)]and
[weekly sma(10,weekly close) > weekly ema(30,weekly close)]and
[ADX Line(10) > 20.0]and
[close >= 5]

Reply With Quote

Can you help answer these questions
from other members on futures io?
1 min chart v-shape scan help please
Eurex Denali vs dxFeed
Sierra Chart
Fail to Plan - Plan to Fail: What can go wrong?
Traders Hideout
CME removal of 16:15-30 trading halt/effect on OHL
Emini and Emicro Index
Experience with AGN (Introducing Broker)
(login for full post details)
  #2 (permalink)
Dubai, UAE
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
RedK's Avatar
Posts: 171 since May 2012
Thanks: 44 given, 143 received

here's how I would do this... for example your SHORT scan would look like this

def Vol = if ExpAverage (volume, 60 ) > 300000 then 1 else 0;
def daily = if low > low[1] and low[1] > low [2] then 1 else 0 ;
def SMA10vsEMA30 = if Average(close, 10) < ExpAverage(close, 30) then 1 else 0;
def ClosevsSMA10 = if close > Average(close, 10)  then 1 else 0;
def ClosevsEMA30 = if close < ExpAverage(close, 30)  then 1 else 0;
def wkSMA10vswkEMA30 = if Average(close(period = AggregationPeriod.WEEK), 10) < ExpAverage(close(period = AggregationPeriod.WEEK), 30) then 1 else 0;def ADX = if DMI(10).ADX > 20 then 1 else 0;
def Price = if close >= 10 then 1 else 0;

Plot Short = Vol * (Daily + SMA10vsEMA30 + ClosevsSMA10 + ClosevsEMA30 + WkSMA10vswkEMA30 + ADX + Price);
I didn't test this as a scan, only as a normal study .. and AFAIK, TOS scans don't allow calling a secondary aggregation, so although the bold line would work in a plot study, it may/should not work in a scan.. so it may need to be separated in a different scan "column"

the successful short candidates will show max score in the scan (in this case a 7), the non-candidates will have lower values, including a 0 if they fail the volume condition .. but that last "plot" line can be changed to show only these ones with a full score and ignore all others, with an IF statement (if the sum is 7 show a "SHORT!" otherwise a blank.

the Long scan would be similar after changing the logical operators ">" and "<"

an interesting exercise thanks for sharing, and hope this helps,


Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to RedK for this post:
(login for full post details)
  #3 (permalink)
Carteret NJ
Posts: 7 since Oct 2014
Thanks: 3 given, 0 received

I know how to insert the scans into TOS platform,
I,m just not savvy enough to know how to create the thinkscripts.

The filter scan i'm looking for are.

#1 50 sma must be angling or moving up

#2 slow stochastic with sma % D period 3 crosses oversold 15

#3 momentum lenght 9,price close, turning up and crossing -5

#4 MACD with sma,fast lenght 5,slow lenght 15,macd lenght 20 and crossing above -2.00

Thanks in advance
Dedicated To Your Success!

Reply With Quote

futures io Trading Community Platforms and Indicators ThinkOrSwim > Can someone help creating scan code in ThinkorSwim?

Last Updated on October 13, 2014

Upcoming Webinars and Events

NinjaTrader Indicator Challenge!


Your Charts Should Speak To You w/Bob Cometta

Elite only

Our 12-year anniversary w/ $$,$$$ prizes (check soon)


Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada),
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