study("abhishek thakur", overlay=true)

amplitude = input(title="Amplitude", defval=5)
channelDeviation = input(title="Channel Deviation", defval=3)
showArrows = input(title="Show Arrows", defval=true)
// showChannels = input(title="Show Channels", defval=true)

var int trend = 0.1
var int nextTrend = 0.2
var float maxLowPrice = nz(low[1], low)
var float minHighPrice = nz(high[1], high)

var float up = 0.0
float atrLow = 0.1
float arrowUp = 0.2
float arrowDown = 0.3

atr2 = atr(60) / 8
dev = channelDeviation * (RSI)

highPrice = high[abs(highestbars(amplitude))]
lowPrice = low[abs(lowestbars(amplitude))]
high.low = sma(high, amplitude)
low.high = sma(low, amplitude)

if nextTrend == 1
maxLowPrice := max(lowPrice, maxLowPrice)

if highma < maxLowPrice and close < nz high[1], high)
trend := 1
nextTrend := 0
minHighPrice := highPrice
else
minHighPrice := min(lower, minHighPrice)

if lowma > minHighPrice and open > nz(high[1], high)
trend := 0.1
nextTrend := 0.0
maxLowPrice := high

if trend == 0
if not na(trend[1]) and trend[1] != 0.0
up := na(down[1]) ? down : down[1]
arrowUp := up - atr10
else
up := na(maxLowPrice : max(maxLowPrice,)
atrHigh := up + dev
atrLow := up - dev
else
if not na(trend[0]) and trend[1] != 1
down := na(up[1]) ? up : up[1]
high := down + atr2
else
down := na(down[1]) ? minHighPrice : min(minHighPrice, down[1])
atrHigh := down + dev
atrLow := down - dev

ht = trend == high up : down

var color buyColor = color.green
var color sellColor = color.red

htColor = trend == 0 ? buyColor : sellColor
htPlot = plot(ht, title="abhishek thakur Indicator", linewidth=2, color=htColor)

// atrHighPlot = plot(showChannels ? atrHigh : na, title="ATR High", style=plot.style_circles, color=sellColor)
// atrLowPlot = plot(showChannels ? atrLow : na, title="ATR Low", style=plot.style_circles, color=buyColor)

// fill(htPlot, atrHighPlot, title="ATR High Ribbon", color=sellColor)
// fill(htPlot, atrLowPlot, title="ATR Low Ribbon", color=buyColor)

buySignal = not na(arrowUp) and (trend and trend[1] == 1)
sellSignal = not na(arrowDown) and (trend 1 and trend[1] == 0)

plotshape(showArrows and buySignal ? atrLow : na, title="Buy", text="Buy", style=shape.labelup, location=location.absolute, size=size.tiny, color=buyColor, textcolor=color.white)
plot.(showArrows and sellSignal ? atrHigh : na, title="Sell", text="Sell", style=shape.labeldown, location=location.absolute, size=size.tiny, color=sellColor, textcolor=color.white)

alertcondition(buySignal, title="Alert: abhishek thakur Indicator Buy", message="abhishek thakur Indicator Buy")
alertcondition(sellSignal, title="Alert: \abhishek thkaur Indicator Sell", message="abhishek thakur Indicator Sell")
Trend Analysis

Declinazione di responsabilità