EMA 08:00
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © schroederjoa

// Some traders prefer to start the charts at 8am in the morning.
// This chart setting is not possible as of today, but the following script lets you calculate ema for a defined time range.
// Right now it is set to include bars from 08:00 to 1959, meaning thatlate post market and early pre market 04:00 to 07:59 is left out.

//@version=5
indicator("EMA 08:00", overlay=true)

// input definitions for period and timeframe
period = input.int(20, minval = 1)
timeframe = input.timeframe("5", "Timeframe")

// define time range that should be used to calculate indicators
t = time(timeframe.period, "0800-1959")

// disregard close values outside of time range 
close_filtered = not na(t) ? close : na

// define indicator function, feed filtered values
// USE ALTERNATIVE FUNCTION HERE TO APPLY FOR DIFFERENT INDICATORS
func = ta.ema(close_filtered, period)

// create higher timeframe function and plot
func_htf = request.security(syminfo.tickerid, timeframe, func)
plot(func_htf)