Intraday Price change in Top 5 stocks
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
//@version=5

indicator('% change Top 5')

AAPL_close = request.security('AAPL', 'D', close)
AAPL_close_recent = request.security('AAPL', '1', close)

AMZN_close = request.security('AMZN', 'D', close)
AMZN_close_recent = request.security('AMZN', '1', close)

GOOGL_close = request.security('GOOGL', 'D', close)
GOOGL_close_recent = request.security('GOOGL', '1', close)

MSFT_close = request.security('MSFT', 'D', close)
MSFT_close_recent = request.security('MSFT', '1', close)

TSLA_close = request.security('TSLA', 'D', close)
TSLA_close_recent = request.security('TSLA', '1', close)



price_changeAAPL = (AAPL_close_recent - AAPL_close) / AAPL_close
price_changeAMZN = (AMZN_close_recent - AMZN_close) / AMZN_close
price_changeGOOGL = (GOOGL_close_recent - GOOGL_close) / GOOGL_close
price_changeMSFT = (MSFT_close_recent - MSFT_close) / MSFT_close
price_changeTSLA = (TSLA_close_recent - TSLA_close) / TSLA_close

price_change_bluechips = (price_changeAAPL + price_changeAMZN + price_changeGOOGL + price_changeMSFT + price_changeTSLA) / 5 * 100


plot(0)
plot(series=price_change_bluechips, style=plot.style_histogram, linewidth=3, color=close >= open ? color.green : color.red)



