Generate alerts from MACDStrat chart strategy


0
0

Hello Mr Hahn. Is there anyway to get an alert specifically for the MACD Strategy in TOS ? The alert would go off whenever the MACDSTRATLE or MACDSTRATSE is triggered. Thanks so much for what you’re doing.

Attachments:
Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on April 30, 2020 9:36 am
1083 views
0
Private answer

There are several different tools in Thinkorswim that can be used to generate alerts. So you will need to provide more details. Here are the different forms of alerts available on Thinkorswim:

  1. Study Alert
    1. Study alerts can be created using custom script or constructed using the Condition Wizard. They only work with one ticker symbol but are active even after you log out of the platform. You can assign a custom sound and also have the Study Alert send sms/email notifications.
  2. Chart Study Alert
    1. Chart studies are able to generate pop-up messages when logged into the platform and they can also play one of four built-in sounds. They only work for the symbol loaded on the chart, while the platform is open and logged in, and they can NOT send sms/email notifications or use custom sounds.
  3. Dynamic Alert (Scans)
    1. Any saved custom scan can be used to generate notifications much the same as the Study Alert. The difference is that from the saved custom scan you are able to run it against multiple ticker symbols. (custom or built-in watchlist).

Once you tell us which sort of notification you are requesting we can provide a solution.

Some helpful links to support most of what I just explained:

https://www.hahn-tech.com/thinkorswim-condition-wizard/

https://www.hahn-tech.com/thinkorswim-overnight-range-scan-alert/

 

Edit: Now that we have some clarification on this request, posted in the comments section below, we can provide a solution. The request is to produce a chart study alert from this chart strategy.

First, we'll show the full code that is copied directly from the built-in chart strategy named MACDStrat:

input fastLength = 12;
input slowLength = 26;
input macdLength = 9;
input averageType = AverageType.EXPONENTIAL;
def diff = reference MACD(fastLength, slowLength, macdLength, averageType).Diff;
AddOrder(OrderType.BUY_AUTO, diff crosses above 0, tickColor = GetColor(0), arrowColor = GetColor(0), name = "MACDStratLE");
AddOrder(OrderType.SELL_AUTO, diff crosses below 0, tickColor = GetColor(1), arrowColor = GetColor(1), name = "MACDStratSE");

Next, well convert this to a chart study by removing the AddOrder() statements. For the alerts, we simply add two Alert() statements to replace the AddOrder() statements. We will retain the true/false condition of the AddOrder() statements which are used to plot the theoretical buys and sells on the chart.

input fastLength = 12;
input slowLength = 26;
input macdLength = 9;
input averageType = AverageType.EXPONENTIAL;
def diff = reference MACD(fastLength, slowLength, macdLength, averageType).Diff;
Alert(diff crosses above 0, "MACD Hist Cross Above", Alert.BAR, Sound.RING);
Alert(diff crosses below 0, "MACD Hist Cross Below", Alert.BAR, Sound.RING);
AddLabel(yes, "", Color.BLACK);

Notice I have also included a final statement that creates a blank label. This is because every chart study requires at least one plot or chart label before it can be saved and applied to a chart.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on April 30, 2020 2:12 pm
0
I'm looking specifically looking for a Chart Study Alert I believe for this strategy. Thank you again
( at April 30, 2020 10:21 pm)
0
Hahn, can you also create a dynamic alert for this same MACDstrat. Im looking to scan a watchlist for stocks that meet the criteria
( at October 27, 2020 8:34 pm)
0
The alerts for this have already been provided here: https://www.hahn-tech.com/ans/do-you-have-a-sound-alert-for-macdhistogram-arrows/
( at October 27, 2020 9:29 pm)
0
Understood but, how do i create a scan for stocks that are currently showing a buyg signal? I've tried to use scan hacker, but it doesnt display anything
( at October 28, 2020 6:48 pm)
0
The solution here is for a chart strategy with alerts. This is not designed to work as a scan. If you are seeking a scan you should be searching the "Stock Scanners" topic. MACD is one of the most popular so I am sure you will find something has already been posted and solved.
( at October 28, 2020 7:04 pm)