Karlos Alpha V11 Gentle - Dr Pnum AI | Auto Algo Trading Bot - UI VERSION
//@version=5
indicator("Karlos Alpha V11 Gentle - Dr Pnum AI | UI VERSION", overlay=true)
// --- INPUTS ---
sensitivity = input.float(2.4, "Signal Sharpness", minval=1.0, step=0.1)
atrPeriod = input.int(10, "Volatility Period")
tp_ratio = input.float(2.0, "Take Profit Ratio")
sl_ratio = input.float(1.2, "Stop Loss Ratio")
// --- CALCULATIONS ---
atr = ta.atr(atrPeriod)
nLoss = sensitivity * atr
var float trailStop = 0.0
trailStop := close > nz(trailStop[1], 0) and close[1] > nz(trailStop[1], 0) ? math.max(nz(trailStop[1]), close - nLoss) : close < nz(trailStop[1], 0) and close[1] < nz(trailStop[1], 0) ? math.min(nz(trailStop[1]), close + nLoss) : close > nz(trailStop[1], 0) ? close - nLoss : close + nLoss
var int pos = 0
pos := close > nz(trailStop[1], 0) and close[1] <= nz(trailStop[1], 0) ? 1 : close < nz(trailStop[1], 0) and close[1] >= nz(trailStop[1], 0) ? -1 : nz(pos[1], 0)
buySignal = pos == 1 and pos[1] == -1
sellSignal = pos == -1 and pos[1] == 1
// --- DITTO HUGE BUBBLE VISUALS ---
if buySignal
slPrice = close - (atr * sl_ratio)
tpPrice = close + (atr * tp_ratio)
// HUGE BUY BUBBLE
label.new(bar_index, low, "BUY", color=color.new(#00ff08, 0), textcolor=color.white, style=label.style_label_up, size=size.huge)
// LARGE TP/SL BOXES
label.new(bar_index, slPrice, "SL: " + str.tostring(math.round(slPrice, 2)), color=color.new(#1e1e1e, 0), textcolor=color.white, style=label.style_label_up, size=size.normal)
label.new(bar_index, tpPrice, "TP: " + str.tostring(math.round(tpPrice, 2)), color=color.new(#1e1e1e, 0), textcolor=color.white, style=label.style_label_down, size=size.normal)
if sellSignal
slPrice = close + (atr * sl_ratio)
tpPrice = close - (atr * tp_ratio)
// HUGE SELL BUBBLE
label.new(bar_index, high, "SELL", color=color.new(#ff0000, 0), textcolor=color.white, style=label.style_label_down, size=size.huge)
// LARGE TP/SL BOXES
label.new(bar_index, slPrice, "SL: " + str.tostring(math.round(slPrice, 2)), color=color.new(#1e1e1e, 0), textcolor=color.white, style=label.style_label_down, size=size.normal)
label.new(bar_index, tpPrice, "TP: " + str.tostring(math.round(tpPrice, 2)), color=color.new(#1e1e1e, 0), textcolor=color.white, style=label.style_label_up, size=size.normal)
// Dynamic Trend Line
plot(trailStop, color=pos == 1 ? color.new(color.green, 40) : color.new(color.red, 40), style=plot.style_linebr, linewidth=3)