Big 8 Intraday TICK
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © BigGuavaTrading
//@version=5
indicator("Big 8 Intraday TICK", "Big 8 Intraday TICK", false) 

hline(0, "Zero line", color.black)  //sets 0 line

//Up ticks for each symbol
APup = request.security('AAPL', "", close) > request.security('AAPL', "", close[1]) ? 1 : 0
MEup = request.security('META', "", close) > request.security('META', "", close[1]) ? 1 : 0
MSup = request.security('MSFT', "", close) > request.security('MSFT', "", close[1]) ? 1 : 0
GLup = request.security('GOOGL', "", close) > request.security('GOOGL', "", close[1]) ? 1 : 0
AZup = request.security('AMZN', "", close) > request.security('AMZN', "", close[1]) ? 1 : 0
TSup = request.security('TSLA', "", close) > request.security('TSLA', "", close[1]) ? 1 : 0
NVup = request.security('NVDA', "", close) > request.security('NVDA', "", close[1]) ? 1 : 0
BRup = request.security('BRK.B', "", close) > request.security('BRK.B', "", close[1]) ? 1 : 0

//Down ticks for each symbol
APdn = request.security('AAPL', "", close) < request.security('AAPL', "", close[1]) ? 1 : 0
MEdn = request.security('META', "", close) < request.security('META', "", close[1]) ? 1 : 0
MSdn = request.security('MSFT', "", close) < request.security('MSFT', "", close[1]) ? 1 : 0
GLdn = request.security('GOOGL', "", close) < request.security('GOOGL', "", close[1]) ? 1 : 0
AZdn = request.security('AMZN', "", close) < request.security('AMZN', "", close[1]) ? 1 : 0
TSdn = request.security('TSLA', "", close) < request.security('TSLA', "", close[1]) ? 1 : 0
NVdn = request.security('NVDA', "", close) < request.security('NVDA', "", close[1]) ? 1 : 0
BRdn = request.security('BRK.B', "", close) < request.security('BRK.B', "", close[1]) ? 1 : 0

ticks = APup + MEup + MSup + GLup + AZup + TSup + NVup + BRup - APdn - MEdn - MSdn - GLdn - AZdn - TSdn - NVdn - BRdn //calculates all ticks

//set value at zero and reset at start of day
var cti = 0.0
isMarketOpen = time("1", "0931-1600", "America/New_York")

if isMarketOpen
    // Add ticks during market hours
    cti := cti + ticks
else
    // Reset at end of day
    cti := 0.0

c = cti > cti[1] ? color.green : color.red  //sets CTI color
plot(cti, 'Big 8 Cumulative Tick', c, 2, plot.style_line)  //plots CTI
ctiema = ta.ema(cti, input(15, "EMA of TICK")) //establish CTI EMA for smoothing
b = ctiema > ctiema[1] ? color.blue : color.orange //sets CTI EMA clor
plot(ctiema, "EMA of TICK", b, 3, plot.style_line) //plots CTI EMA

//End