♥ 0 |
Let’s say I pull up a daily chart with 1 year of data. The high and low are listed. Let’s say the low of this time frame is $10 and the high is $70. The mean is obviously $40. Is there a way we can scan for stock that are currently trading at or near the mean? Something we can adjust. Say it’s trading with +/- $5 of the mean. Would be nice to have the ability to scan on any time frame with the daily as the default.
Marked as spam
|
Private answer
Before we get into the solution I need to explain the data limits imposed on the scanner in Thinkorswim. One year of historical data is only available for the Hourly time frame and above. So to scan for the high and low with last year, you must select a time frame of 1 hour or higher. Details here: http://toslc.thinkorswim.com/center/howToTos/thinkManual/Scan/Stock-Hacker/studyfilters.html Within those limits, results are exactly the same regardless what time frame you chose so… If you are looking to find price relative to the mean over a 1 year period, it does not matter what time frame you use. So use the daily for the sake of simplicity. Yes? Since we have more than one year of historical data available for daily time frame and above, we’ll need to apply a start date to the code. This will be in the form of a user adjustable input that will need to be manually updated to ensure the scan is reading from exactly one entire year. The surprising thing for me is this code was designed on the daily time frame but works on the hourly time frame as well. When I got started on this I assumed I would have to provide a different section of code for lower time frames. Here you go. Screenshot below shows the output.
Marked as spam
|
|
Private answer
If you are looking to find price relative to the mean over a 1 year period, it does not matter what time frame you use. So use the daily for the sake of simplicity. Yes? For the most part, yes this will be used on a daily time frame. I do appreciate this and love the ability to customize the price as well as the reference date.
I do have a question. I do not get the lines on the chart as you did. The scan works well and within the parameters I set but is there something I’m missing or overlooking or is this just something additional on your chart? Thanks again. Marked as spam
|
Please log in to post questions.
The chart I included was just part of how I develop stuff. I make sure I can visualize all the elements so I know the scan is doing what I want. Your request was for a scan. The chart study version does not work as a scan. So it would have caused confusion. If you want to turn that scan back into the chart study version there are two steps. Change the “plot scan” to “def scan”. Then add the following plot line immediately below that:
plot test1 = highestHigh;
plot test2 = lowestLow;
plot test3 = mean;
thank you