Alpha Max
Alpha Max
0 at
https://mozilla.org/MPL/2.0/
// author © CryptoWolf,@kivancozbilginc
// developer © CyrptoWolf,,@kivancozbilginc
//@version=5
indicator('AlphaTrend', shorttitle='AMax', overlay=true, format=format.price,
precision=2, timeframe='')
coeff = input.float(1, 'Multiplier', step=0.1)
AP = input(14, 'Common Period')
ATR = ta.sma(ta.tr, AP)
src = input(close)
showsignalsk = input(title='Show Signals?', defval=true)
novolumedata = input(title='Change calculation (no volume data)?', defval=false)
upT = low - ATR * coeff
downT = high + ATR * coeff
AlphaTrend = 0.0
AlphaTrend := (novolumedata ? ta.rsi(src, AP) >= 50 : ta.mfi(hlc3, AP) >= 50) ? upT
< nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : upT : downT > nz(AlphaTrend[1]) ?
nz(AlphaTrend[1]) : downT
trimaxlength =input(10,'AlphaMaxLength')
trimaxsrc = input(close)
//----
ama = 0.
hh = math.max(math.sign(ta.change(ta.highest(trimaxlength))),0)
ll = math.max(math.sign(ta.change(ta.lowest(trimaxlength))*-1),0)
tc = math.pow(ta.sma(hh or ll ? 1 : 0,trimaxlength),2)
ama := nz(ama[1]+tc*(trimaxsrc-ama[1]),src)
plot(ama,"Plot",#ff1100,2)
K1 = ta.barssince(buySignalk)
K2 = ta.barssince(sellSignalk)
O1 = ta.barssince(buySignalk[1])
O2 = ta.barssince(sellSignalk[1])