♥ 1 |
I want to receive twice-a-day TOS alerts when any of the 300+ Optionable stocks on my watchlist are within 5% (Above or Below) of (any of) several SMAs I use. The SMA’s I use are 55 89 144 233 377 610 987. I need this only for the SMA’s on my DAILY Chart. Example Alert: AMZN is within 5% of the 144 Period SMA. The Tech at TOS said I need to use Thinkscript to accomplish this. Please advise best approach.
Marked as spam
|
Private answer
Learning CurveThe code is very basic. This will not be the most challenging part of accomplishing your goal. The complete solution will require that you have experience creating and saving custom scans. You will also need to know how to take a saved scan and use it to create what I call a "Dynamic Alert". We have an entire library showing how to create scans. So if you are not familiar with using this tool in Thinkorswim be sure to pick a few from the list and get up to speed. Here is a link to the Scans category on our site: https://www.hahn-tech.com/category/tos/scans-tos/ The videos are listed in the left hand sidebar. In order to run the scan against your watchlist you will need to select your saved watchlist as the top level filter. (located in the upper left of the scan window, titled "Scan in:" and "Intersect with:") Now on to the "Dynamic Alert". I don't have a video dedicated to dynamic alerts but I did show how to construct one of these in the following video. Just scrub to the 29:50 mark to see the portion relating to this dynamic scan. https://www.hahn-tech.com/thinkorswim-overnight-range-scan-alert/ ChoicesThe only issue you will find is that there is no setting that will produce your scan results twice a day. You have three choices. As shown in the screenshot below. Hourly, Daily and Weekly. Since your SMA's are based on daily time frame you will need to select the Daily time frame for your study filter (you will learn about this after viewing videos in our scans category). The significance of this fact is that it will not permit you to include any sort of restriction on what time of day these scan signals are returned. Ok, I just lied there a bit. I tiny-winy-bitty lie. But I was trying to save you from a potential solution that might just send you over the edge of the abyss. I'm not sure of your experience level with all these tools. So if you want to get a scan for say 10:30 am and 2:30 pm each day. We can get you there. But let's get this working in its most basic form before we tread down that path. (when ready, just add a comment at the bottom of this answer requesting that next level of functionality) The CodeOk, since we have laid down the foundation let's see what your code will look like. This is a single example using one SMA. You can simply adjust the value as need for your various SMA periods. I would expect you want to create a separate scan/alert for each SMA in use. This way you will know exactly which SMA has triggered the alert when it pops up on your screen or in your SMS/Inbox. (hint: the name used when saving the scan is what you will see)
That's it. This is for a 55 period SMA. Just change the value for the various SMA's you want to track. This a lot to put together, especially if you have no experience with these tools. So don't get frustrated if it doesn't work the first time. Come back and read through this solution a fews times until you pick up all the details.
Marked as spam
|
Please log in to post questions.
First thing we recognize is that scans always run on Eastern timezone. So we can't use PST. If we convert your times to Eastern we have 2:00 pm and 7:00 pm. We can address the scan for 2 pm. However we cannot run one for 7 pm because your scan it based on daily time frame and markets are closed during that time. Here is the code you could use to force the scan to only run at 2 pm:
plot scan = SecondsTillTime(1400) == 0;
You will need to add this as a separate Study Filter and set that study filter to 30 min time frame or lower. Just make sure what ever time frame you select is intraday and is a clean factors of an hourly bar. (so 1 min, 5 min, 10 Min, 15 min, 30 min)