NexusFi: Find Your Edge


Home Menu

 





Basic scripting question for study filter


Discussion in ThinkOrSwim

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




 
Search this Thread
  #1 (permalink)
Hockster
Singapore
 
Posts: 3 since Aug 2014
Thanks Given: 2
Thanks Received: 0

Hi all,

I'm pretty new to the thinkscript and have been trying without avail to program a script to do what I want. I am hoping some of the experts here can help to start me off

I'm trying to do a study filter in the stock hacker which will screen for the stocks that will meet the following criteria:
1. Closing price of previous trading day crossed below 22 SMA (SMA based on closing prices of past 22 trading days)
2. Current price still below 22 SMA

Can anyone help?

Thank you!


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Iran Deal "In Review" at 87% on Deadline Day - …
Prediction Markets & Event Contracts
Fed Hike Odds at 57% After Warsh: England Surges 12.9%, …
Prediction Markets & Event Contracts
Khamenei Vetoes Uranium Transfer as Peace Odds Surge to …
Prediction Markets & Event Contracts
UCL Final Kicks Off at Noon ET: PSG at 56.5% as Iran May …
Prediction Markets & Event Contracts
Beijing Summit Closes: Xi Pledges Hormuz Help -- $1.14B …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
13 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #2 (permalink)
Hockster
Singapore
 
Posts: 3 since Aug 2014
Thanks Given: 2
Thanks Received: 0

I tried to start off like below:

close from 1 bars ago is less than Average("data" = close, "length" = 22) and close is less than Average("data" = close, "length" = 22)

What I'm trying to do is to scan for stock whose price is under the 22 SMA the previous trading day and current price is still under the 22 SMA. I hit "scan" and the scan results doesn't seem to be what I want. Some of the stocks have their current price above the 22 SMA. What am I missing here?


Reply With Quote
  #3 (permalink)
 growex 
Trubchevsk
 
Experience: Beginner
Platform: tos
Trading: stocks
Posts: 61 since May 2011
Thanks Given: 40
Thanks Received: 79


Hockster, the formula, you created is right one. Sometimes the scanner of ToS returns bad results...no one still know why. Check the timeframe setting on which your scan query is working on.
also you can try this query: (the same as yours)

plot scan = close[1] < average (close,22) && close < average (close,22);

Dont forget to set "D" as timeframe....


Follow me on X Reply With Quote
Thanked by:
  #4 (permalink)
Hockster
Singapore
 
Posts: 3 since Aug 2014
Thanks Given: 2
Thanks Received: 0


growex View Post
Hockster, the formula, you created is right one. Sometimes the scanner of ToS returns bad results...no one still know why. Check the timeframe setting on which your scan query is working on.
also you can try this query: (the same as yours)

plot scan = close[1] < average (close,22) && close < average (close,22);

Dont forget to set "D" as timeframe....

hi growex,

Thanks for the reply. I got it to work somehow. Do you happen to know how I can get the average implied volatility? I'm trying to scan for stocks that has an avg imp vol within a certain range..

Thanks!


Reply With Quote
  #5 (permalink)
 growex 
Trubchevsk
 
Experience: Beginner
Platform: tos
Trading: stocks
Posts: 61 since May 2011
Thanks Given: 40
Thanks Received: 79

the same as an average of any variable...

plot s = imp_volatility < average(imp_volatility,10);

works on Day timeframe.


Follow me on X Reply With Quote
Thanked by:




Last Updated on September 4, 2014


© 2026 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 - Downloads - Top
no new posts