HT Momentum Indicator [ ZCrypto ]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TZack88

//@version=5
indicator("HT Momentum Indicator [ ZCrypto ]")
 
string ht_group                     = "HT Core"
string ht2_group                    = "HT Settings"
string sma_group                    = "SMA Settings"
string vwap_group                   = "VWAP Settings"
float src                           = input(hlc3, title="Source",group = ht_group,inline = "01")
int period                          = input(14, title="Period",group = ht_group,inline = "01")
color bull                          = input(color.green,group = ht_group,inline = "01")
color bear                          = input(color.red,group = ht_group,inline = "01")
bool showfast                       = input(false,"Show Fast❓",group = ht2_group,inline = "01")
int fastLength                      = input(9, title="Length",group = ht2_group,inline = "01")
color fast_color                    = input(color.rgb(216, 180, 64),title="",group = ht2_group,inline = "01")
bool showslow                       = input(false,"Show Slow❓",group = ht2_group,inline = "02")
int slowLength                      = input(26, title="Length",group = ht2_group,inline = "02")
color slow_color                    = input(color.rgb(0, 19, 230),title="",group = ht2_group,inline = "02")
bool showvwap                       = input(true,"Show VWAP❓",group = vwap_group,inline = "01")
int vwapLength                      = input(9, title="VWAP Length",group = vwap_group,inline = "01")
color vwap_cl                       = input(color.rgb(194, 61, 183),title="",group = vwap_group,inline = "01")

// Hyperbolic tangent Calculations-----------{
HT() => 
    _mom = ta.change(src, period)
    cal = (math.exp(2 * _mom) - 1) / (math.exp(2 * _mom) + 1)
    // momfilter = ta.sma(cal, Length)
//---------------}

momentum = HT()
fastema = ta.ema(momentum, fastLength)
slowema = ta.ema(momentum, slowLength)
vwap = ta.vwap(momentum, vwapLength) / 1.2
hist = fastema - slowema
//plotting-----------{

plot(hist, title="HT Momentum", linewidth=2,style=plot.style_histogram,color= hist > 0 ? bull : bear,editable = false,histbase = 0)
plot(showvwap ? vwap: na ,title = "VWAP",color=vwap_cl,editable = false)
plot(showfast ? fastema : na ,color=fast_color,editable = false)
plot(showslow ? slowema : na ,color=slow_color,editable = false)
hline(0,"Zero Line",color = color.rgb(214, 201, 17))
//-----------}

// Alerts -----------{
alertcondition(ta.crossover(fastema,slowema),"Fast Cross up Slow")
alertcondition(ta.crossover(vwap,0),"VWAP Momentum")
alertcondition( hist > 0 and hist[1] < 0,"Bull Momentum")
alertcondition( vwap > 0 and hist > 0 and hist[1] < 0,"Vwap/Bull Momentum")
//------------}