Hi Pete, I like to use the ATRTrailingStop study on Thinkorswim for short term trading and it would be very helpful if this study had the option for study based alerts (text/email/push notifications). Unfortunately, Thinkorswim does not list this study in the Condition Wizard when creating an alert. Ideally, the alert would trigger when the price crossed above and below the ATRTrailingStop line by two bars (to prevent false alerts) or when the Buy and Sell signals trigger when using the ATRTrailingStopLE and ATRTrailingStopSE strategies. Thanks in advance and I look forward to your input!
Marked as spam
Ok, the reason this study does not appear in the Study Alerts is because the code is to complex for that tool to evaluate. We can do this very simply on a Chart based study. But the only way you are going to get text/email alerts using this study is to build a custom scan. They recently added functionality to the scan engine that enables it to send text/email alerts when symbols are added to the results. (for a 15 minute chart you could get text/email alerts every 15 minutes. You can also set this up to run daily or hourly and just send you a list of symbols in the results.
You can read more about this in the release notes: http://tlc.thinkorswim.com/center/release/rel-09-10-2016.html#section_1
So I have two versions of the code for you. One to run scans (you will need to configure the scan to create alerts as instructed in the link above). The other is to place on a live chart, with audible and visual alerts added.
Note: Let me know if there are issues copying this code and I will update this post to include a couple of text files.
Don’t forget to up-vote this answer if it solves your question! Thanks.
Here is the code for the Scan:
Here is the code for the chart study with alerts:
Marked as spam
Thanks Pete! Both of your methods work great and I appreciate the additional arrow plots on the chart study!
Hello Pete, As a follow-up on this ATRtrailing Stop, I am using this in a scan (Daily timeframe) in conjunction with a Stochastic scan (1hour). The issue I’m having is an alert is supposed to notify me when the Stochastic K crosses above the D and the price is above the ATRtrailing Stop. Simple, however the alerts are firing at random and not when the conditions are met. I’ve contacted TOS support and discussed this with them and they don’t seem to know why this is happening. Are you experiencing this with alerts set on time-frames lower than daily?
Please start a new post for this so we can discuss this further without cluttering up this one. I will link to the new post from here once we get that established. In your post, please be sure to include a screenshot showing how your scan is setup.
Works well Pete, but how can I change the scan to give me alerts after 1 bar? I use it primarily on Daily charts with different ATR settings, but I'm getting the alerts 2 bars after I'd like to. Thanks, KC
The alerts are currently set to trigger on the very same bars as the arrows which indicate the change in direction. There is no way to make the alerts trigger before the arrows appear. Unless you can read the future. In which case you don't need any alerts... lol
Hi Pete, I was looking to see how this scan would work and get an error when trying it out. Any thoughts? After pasting the scan code to the thinkScript editor I get the following error message: rec usage is not allowed in this context
The only way this could happen is if you are instead using the Study Alert or Conditional Order tools. This error would never appear when adding this code to a Study Filter in a custom scan. (I just tested it to be sure)
Hi Pete, I tried to submit a comment on this forum somewhere but cant find now and want to be sure I am alerted to your response. I'd like have the strategy initiate a "buy" or "sell" as soon as price bar crosses trailing atr in real-time, i.e. even if it flip flops back and forth on the time frame I'm looking at. is that possible? thank you so much. amazing stuff here
That is already included as a built-in strategy that comes with Thinkorswim. The following post explains some of the details you are lacking: https://www.hahn-tech.com/ans/how-to-make-a-atrtrailstoplx/
Please log in to post questions.