NexusFi: Find Your Edge


Home Menu

 





Basic scripting question for study filter


Discussion in ThinkOrSwim

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




 
Search this Thread

Basic scripting question for study filter

  #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?
Exit Strategy
NinjaTrader
Deepmoney LLM
Elite Quantitative GenAI/LLM
Are there any eval firms that allow you to sink to your …
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
 
  #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 Twitter 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 Twitter Reply With Quote
Thanked by:




Last Updated on September 4, 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