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



//@version=4
study(title = 'Alpha Active Addresses from Glassnode' , shorttitle = 'Alpha Active Addr')



// ******************         ******************
// ******************         ******************
// ******************         ******************
// ******************         ******************
// ****************** Inputs  ******************
// ******************         ******************
// ******************         ******************
// ******************         ******************
// ******************         ******************
_use_sma = input(type = input.bool , title = 'Use Simple Moving Average Instead of Real Value' , defval = false , group = 'Simple Moving Average')
_sma_length = input(type = input.integer , title = 'Simple Moving Average Length' , defval = 7 , group = 'Simple Moving Average')

_use_ema = input(type = input.bool , title = 'Use Exponential Moving Average Instead of Real Value' , defval = false , group = 'Exponential Moving Average')
_ema_length = input(type = input.integer , title = 'Exponential Moving Average Length' , defval = 7 , group = 'Exponential Moving Average')



// ******************                      ******************
// ******************                      ******************
// ******************                      ******************
// ******************                      ******************
// ****************** Global Calcualtions  ******************
// ******************                      ******************
// ******************                      ******************
// ******************                      ******************
// ******************                      ******************



// *
// * Get Active Addresses Data
// *
_active_addresses = security('XTVCBTC_ACTIVEADDRESSES' , timeframe.period , _use_ema ? ema(close , _ema_length) : _use_sma ? sma(close , _sma_length) : close)



// *
// * Draw Lines
// *
plot(_active_addresses , style = plot.style_columns)