//version=6
indicator("Volume and Breakout Counter", overlay=false)
// Define the criteria
volumeThreshold = 9000000
breakoutThreshold = 0.04
// Define the time frames in trading days
twoYears = 252 * 2
oneYear = 252
sixMonths = 126
threeMonths = 63
oneMonth = 21
tenDays = 10
// Initialize counters
var int twoYearsCount = 0
var int oneYearCount = 0
var int sixMonthsCount = 0
var int threeMonthsCount = 0
var int oneMonthCount = 0
var int tenDaysCount = 0
// Function to count occurrences
countOccurrences(tf) =>
count = 0
for i = 0 to (tf - 1)
if volume >= volumeThreshold and (close - close[i+1]) / close[i+1] >= breakoutThreshold
count := count + 1
count
// Calculate the counts for each time frame
twoYearsCount := countOccurrences(twoYears)
oneYearCount := countOccurrences(oneYear)
sixMonthsCount := countOccurrences(sixMonths)
threeMonthsCount := countOccurrences(threeMonths)
oneMonthCount := countOccurrences(oneMonth)
tenDaysCount := countOccurrences(tenDays)
// Display the counts in a table format
var table results = table.new(position.bottom_right, 2, 7, border_width=1, border_color=color.gray)
table.cell(results, 0, 0, "Time Frame", bgcolor=color.gray)
table.cell(results, 1, 0, "Count", bgcolor=color.gray)
table.cell(results, 0, 1, "2 Years", bgcolor=color.white)
table.cell(results, 1, 1, str.tostring(twoYearsCount), bgcolor=color.white)
table.cell(results, 0, 2, "1 Year", bgcolor=color.white)
table.cell(results, 1, 2, str.tostring(oneYearCount), bgcolor=color.white)
table.cell(results, 0, 3, "6 Months", bgcolor=color.white)
table.cell(results, 1, 3, str.tostring(sixMonthsCount), bgcolor=color.white)
table.cell(results, 0, 4, "3 Months", bgcolor=color.white)
table.cell(results, 1, 4, str.tostring(threeMonthsCount), bgcolor=color.white)
table.cell(results, 0, 5, "1 Month", bgcolor=color.white)
table.cell(results, 1, 5, str.tostring(oneMonthCount), bgcolor=color.white)
table.cell(results, 0, 6, "10 Days", bgcolor=color.white)
table.cell(results, 1, 6, str.tostring(tenDaysCount), bgcolor=color.white)
indicator("Volume and Breakout Counter", overlay=false)
// Define the criteria
volumeThreshold = 9000000
breakoutThreshold = 0.04
// Define the time frames in trading days
twoYears = 252 * 2
oneYear = 252
sixMonths = 126
threeMonths = 63
oneMonth = 21
tenDays = 10
// Initialize counters
var int twoYearsCount = 0
var int oneYearCount = 0
var int sixMonthsCount = 0
var int threeMonthsCount = 0
var int oneMonthCount = 0
var int tenDaysCount = 0
// Function to count occurrences
countOccurrences(tf) =>
count = 0
for i = 0 to (tf - 1)
if volume >= volumeThreshold and (close - close[i+1]) / close[i+1] >= breakoutThreshold
count := count + 1
count
// Calculate the counts for each time frame
twoYearsCount := countOccurrences(twoYears)
oneYearCount := countOccurrences(oneYear)
sixMonthsCount := countOccurrences(sixMonths)
threeMonthsCount := countOccurrences(threeMonths)
oneMonthCount := countOccurrences(oneMonth)
tenDaysCount := countOccurrences(tenDays)
// Display the counts in a table format
var table results = table.new(position.bottom_right, 2, 7, border_width=1, border_color=color.gray)
table.cell(results, 0, 0, "Time Frame", bgcolor=color.gray)
table.cell(results, 1, 0, "Count", bgcolor=color.gray)
table.cell(results, 0, 1, "2 Years", bgcolor=color.white)
table.cell(results, 1, 1, str.tostring(twoYearsCount), bgcolor=color.white)
table.cell(results, 0, 2, "1 Year", bgcolor=color.white)
table.cell(results, 1, 2, str.tostring(oneYearCount), bgcolor=color.white)
table.cell(results, 0, 3, "6 Months", bgcolor=color.white)
table.cell(results, 1, 3, str.tostring(sixMonthsCount), bgcolor=color.white)
table.cell(results, 0, 4, "3 Months", bgcolor=color.white)
table.cell(results, 1, 4, str.tostring(threeMonthsCount), bgcolor=color.white)
table.cell(results, 0, 5, "1 Month", bgcolor=color.white)
table.cell(results, 1, 5, str.tostring(oneMonthCount), bgcolor=color.white)
table.cell(results, 0, 6, "10 Days", bgcolor=color.white)
table.cell(results, 1, 6, str.tostring(tenDaysCount), bgcolor=color.white)
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
