Posts Tagged ‘alerts’

SMS Text Message Alerts Come to Think or Swim!

November 18, 2012

The day is finally here! Via ToS, here’s how to get alerts sent as a text message to your mobile phone by SMS:

Last but not least, we have expanded our capacity to deliver notifications such as order fills and alerts directly via text message to your mobile phone. (Prospectus says: Note that iOS users can get push alerts from the Mobile Trader app now as well.)

To activate this functionality, go to the Notifications tab of the “Application Settings” menu.
Click “Set up a Confirmed Number” and follow the instructions on the screen
Once your mobile number has been confirmed, simply check the box to “Send SMS During
US Market Hours” for any notification type that you would like to receive


There you go!

Daily Average Volume Study with Alerts for Think or Swim

February 2, 2010

This study will plot a color coded box in the volume pane that shows the percentage of daily average volume that a stock has traded for the current day. The two inputs are:

1. How many days of past volume to average (from 1 to 60, currently)
2. An alert level in percent of average volume

In the picture above, “days” was 60 and the alert was set to 100, meaning that if GOOG traded more shares for the day than the average daily volume of the past 60 days, the box would turn from red to green and you would get an alert. Here’s an example of how C looked at the end of the day today (the alert at 100 never triggered):

You could set this study with a level of say 20, and use it during the first 30 minutes of the market to be alerted to stocks with high volume relative to their average. Of course you’d have to have plots open, since I don’t think it works on a watchlist. It’s meant to be used real-time, as it always shows the sum of the current day so far. You can configure the alerts and also turn the chart label off if you hate the box but still want the alert.

    How I Did It

The hardest part was writing a gigantic definition for average daily volume that accepted a variable input. To get the volume from the daily timeframe, you use

def dailyvol=volume(period=”DAY”);

That would return today’s volume on the daily timeframe. To get yesterday’s daily volume, you’d use

def yesterdayvol=volume(period=”DAY”)[1];

You can imagine that a 3 day average volume would look like this:

def threedayavgvol=(volume(period=”DAY”)[1]+volume(period=”DAY”)[2]+volume(period=”DAY”)[3])/3;

So imagine that stretched out to 60 times. Yikes. Then I just compared today’s volume to the average volume, calculated a percentage, and then used the addchartlabel() function to make the box. I changed the color coding with the assignvaluecolor() function, depending on if the percentage was above or below the alert level. I added my alerts block code, changed the alert parameter to percentage>=alert level, and that’s a wrap.

So now you know how to make one of your own, or you can use mine if you donate to my blog. The file “” is in the “Released Thinkscript Studies” section of my Google Site. If you are not yet a donor, you can become one by clicking the button below:

Volatility-Based Trailing Stop Study Updated (v3)

January 11, 2010

I added my alerts block code, and also fixed it since it broke on Tick charts in the most recent Think Desktop update. Download “Volatility_Based_Trailing_Stop_v3STUDY.ts” from “Released Thinkscript Studies” on my Google site.

Thinkscript Tip: Alert Code Block for Think or Swim

January 11, 2010

Here’s a block of code that I am going to be implementing in scripts in future. It’s a generic alert configuration code. It assumes that you have another line in your code that defines what the alert trigger is, like so:

def alerttrigger = high>high[1];

The line above says I want an alert if the bar’s high is above the last bar’s high, for example. You can replace it with whatever you want to be alerted about.

Here’s the alert code:

# Alerts:
def alerttrigger = 1; #replace the 1 with your definition
input alerttext = “Alert Text”;
input UseAlerts = {false, default true};
input AlertType = {default “BAR”, “ONCE”, “TICK”};
def at=AlertType;
input AlertSound = {“Bell”, “Chimes”, default “Ding”, “NoSound”, “Ring”};
alert(alerttrigger AND UseAlerts, alerttext, if at==1 then Alert.ONCE else if at==2 then Alert.TICK else Alert.BAR, AlertSound);

To use it in your scripts, change the “def alerttrigger = 1;” line in your code to what you want to alert about, and then drop the entire code block at the end of your script file. Instant configurable alerts!

Moving Average Cross Alert Study for Think or Swim

December 11, 2009

Here’s a script that shows how to trigger an alert on a moving average crossover, but only after the bar that caused a crossover has completed. I have an arrow plotted intrabar if the averages cross, and it disappears if they uncross. This same thing can happen to alerts based on the crossover, giving you an alert that is later invalidated. The way around it is to have the alert look one bar back, so it won’t trigger until the first tick after a crossover bar is finished.

The script is called “MACrossover_w_AlertsSTUDY.ts”, and is free at my Google site under
“Released Thinkscript Studies”.