Nas Infinity Algo (STR)
Nas Infinity Algo (STR)
Periods = 40
src = hl2
Multiplier = input.float(title='Sensitivity', step=0.1, defval=7.2)
changeATR = true
showsignals = input(title='Show Buy/Sell Signals ?', defval=true)
highlighting = input(title='Highlighter On/Off ?', defval=false)
atr2 = ta.sma(ta.tr, Periods)
atr = changeATR ? ta.atr(Periods) : atr2
up = src - Multiplier * atr
up1 = nz(up[1], up)
up := close[1] > up1 ? math.max(up, up1) : up
dn = src + Multiplier * atr
dn1 = nz(dn[1], dn)
dn := close[1] < dn1 ? math.min(dn, dn1) : dn
trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
// Peak Profit
import protradingart/pta_plot/6 as pp
pp.peakprofit(longCondition, shortCondition)