OPEN-SOURCE SCRIPT
TAK Indicators by Khoa

//version=6
indicator("TAK Indicators by Khoa ", overlay=true)
// === EMA ===
ema10 = ta.ema(close, 10)
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)
plot(ema10, "EMA 10", color=color.green)
plot(ema21, "EMA 21", color=color.orange)
plot(ema50, "EMA 50", color=color.red)
// === Trend check
isUpTrend = ema10 > ema21 and ema21 > ema50
isDownTrend = ema10 < ema21 and ema21 < ema50
// === RSI
rsi = ta.rsi(close, 14)
rsiBull = ta.crossover(rsi, 50)
rsiBear = ta.crossunder(rsi, 50)
// === Confirmation candle
bullCandle = close > open
bearCandle = close < open
priceConfirmBuy = close > ema10 and close > ema21 and bullCandle
priceConfirmSell = close < ema10 and close < ema21 and bearCandle
// === State machine
var bool inLong = false
var bool inShort = false
buySignal = false
sellSignal = false
if isUpTrend and rsiBull and priceConfirmBuy and not inLong
buySignal := true
inLong := true
inShort := false
else
buySignal := false
if isDownTrend and rsiBear and priceConfirmSell and not inShort
sellSignal := true
inShort := true
inLong := false
else
sellSignal := false
// === DÍNH LABEL DỰA THEO GIÁ (KHÔNG BỊ TRƯỢT ZOOM DỌC)
if buySignal
label.new(bar_index, low - (syminfo.mintick * 10), "B", style=label.style_label_up, color=color.green, textcolor=color.white, size=size.small)
if sellSignal
label.new(bar_index, high + (syminfo.mintick * 10), "S", style=label.style_label_down, color=color.red, textcolor=color.white, size=size.small)
// === Nền trend
bgcolor(isUpTrend ? color.new(color.green, 90) : na)
bgcolor(isDownTrend ? color.new(color.red, 90) : na)
indicator("TAK Indicators by Khoa ", overlay=true)
// === EMA ===
ema10 = ta.ema(close, 10)
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)
plot(ema10, "EMA 10", color=color.green)
plot(ema21, "EMA 21", color=color.orange)
plot(ema50, "EMA 50", color=color.red)
// === Trend check
isUpTrend = ema10 > ema21 and ema21 > ema50
isDownTrend = ema10 < ema21 and ema21 < ema50
// === RSI
rsi = ta.rsi(close, 14)
rsiBull = ta.crossover(rsi, 50)
rsiBear = ta.crossunder(rsi, 50)
// === Confirmation candle
bullCandle = close > open
bearCandle = close < open
priceConfirmBuy = close > ema10 and close > ema21 and bullCandle
priceConfirmSell = close < ema10 and close < ema21 and bearCandle
// === State machine
var bool inLong = false
var bool inShort = false
buySignal = false
sellSignal = false
if isUpTrend and rsiBull and priceConfirmBuy and not inLong
buySignal := true
inLong := true
inShort := false
else
buySignal := false
if isDownTrend and rsiBear and priceConfirmSell and not inShort
sellSignal := true
inShort := true
inLong := false
else
sellSignal := false
// === DÍNH LABEL DỰA THEO GIÁ (KHÔNG BỊ TRƯỢT ZOOM DỌC)
if buySignal
label.new(bar_index, low - (syminfo.mintick * 10), "B", style=label.style_label_up, color=color.green, textcolor=color.white, size=size.small)
if sellSignal
label.new(bar_index, high + (syminfo.mintick * 10), "S", style=label.style_label_down, color=color.red, textcolor=color.white, size=size.small)
// === Nền trend
bgcolor(isUpTrend ? color.new(color.green, 90) : na)
bgcolor(isDownTrend ? color.new(color.red, 90) : na)
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.