Halt Indicator

barbaros

Administrator
Staff member
A Halt indicator for Thinkorswim. Original request from @JJTrades was:

The halt would be detected by all three conditions being true. currentVolume-3 is greater than 5 million, currentVolume-2 = 0 and currentVolume-1 = 0. I assume that if this code was plugged into a 1 minute candle screener, and also assuming the code would interpret the halted candles as zero volume, that this would have no problem detecting a halt whether up or down based merely off volume

However, when a stock is halted, Thinkorswim doesn't print any candles. An alternate solution was to check the time delta between the candles and assume that if the delta is greater than 1 minute on a 1 minute chart, stock was halted.

1TJMMB1.png


Halt Indicator shows how many minutes each candle is from a halt.
Code:
# Halt Indicator
# https://b4indicators.com
# Shows how much time a stock is halted on 1 minute chart
# v1 - Barbaros


declare hide_on_daily;

input StartTime = 0930;
input EndTime   = 1600;

def Allowed = SecondsFromTime(StartTime) >= 0 and SecondsTillTime(EndTime)-1 >= 0 and
              GetDay() == GetLastDay() and
              GetAggregationPeriod() == AggregationPeriod.MIN;
def TimeSegment = rounddown(SecondsFromTime(StartTime)/60,0);
def haltTime = if Allowed and TimeSegment > TimeSegment[1] + 1 then TimeSegment - TimeSegment[1] else 0;
def isHalted = Allowed and haltTime > haltTime[1] + 1;

AddChartBubble(isHalted, high, "Halt: " + haltTime + "m", Color.WHITE, yes);

Alert(isHalted, "Halted", Alert.BAR, Sound.DING);

Watchlist column
Code:
# Halt Indicator Watchlist Column
# https://b4indicators.com
# Shows how much time a stock is halted on 1 minute chart
# v1 - Barbaros


declare hide_on_daily;

input StartTime = 0930;
input EndTime   = 1600;

def Allowed = SecondsFromTime(StartTime) >= 0 and SecondsTillTime(EndTime)-1 >= 0 and
              GetDay() == GetLastDay() and
              GetAggregationPeriod() == AggregationPeriod.MIN;
def TimeSegment = rounddown(SecondsFromTime(StartTime)/60,0);
def haltTime = if Allowed and TimeSegment > TimeSegment[1] + 1 then TimeSegment - TimeSegment[1] else 0;
def isHalted = Allowed and haltTime > haltTime[1] + 1;

AddLabel(yes, if isHalted then haltTime + "m" else "");

Scanner
Code:
# Halt Indicator Scanner
# https://b4indicators.com
# Shows how much time a stock is halted on 1 minute chart
# v1 - Barbaros

declare hide_on_daily;

input StartTime = 0930;
input EndTime   = 1600;

def Allowed = SecondsFromTime(StartTime) >= 0 and SecondsTillTime(EndTime)-1 >= 0 and
              GetDay() == GetLastDay() and
              GetAggregationPeriod() == AggregationPeriod.MIN;
def TimeSegment = rounddown(SecondsFromTime(StartTime)/60,0);
def haltTime = if Allowed and TimeSegment > TimeSegment[1] + 1 then TimeSegment - TimeSegment[1] else 0;
plot isHalted = Allowed and haltTime > haltTime[1] + 1;
 
Last edited:

barbaros

Administrator
Staff member
I tried to add it to a scanner but it wont let me. Im sure im doing something wrong though. Thanks for your time by the way and trying this out
Add a new study filter to your scanner. In the window that comes up, select the editor and paste the scanner. Make sure you select the 1m aggregation.
CAz4xCb.png
 
Top