Trigger Alert when %age in Volume Changes Within Timeframe
I'm quite new here and to all of the ThinkScript stuff! I just wanted to ask real quick if there is a possibility to code a script / alert in TOS' thinkscript / thinkalert plattform that does the following:
- When a certain spike in volume occurs (for instance 15%+ gain in volume in trades @ one or more of my stocks on my watchlist) within a timeframe like 1m (one BAR in the one minute timeframe), an alert triggers!
alternatively (or as an addition) something that does the same but with the price per share of a stock: If a stock's price goes up like 10% in a specified timeframe like 1-2 minutes, it should fire off my alert.
Does someone know how to do it? Woudl be REALLY thankful
1) calculate the volume average
2) compare the volume to above volume average you want (might want to use input instead of def)
3) use def for the comparison
4) define a "plotter" def
5) define an alert plot using the comparison def that plots to plot the "plotter" def
This alert will pop up when there is a volume spike in the stock. Please note - when you set the alert you should choose your aggregation period. I have chosen 5 min as I work with 5 min candles. You asked about 1 or 2 min, so you will have to set it to 1 or 2 min. The following values are used in this particular example:
1. afterStart is set to 1000 - meaning 10:00am, i.e. the alert will ignore any volume spikes in the first 30 minutes of trading because based on my experience, most of the stocks have increased volume during the first 30 minutes of trading, so if you dont ignore, you will have a lot of alerts (depending on how many stocks you are watching).
2. beforeEnd is set to 1530 - meaning 15:30 (3:30pm) same logic as above, but for the end of the trading day.
3. volume > 10 - meaning the volume of the current bar/candle is higher 10 times than the average for the last 390 bars/candles.
4. 390 - I set it to 390 because I'm using the aggregation period of 5 min, so for the whole trading day it's 5min x 390 = 6 hours and 30 min which is the length of the trading day.
So you will have to play with the values to fit them to your needs. I believe same logic will work for the price.
The only issue is that you will have to set this alert for every stock in your watchlist to be notified. I was trying to find a way to setup alert only once, but to apply it for the entire watchlist. I haven't succeeded yet. At the time I asked TOS support, but they said there was no such capability yet. I don't know whether it's been developed since then.
So if I wanted to have an SMS alert sent to my phone instead of plotting the alert on the chart how would that be done?
I want to add the alert to several tickers in my watchlist and look for volume spikes between 12:30 pm and up until the close at 3pm CST. I think the code has to be changed from plot to alert but not sure how to do that...