♥ 0 |
Hi Pete, I’m trying to make a scan using a daily chart to find stocks going back historically, as long as possible. Is something like that possible? I’m fiddling with the following code to turn it into a scan but no luck so far. I’d appreciate any guidance you have to offer. Thank you. # CODE START AddLabel(yes, “Jan: ” + AsPercent(janUp/janTotalCount) + ” | ” + AsPercent(janAvgDiff), if(janUp/janTotalCount) > 0.5 and janAvgDiff > 0 then color.BLUE else color.DARK_ORANGE); # CODE END RESOLVED
Marked as spam
|
Private answer
When using a daily time frame for a scans you can only look back 2 years. You will have to move to the Monthly time frame to go back further. But even the monthly time frame is limited to only 20 years. And using the monthly time frame makes this code much easier to write. If you are looking for details about these data limitations for scans you can find them here, at the bottom of the following wegpage: https://toslc.thinkorswim.com/center/howToTos/thinkManual/Scan/Stock-Hacker/studyfilters I updated the title of your question to help it show up in the search results for any viewers that just might be looking for this. It certainly is well off the path most traders are thinking. The following code will only work as you requested if the scan is set to Monthly time frame:
I have included user inputs to allow viewers to adjust the percent threshold and the month number without modifying the code. Marked as spam
|
Please log in to post questions.
When building a custom scan for Thinkorswim, you get to add filters. And those filters are grouped by type. When you click the "Add filter" button you first get to select the "type". Which are listed as follows: Stock, Option, Fundamental, Study and Pattern.
You can add as many of each filter type to your scan as you want. (perhaps there is a limit but most folks will never exceed that). So you just add two Study Filters to the scan. One to run the solution I provided in my answer. And another to run the solution I described in my comment.
Since you are asking this question, I strongly recommend you take the time to learn how to get the most from the scan tool on Thinkorswim. Which you will accomplish by viewing the following video:
https://www.hahn-tech.com/thinkorswim-scans-beginner-to-advanced/You may also find the following article helps you understand how to create scans based on multiple time frames:
https://www.hahn-tech.com/thinkorswim-mtf-macd-scan/