//@version=5
indicator(title = ' V1.0', shorttitle = ' V1.0', overlay = true)
src = close
// --- Slow EMA Length Inputs
len7 = input.int(30, minval = 1, title = 'Slow EMA 7')
len8 = input.int(35, minval = 1, title = 'Slow EMA 8')
len9 = input.int(40, minval = 1, title = 'Slow EMA 9')
len10 = input.int(45, minval = 1, title = 'Slow EMA 10')
len11 = input.int(50, minval = 1, title = 'Slow EMA 11')
len12 = input.int(60, minval = 1, title = 'Slow EMA 12')
// --- Slow EMA Calculation
ema7 = ta.ema(src, len7)
ema8 = ta.ema(src, len8)
ema9 = ta.ema(src, len9)
ema10 = ta.ema(src, len10)
ema11 = ta.ema(src, len11)
ema12 = ta.ema(src, len12)
// --- Slow EMA Color Rules
colslowL = ema7 > ema8 and ema8 > ema9 and ema9 > ema10 and ema10 > ema11 and ema11
> ema12
colslowS = ema7 < ema8 and ema8 < ema9 and ema9 < ema10 and ema10 < ema11 and ema11
< ema12
colFinal2 = colslowL ? color.lime : colslowS ? color.red : color.gray
// --- Slow EMA Plots
plot(ema7, title = 'Slow EMA 7', linewidth = 4, color = colFinal2)
plot(ema8, title = 'Slow EMA 8', linewidth = 3, color = colFinal2)
plot(ema9, title = 'Slow EMA 9', linewidth = 3, color = colFinal2)
plot(ema10, title = 'Slow EMA 10', linewidth = 3, color = colFinal2)
plot(ema11, title = 'Slow EMA 11', linewidth = 3, color = colFinal2)
plot(ema12, title = 'Slow EMA 12', linewidth = 4, color = colFinal2)
// --- Buy/Sell Signal Logic
buySignal = not colslowL[1] and colslowL
sellSignal = not colslowS[1] and colslowS
// --- Auto-Adjust Offset (Based on ATR)
atrValue = ta.atr(14)
offsetDynamic = atrValue * 0.5
// --- Plot Buy/Sell Labels
if buySignal
label.new(bar_index, ema7 - offsetDynamic, 'BUY', style = label.style_label_up,
yloc = yloc.price, color = color.green, textcolor = color.black, size = size.small)
if sellSignal
label.new(bar_index, ema7 + offsetDynamic, 'SELL', style =
label.style_label_down, yloc = yloc.price, color = color.red, textcolor =
color.black, size = size.small)
// --- Alert Conditions
alertcondition(buySignal, title = 'Buy Alert', message = 'Buy Signal Triggered')
alertcondition(sellSignal, title = 'Sell Alert', message = 'Sell Signal Triggered')
// --- TEAM7 Label (Single Persistent)
var label lbl = na
if na(lbl)
lbl := label.new(bar_index, close, "TEAM7", color=color.blue,
textcolor=color.white, size=size.tiny, style=label.style_label_down,
xloc=xloc.bar_index, yloc=yloc.price, tooltip="TEAM7 Indicator")
else
label.set_x(lbl, bar_index)
label.set_y(lbl, close)
// === TP, Entry, StopLoss Logic ===
stopLossVal = input.float(0.25, title="Stop Loss %", minval=0)
tp1Multiplier = input.float(1.0, "TP1 Multiplier", minval=0, step=0.1)
tp2Multiplier = input.float(2.0, "TP2 Multiplier", minval=0, step=0.1)
tp3Multiplier = input.float(3.0, "TP3 Multiplier", minval=0, step=0.1)
tp4Multiplier = input.float(4.0, "TP4 Multiplier", minval=0, step=0.1)
tp5Multiplier = input.float(5.0, "TP5 Multiplier", minval=0, step=0.1)
tp6Multiplier = input.float(6.0, "TP6 Multiplier", minval=0, step=0.1)
tp7Multiplier = input.float(7.0, "TP7 Multiplier", minval=0, step=0.1)
tp8Multiplier = input.float(8.0, "TP8 Multiplier", minval=0, step=0.1)
lineLength = input.int(5, "Line Length (bars)", minval=1, maxval=50)
var int posOffset = 2
var float entry = na
var float stopLoss = na
var float tp1 = na
var float tp2 = na
var float tp3 = na
var float tp4 = na
var float tp5 = na
var float tp6 = na
var float tp7 = na
var float tp8 = na
var line entryLine = na
var line stopLossLine = na
var line tp1Line = na
var line tp2Line = na
var line tp3Line = na
var line tp4Line = na
var line tp5Line = na
var line tp6Line = na
var line tp7Line = na
var line tp8Line = na
var label entryLabel = na
var label stopLossLabel = na
var label tp1Label = na
var label tp2Label = na
var label tp3Label = na
var label tp4Label = na
var label tp5Label = na
var label tp6Label = na
var label tp7Label = na
var label tp8Label = na
// Reuse buySignal/sellSignal for long/short
long_signal = buySignal
short_signal = sellSignal
if long_signal or short_signal
entry := close
if long_signal
stopLoss := entry * (1 - stopLossVal / 100)
tp1 := entry * (1 + stopLossVal * tp1Multiplier/100)
tp2 := entry * (1 + stopLossVal * tp2Multiplier/100)
tp3 := entry * (1 + stopLossVal * tp3Multiplier/100)
tp4 := entry * (1 + stopLossVal * tp4Multiplier/100)
tp5 := entry * (1 + stopLossVal * tp5Multiplier / 100)
tp6 := entry * (1 + stopLossVal * tp6Multiplier / 100)
tp7 := entry * (1 + stopLossVal * tp7Multiplier / 100)
tp8 := entry * (1 + stopLossVal * tp8Multiplier / 100)
if short_signal
stopLoss := entry * (1 + stopLossVal / 100)
tp1 := entry * (1 - stopLossVal * tp1Multiplier/100)
tp2 := entry * (1 - stopLossVal * tp2Multiplier/100)
tp3 := entry * (1 - stopLossVal * tp3Multiplier/100)
tp4 := entry * (1 - stopLossVal * tp4Multiplier/100)
tp5 := entry * (1 - stopLossVal * tp5Multiplier / 100)
tp6 := entry * (1 - stopLossVal * tp6Multiplier / 100)
tp7 := entry * (1 - stopLossVal * tp7Multiplier / 100)
tp8 := entry * (1 - stopLossVal * tp8Multiplier / 100)
// Remove previous lines/labels
if not na(entryLine)
line.delete(entryLine)
if not na(stopLossLine)
line.delete(stopLossLine)
if not na(tp1Line)
line.delete(tp1Line)
if not na(tp2Line)
line.delete(tp2Line)
if not na(tp3Line)
line.delete(tp3Line)
if not na(tp4Line)
line.delete(tp4Line)
if not na(tp5Line)
line.delete(tp5Line)
if not na(tp6Line)
line.delete(tp6Line)
if not na(tp7Line)
line.delete(tp7Line)
if not na(tp8Line)
line.delete(tp8Line)
if not na(entryLabel)
label.delete(entryLabel)
if not na(stopLossLabel)
label.delete(stopLossLabel)
if not na(tp1Label)
label.delete(tp1Label)
if not na(tp2Label)
label.delete(tp2Label)
if not na(tp3Label)
label.delete(tp3Label)
if not na(tp4Label)
label.delete(tp4Label)
if not na(tp5Label)
label.delete(tp5Label)
if not na(tp6Label)
label.delete(tp6Label)
if not na(tp7Label)
label.delete(tp7Label)
if not na(tp8Label)
label.delete(tp8Label)
// Create new lines & labels
entryLine := line.new(bar_index, entry, bar_index+lineLength, entry,
color=color.blue, width=2)
stopLossLine := line.new(bar_index, stopLoss, bar_index+lineLength, stopLoss,
color=color.red, width=2, style=line.style_dotted)
tp1Line := line.new(bar_index, tp1, bar_index+lineLength, tp1,
color=color.green, width=1)
tp2Line := line.new(bar_index, tp2, bar_index+lineLength, tp2,
color=color.green, width=1)
tp3Line := line.new(bar_index, tp3, bar_index+lineLength, tp3,
color=color.green, width=1)
tp4Line := line.new(bar_index, tp4, bar_index+lineLength, tp4,
color=color.green, width=1)
tp5Line := line.new(bar_index, tp5, bar_index+lineLength, tp5,
color=color.green, width=1)
tp6Line := line.new(bar_index, tp6, bar_index+lineLength, tp6,
color=color.green, width=1)
tp7Line := line.new(bar_index, tp7, bar_index+lineLength, tp7,
color=color.green, width=1)
tp8Line := line.new(bar_index, tp8, bar_index+lineLength, tp8,
color=color.green, width=1)
entryLabel := label.new(bar_index+posOffset, entry, "ENTRY\n" +
str.tostring(entry, format.mintick), color=color.blue, textcolor=color.white,
style=label.style_label_left, yloc=yloc.price, size=size.small)
stopLossLabel := label.new(bar_index+posOffset, stopLoss, "SL\n" +
str.tostring(stopLoss, format.mintick), color=color.red, textcolor=color.white,
style=label.style_label_left, yloc=yloc.price, size=size.small)
tp1Label := label.new(bar_index+posOffset, tp1, "TP1\n" + str.tostring(tp1,
format.mintick), color=color.green, textcolor=color.white,
style=label.style_label_left, yloc=yloc.price, size=size.small)
tp2Label := label.new(bar_index+posOffset, tp2, "TP2\n" + str.tostring(tp2,
format.mintick), color=color.green, textcolor=color.white,
style=label.style_label_left, yloc=yloc.price, size=size.small)
tp3Label := label.new(bar_index+posOffset, tp3, "TP3\n" + str.tostring(tp3,
format.mintick), color=color.green, textcolor=color.white,
style=label.style_label_left, yloc=yloc.price, size=size.small)
tp4Label := label.new(bar_index+posOffset, tp4, "TP4\n" + str.tostring(tp4,
format.mintick), color=color.green, textcolor=color.white,
style=label.style_label_left, yloc=yloc.price, size=size.small)
tp5Label := label.new(bar_index+posOffset, tp5, "TP5\n" + str.tostring(tp5,
format.mintick), color=color.green, textcolor=color.white,
style=label.style_label_left, yloc=yloc.price, size=size.small)
tp6Label := label.new(bar_index+posOffset, tp6, "TP6\n" + str.tostring(tp6,
format.mintick), color=color.green, textcolor=color.white,
style=label.style_label_left, yloc=yloc.price, size=size.small)
tp7Label := label.new(bar_index+posOffset, tp7, "TP7\n" + str.tostring(tp7,
format.mintick), color=color.green, textcolor=color.white,
style=label.style_label_left, yloc=yloc.price, size=size.small)
tp8Label := label.new(bar_index+posOffset, tp8, "TP8\n" + str.tostring(tp8,
format.mintick), color=color.green, textcolor=color.white,
style=label.style_label_left, yloc=yloc.price, size=size.small)
// Extend lines and labels each bar
if not na(entryLine)
line.set_x2(entryLine, bar_index + lineLength)
if not na(stopLossLine)
line.set_x2(stopLossLine, bar_index + lineLength)
if not na(tp1Line)
line.set_x2(tp1Line, bar_index + lineLength)
if not na(tp2Line)
line.set_x2(tp2Line, bar_index + lineLength)
if not na(tp3Line)
line.set_x2(tp3Line, bar_index + lineLength)
if not na(tp4Line)
line.set_x2(tp4Line, bar_index + lineLength)
if not na(tp5Line)
line.set_x2(tp5Line, bar_index + lineLength)
if not na(tp6Line)
line.set_x2(tp6Line, bar_index + lineLength)
if not na(tp7Line)
line.set_x2(tp7Line, bar_index + lineLength)
if not na(tp8Line)
line.set_x2(tp8Line, bar_index + lineLength)
if not na(entryLabel)
label.set_x(entryLabel, bar_index + lineLength)
if not na(stopLossLabel)
label.set_x(stopLossLabel, bar_index + lineLength)
if not na(tp1Label)
label.set_x(tp1Label, bar_index + lineLength)
if not na(tp2Label)
label.set_x(tp2Label, bar_index + lineLength)
if not na(tp3Label)
label.set_x(tp3Label, bar_index + lineLength)
if not na(tp4Label)
label.set_x(tp4Label, bar_index + lineLength)
if not na(tp5Label)
label.set_x(tp5Label, bar_index + lineLength)
if not na(tp6Label)
label.set_x(tp6Label, bar_index + lineLength)
if not na(tp7Label)
label.set_x(tp7Label, bar_index + lineLength)
if not na(tp8Label)
label.set_x(tp8Label, bar_index + lineLength)