testing 2

indicator("DTC-1.3.6 FINAL SCREEN CLONE (FIXED + STOCH RSI)", overlay=true,
max_labels_count=500, max_lines_count=100)
//━━━━━━━━━━━━━━━━━━━
// INPUTS
//━━━━━━━━━━━━━━━━━━━
ema1Len = input.int(9)
ema2Len = input.int(13)
ema3Len = input.int(21)
ema4Len = input.int(34)
ema5Len = input.int(55)
ema6Len = input.int(89)
// Stochastic RSI Inputs
rsiLen = input.int(14, "RSI Length")
stochLen = input.int(14, "Stoch Length")
smoothK = input.int(3, "Smooth K")
smoothD = input.int(3, "Smooth D")
atrLen = input.int(14)
tpStep = input.float(0.5, "TP ATR Step")
slMult = input.float(1.2, "SL ATR")
//━━━━━━━━━━━━━━━━━━━
// CALCULATIONS
//━━━━━━━━━━━━━━━━━━━
ema1 = ta.ema(close, ema1Len)
ema2 = ta.ema(close, ema2Len)
ema3 = ta.ema(close, ema3Len)
ema4 = ta.ema(close, ema4Len)
ema5 = ta.ema(close, ema5Len)
ema6 = ta.ema(close, ema6Len)
atr = ta.atr(atrLen)
//━━━━━━━━━━━━━━━━━━━
// STOCHASTIC RSI
//━━━━━━━━━━━━━━━━━━━
rsiVal = ta.rsi(close, rsiLen)
stochRSI = 100 * (rsiVal - ta.lowest(rsiVal, stochLen)) /
(ta.highest(rsiVal, stochLen) - ta.lowest(rsiVal, stochLen))
k = ta.sma(stochRSI, smoothK)
d = ta.sma(k, smoothD)
//━━━━━━━━━━━━━━━━━━━
// TREND LOGIC
//━━━━━━━━━━━━━━━━━━━
bull = ema1 > ema2 and ema2 > ema3 and ema3 > ema4 and ema4 > ema5
bear = ema1 < ema2 and ema2 < ema3 and ema3 < ema4 and ema4 < ema5
// STOCH RSI CONDITIONS
stochBuy = k < 30
stochSell = k > 70
buySignal = bull and not bull[1] and stochBuy
sellSignal = bear and not bear[1] and stochSell
//━━━━━━━━━━━━━━━━━━━
// EMA RIBBON
//━━━━━━━━━━━━━━━━━━━
plot(ema1, color=color.rgb(0,180,90), linewidth=2)
plot(ema2, color=color.rgb(0,170,85), linewidth=2)
plot(ema3, color=color.rgb(0,160,80), linewidth=2)
plot(ema4, color=color.rgb(0,150,75), linewidth=2)
plot(ema5, color=color.rgb(0,140,70), linewidth=2)
plot(ema6, color=color.rgb(0,130,65), linewidth=2)
//━━━━━━━━━━━━━━━━━━━
// BACKGROUND ZONES
//━━━━━━━━━━━━━━━━━━━
bgcolor(bull ? color.new(color.green, 85) : na)
bgcolor(bear ? color.new(color.red, 85) : na)
//━━━━━━━━━━━━━━━━━━━
// BUY / SELL LABELS
//━━━━━━━━━━━━━━━━━━━
if buySignal
label.new(bar_index, low, "BUY",
style=label.style_label_up,
color=color.rgb(0,160,90),
textcolor=color.white)
if sellSignal
label.new(bar_index, high, "SELL",
style=label.style_label_down,
color=color.rgb(200,0,0),
textcolor=color.white)
//━━━━━━━━━━━━━━━━━━━
// TP LADDER + LABELS
//━━━━━━━━━━━━━━━━━━━
var line tp1 = na
var line tp2 = na
var line tp3 = na
var line tp4 = na
var line tp5 = na
var line tp6 = na
var line sl = na
var label ltp1 = na
var label ltp2 = na
var label ltp3 = na
var label ltp4 = na
var label ltp5 = na
var label ltp6 = na
var label lsl = na
if buySignal or sellSignal
line.delete(tp1), line.delete(tp2), line.delete(tp3)
line.delete(tp4), line.delete(tp5), line.delete(tp6)
line.delete(sl)
label.delete(ltp1), label.delete(ltp2), label.delete(ltp3)
label.delete(ltp4), label.delete(ltp5), label.delete(ltp6)
label.delete(lsl)
base = close
dir = buySignal ? 1 : -1
tp1 := line.new(bar_index, base + dir*atr*tpStep*1, bar_index+200, base + dir*atr*tpStep*1, color=color.green)
tp2 := line.new(bar_index, base + dir*atr*tpStep*2, bar_index+200, base + dir*atr*tpStep*2, color=color.green)
tp3 := line.new(bar_index, base + dir*atr*tpStep*3, bar_index+200, base + dir*atr*tpStep*3, color=color.green)
tp4 := line.new(bar_index, base + dir*atr*tpStep*4, bar_index+200, base + dir*atr*tpStep*4, color=color.green)
tp5 := line.new(bar_index, base + dir*atr*tpStep*5, bar_index+200, base + dir*atr*tpStep*5, color=color.green)
tp6 := line.new(bar_index, base + dir*atr*tpStep*6, bar_index+200, base + dir*atr*tpStep*6, color=color.green)
sl := line.new(bar_index, base - dir*atr*slMult, bar_index+200, base - dir*atr*slMult, color=color.red)
ltp1 := label.new(bar_index+200, base + dir*atr*tpStep*1, "TP1", style=label.style_label_left, color=color.green, textcolor=color.white)
ltp2 := label.new(bar_index+200, base + dir*atr*tpStep*2, "TP2", style=label.style_label_left, color=color.green, textcolor=color.white)
ltp3 := label.new(bar_index+200, base + dir*atr*tpStep*3, "TP3", style=label.style_label_left, color=color.green, textcolor=color.white)
ltp4 := label.new(bar_index+200, base + dir*atr*tpStep*4, "TP4", style=label.style_label_left, color=color.green, textcolor=color.white)
ltp5 := label.new(bar_index+200, base + dir*atr*tpStep*5, "TP5", style=label.style_label_left, color=color.green, textcolor=color.white)
ltp6 := label.new(bar_index+200, base + dir*atr*tpStep*6, "TP6", style=label.style_label_left, color=color.green, textcolor=color.white)
lsl := label.new(bar_index+200, base - dir*atr*slMult, "SL", style=label.style_label_left, color=color.red, textcolor=color.white)
//━━━━━━━━━━━━━━━━━━━
// ALERTS
//━━━━━━━━━━━━━━━━━━━
alertcondition(buySignal, title="BUY", message="DTC BUY (Stoch RSI < 30) on {{ticker}} {{interval}}")
alertcondition(sellSignal, title="SELL", message="DTC SELL (Stoch RSI > 70) on {{ticker}} {{interval}}")
Tập lệnh chỉ hiển thị cho người được mời
Chỉ những người dùng được tác giả chấp thuận mới có thể truy cập tập lệnh này. Bạn sẽ cần yêu cầu và được cấp quyền sử dụng. Thông thường quyền này được cấp sau khi thanh toán. Để biết thêm chi tiết, làm theo hướng dẫn của tác giả bên dưới hoặc liên hệ trực tiếp với shahidp2p832.
TradingView KHÔNG khuyến nghị bạn trả phí hoặc sử dụng một tập lệnh trừ khi bạn hoàn toàn tin tưởng vào tác giả và hiểu cách hoạt động của tập lệnh. Bạn cũng có thể tìm các lựa chọn miễn phí, mã nguồn mở trong các script cộng đồng của chúng tôi.
Hướng dẫn của tác giả
Thông báo miễn trừ trách nhiệm
Tập lệnh chỉ hiển thị cho người được mời
Chỉ những người dùng được tác giả chấp thuận mới có thể truy cập tập lệnh này. Bạn sẽ cần yêu cầu và được cấp quyền sử dụng. Thông thường quyền này được cấp sau khi thanh toán. Để biết thêm chi tiết, làm theo hướng dẫn của tác giả bên dưới hoặc liên hệ trực tiếp với shahidp2p832.
TradingView KHÔNG khuyến nghị bạn trả phí hoặc sử dụng một tập lệnh trừ khi bạn hoàn toàn tin tưởng vào tác giả và hiểu cách hoạt động của tập lệnh. Bạn cũng có thể tìm các lựa chọn miễn phí, mã nguồn mở trong các script cộng đồng của chúng tôi.