NexusFi: Find Your Edge


Home Menu

 





Can someone help creating scan code in ThinkorSwim?


Discussion in ThinkOrSwim

Updated
    1. trending_up 10,640 views
    2. thumb_up 1 thanks given
    3. group 4 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

Can someone help creating scan code in ThinkorSwim?

  #1 (permalink)
dlisenko
Chicago IL
 
Posts: 1 since Feb 2013
Thanks Given: 0
Thanks Received: 0

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 NexusFi?
Better Renko Gaps
The Elite Circle
Deepmoney LLM
Elite Quantitative GenAI/LLM
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
65 thanks
Funded Trader platforms
41 thanks
Battlestations: Show us your trading desks!
24 thanks
NexusFi site changelog and issues/problem reporting
23 thanks
The Program
19 thanks

  #2 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145

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

 
Code
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,

RedK

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
Saul
Carteret NJ
 
Posts: 7 since Oct 2014
Thanks Given: 3
Thanks Received: 0


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




Last Updated on October 13, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, 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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts