Active Addresses
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © VanHelsing666

//@version=5
indicator("Active Addresses", shorttitle = "AASI")

active_adds = request.security("BTC_ACTIVEADDRESSES", "", close)

changes_price = (close - close[28])/close
changes_adres = (active_adds - active_adds[28])/active_adds

highest = ta.ema(ta.highest(changes_adres, 20), 5)
lowest  = ta.ema(ta.lowest(changes_adres, 20), 5)

plot(highest, color = color.rgb(255, 82, 82, 50), style = plot.style_circles)
plot(lowest, color = color.rgb(76, 175, 79, 50), style = plot.style_circles)

plot(changes_price, color = color.orange, linewidth = 2)
plot(changes_adres, color = color.rgb(120, 123, 134, 31))

tbl = table.new(position.middle_right, 10, 10)
table.cell(tbl, 0, 0, text = "28 Day Price Change (%)", text_color = color.gray)
table.cell(tbl, 1, 0, bgcolor = color.orange)
table.cell(tbl, 0, 1, text = "28 Day Active Addresses Change (%)", text_color = color.gray)
table.cell(tbl, 1, 1, bgcolor = color.gray)
