Scan for previous day trade count


Category:
0
0

As an example, how do I scan for stocks that had over 1000 trades yesterday? (from 9:30 to 15:59)

Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on June 26, 2022 10:13 pm
115 views
0
Private answer

There have been several solutions on this topic already. I will provide links to those solutions because you may find them useful:

https://www.hahn-tech.com/ans/number-of-trade-and-abnormal-trade-volume-scan/

https://www.hahn-tech.com/ans/display-number-of-trades-in-custom-column/

https://www.hahn-tech.com/ans/adding-of-trades-to-chart-scanner/

On Thinkorswim, total number of trades is not available on a daily time frame. However we can access this data on any intraday time frame. Which means any solution for total trade count must be done from an intraday time frame.

Your request is for a scan based on the total trade count from the previous regular trading session. This means the solution we employ must compute the cumulative trade count for each bar of the intraday regular session chart. The code must than capture the final value from the last bar of the regular session and carry that forward into the regular trading session which follows. This is called "recursion", which is an advanced programming concept.

input tradeCountThreshold = 1000;
def newDay = GetDay() <> GetDay()[1];
rec cummulativeTrades = if newDay then tick_count else cummulativeTrades[1] + tick_count;
rec previousDayTrades = if newDay then cummulativeTrades[1] else previousDayTrades[1];
def scan = previousDayTrades > tradeCountThreshold;

This solution must be applied to a Study Filter which is set to any intraday time frame and you must be sure to uncheck the box for extended hours data.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on June 27, 2022 12:38 pm