本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KingDonut
//@version=6
indicator("Krispy Scalper by KingDonut", shorttitle="Krispy Scalper by KD", overlay=true)
// ============================================================
// KRISPY SCALPER BY KINGDONUT - five indicators in one
//
// 1. Trendbox - smoothed trend line (candles or line). Buy above, sell below.
// 2. Mr Scalpy - slow + fast trend lines. Green = buy above, red = sell below.
// 3. Dynamic Trader candles - candle colouring: green = buy, red = sell, white = no trade.
// 4. Target - suggested target from recent behaviour + "stop too wide" warning.
// 5. Trend Bias MA - blended moving average that changes colour with its slope.
//
// Every element has its own tick box in "Show / hide", so use them together
// (best) or on their own.
//
// NOTES
// - Built for intraday charts. The Target box learns typical movement by
// time of day, so it needs minute-based timeframes to make sense.
// - Target uses the Dynamic Trader signal, Mr Scalpy and Trendbox for its entry rule,
// even when those elements are hidden.
// - Educational use only. Not financial advice.
// ============================================================
// ============================================================
// SHOW / HIDE (every element has its own tick box, all ON by default)
// ============================================================
gOn = "Show / hide"
showTrendbox = input.bool(true, "Trendbox", group=gOn, inline="tb", tooltip="Buy above, sell below. Choose boxes (candles) or line with the dropdown.")
drawAs = input.string("Candles", "", options=["Candles", "Line"], group=gOn, inline="tb")
showScalpy = input.bool(true, "Mr Scalpy", group=gOn, tooltip="Buy above when the lines are green, sell below when the lines are red.")
showDT = input.bool(true, "Dynamic Trader candles", group=gOn, tooltip="Colours the normal price candles (green = buy, red = sell, white = no trade). Target still uses the signal when this is off.")
showTarget = input.bool(true, "Target", group=gOn, tooltip="Shows a suggested target based on current behaviour, and warns if the stop looks too far for the move.")
showMA = input.bool(true, "Trend Bias MA", group=gOn, tooltip="Uses KingDonut's Crazy MA by default to give a trend bias.")
// ============================================================
// INPUTS: TRENDBOX
// ============================================================
gMain = "Trendbox"
srcType = input.string("close", "Price source", options=["close", "hl2", "hlc3", "ohlc4"], group=gMain)
len = input.int(15, "Length", minval=2, group=gMain, tooltip="Higher = smoother and later")
delay = input.int(1, "Delay (bars)", minval=0, maxval=15, group=gMain, tooltip="Pushes the turns later without flattening the curve")
sens = input.float(0.2, "Colour sensitivity (lower = more vivid)", minval=0.01, step=0.01, group=gMain)
gCol = "Trendbox colours"
blueC = input.color(#2196F3, "Up / BUY colour", group=gCol)
orangeC = input.color(#FF9800, "Down / SELL colour", group=gCol)
whiteC = input.color(#FFFFFF, "Neutral / flat colour", group=gCol)
// ============================================================
// INPUTS: DYNAMIC TRADER CANDLES
// ============================================================
grpDT = "Dynamic Trader candles"
holdCol = input.bool(true, title="Hold colour until the opposite signal", tooltip="On: a green run stays green through any no-trade candles until a sell signal fires, and the same the other way round. Off: original green / white / red behaviour.", group=grpDT)
colBuy = input.color(color.green, title="Buy candle", group=grpDT)
colSell = input.color(color.red, title="Sell candle", group=grpDT)
colNone = input.color(color.white, title="No-trade candle", group=grpDT)
// ============================================================
// INPUTS: TARGET
// ============================================================
gTgt = "Target"
bucketMin = input.int(15, "Time bucket (minutes)", minval=5, maxval=60, group=gTgt, tooltip="Time-of-day slice used to learn typical movement")
lookDays = input.int(30, "Days to learn from", minval=5, maxval=100, group=gTgt)
holdMin = input.int(10, "Typical hold (minutes)", minval=1, group=gTgt, tooltip="Window used to measure how far price travels")
pctl = input.int(50, "Percentile of typical move", minval=10, maxval=90, group=gTgt, tooltip="50 = median. Lower = safer, smaller target")
tgtFrac = input.float(0.5, "Target as fraction of move", minval=0.1, maxval=1.0, step=0.05, group=gTgt, tooltip="Travel range is a ceiling. 0.4-0.6 is a sensible target")
liveWt = input.float(0.5, "Live volatility weight", minval=0.0, maxval=1.0, step=0.1, group=gTgt, tooltip="0 = ignore today's activity. 1 = fully scale by it")
roundTo = input.int(1,"Round target to (points)", minval=1, group=gTgt)
maxBE = input.float(65.0, "Warn if break-even win rate above (%)", minval=30.0, maxval=95.0, group=gTgt)
gTbl = "Target box"
tblPos = input.string("Bottom Right", "Position", options=["Top Left", "Top Right", "Middle Left", "Middle Right", "Bottom Left", "Bottom Right"], group=gTbl)
// ============================================================
// INPUTS: TREND BIAS MA
// ============================================================
gMA = "Trend Bias MA"
useCombined = input.bool(true, "Combined MA", group=gMA, tooltip="ON = blend all the moving averages into one line (see Combined MA Settings). OFF = use the single MA Type selected below.")
maLength = input.int(100, "MA Length", minval=1, group=gMA)
maType = input.string("SMA", "MA Type (when Combined is off)", options=["SMA", "EMA", "HMA", "VWMA", "ALMA", "SMMA", "WMA", "DEMA", "TEMA", "ZLEMA", "T3", "LSMA", "McGinley"], group=gMA)
colorUp = input.color(color.green, "Up Color", group=gMA)
colorFlat = input.color(color.white, "Flat Color", group=gMA)
colorDown = input.color(color.red, "Down Color", group=gMA)
almaOffset = input.float(0.85, "ALMA Offset", minval=0, maxval=1, group="ALMA Settings")
almaSigma = input.float(6, "ALMA Sigma", minval=0, group="ALMA Settings")
t3VolumeFactor = input.float(0.7, "T3 Volume Factor", minval=0, maxval=1, group="T3 Settings")
avgMethod = input.string("Weighted Mean", "Averaging Method", options=["Weighted Mean", "Mean", "Median", "Highest", "Lowest", "Mid-Range", "Trimmed Mean", "Geometric Mean"], group="Combined MA Settings", tooltip="How the moving averages are blended together.\n\nWeighted Mean: uses the weights below.\nMean: simple average.\nMedian: middle value.\nHighest / Lowest: the top or bottom MA.\nMid-Range: (highest + lowest) / 2.\nTrimmed Mean: mean after dropping the top and bottom MAs (see Trim %).\nGeometric Mean: multiplicative average.\n\nA weight of 0 removes that MA from every method. Weights only change the result in Weighted Mean mode.")
trimPct = input.float(20, "Trim % (Trimmed Mean)", minval=0, maxval=49, step=5, group="Combined MA Settings", tooltip="Percentage of MAs dropped from each end before averaging.")
flatTolerance = input.float(0.01, "Flat Tolerance", step=0.001, group="Combined MA Settings")
weightSMA = input.float(1.0, "SMA Weight", step=0.1, group="Combined MA Weights")
weightEMA = input.float(1.0, "EMA Weight", step=0.1, group="Combined MA Weights")
weightHMA = input.float(1.0, "HMA Weight", step=0.1, group="Combined MA Weights")
weightVWMA = input.float(1.0, "VWMA Weight", step=0.1, group="Combined MA Weights")
weightALMA = input.float(1.0, "ALMA Weight", step=0.1, group="Combined MA Weights")
weightSMMA = input.float(1.0, "SMMA Weight", step=0.1, group="Combined MA Weights")
weightWMA = input.float(1.0, "WMA Weight", step=0.1, group="Combined MA Weights")
weightDEMA = input.float(1.0, "DEMA Weight", step=0.1, group="Combined MA Weights")
weightTEMA = input.float(1.0, "TEMA Weight", step=0.1, group="Combined MA Weights")
weightZLEMA = input.float(1.0, "ZLEMA Weight", step=0.1, group="Combined MA Weights")
weightT3 = input.float(1.0, "T3 Weight", step=0.1, group="Combined MA Weights")
weightLSMA = input.float(1.0, "LSMA Weight", step=0.1, group="Combined MA Weights")
weightMcGinley = input.float(1.0, "McGinley Weight", step=0.1, group="Combined MA Weights")
// ============================================================
// TRENDBOX: PRICE SOURCE
// ============================================================
src = switch srcType
"hl2" => hl2
"hlc3" => hlc3
"ohlc4" => ohlc4
=> close
// ============================================================
// TRENDBOX: 2-pole Super Smoother
// ============================================================
ssA = math.exp(-1.414 * math.pi / len)
ssB = 2 * ssA * math.cos(1.414 * math.pi / len)
ssC2 = ssB
ssC3 = -ssA * ssA
ssC1 = 1 - ssC2 - ssC3
float ss = na
ss := bar_index < 4 ? src : ssC1 * (src + src[1]) / 2 + ssC2 * nz(ss[1], src) + ssC3 * nz(ss[2], src)
sm = ss[delay]
// Slope -> colour (blue up, orange down, white flat)
slope = sm - sm[1]
norm = slope / ta.atr(14)
tbCol = norm >= 0
? color.from_gradient(norm, 0, sens, whiteC, blueC)
: color.from_gradient(norm, -sens, 0, orangeC, whiteC)
// ============================================================
// TRENDBOX: DRAW
// ============================================================
plot(showTrendbox and drawAs == "Line" ? sm : na, "Trendbox line", color=tbCol, linewidth=3)
o = showTrendbox and drawAs == "Candles" ? sm[1] : na
c = showTrendbox and drawAs == "Candles" ? sm : na
plotcandle(o, math.max(o, c), math.min(o, c), c,
title="Trendbox", color=tbCol, wickcolor=tbCol, bordercolor=tbCol)
// ============================================================
// MR SCALPY SETTINGS (hardcoded)
// Two trend lines (slow + fast) that tighten or widen with a TSI reading.
// Line colour: green when TSI is above its signal line, red when below.
// ============================================================
slow_period = 48
slow_mult = 3.4
fast_period = 30
fast_mult = 2.6
tsi_long = 13
tsi_short = 8
tsi_signal = 5
tsi_weight = 1.5
use_cap = true
cap_scale = 0.01
// ============================================================
// MR SCALPY: TSI CALCULATION
// ============================================================
double_smooth(s, l, sh) =>
ta.ema(ta.ema(s, l), sh)
pc = ta.change(close)
tsi_value = 100 * (double_smooth(pc, tsi_long, tsi_short) / double_smooth(math.abs(pc), tsi_long, tsi_short))
tsi_signal_value = ta.ema(tsi_value, tsi_signal)
tsi_bullish = tsi_value > tsi_signal_value
// ============================================================
// MR SCALPY: DYNAMIC MULTIPLIER SCALING
// ============================================================
tsi_norm = math.min(math.abs(tsi_value) / 100.0, 1.0)
raw_scale = 1.0 - tsi_norm * tsi_weight
tsi_scale = use_cap ? math.max(raw_scale, cap_scale) : math.max(raw_scale, 0.0)
slow_dynamic_mult = slow_mult * tsi_scale
fast_dynamic_mult = fast_mult * tsi_scale
// ============================================================
// MR SCALPY: SOURCES AND ATR
// ============================================================
slow_src = (open + high + low + close) / 4.0
fast_src = (high + low) / 2.0
slow_atr = ta.atr(slow_period)
fast_atr = ta.atr(fast_period)
// ============================================================
// MR SCALPY: SLOW LINE
// ============================================================
slow_upper = slow_src + slow_dynamic_mult * slow_atr
slow_lower = slow_src - slow_dynamic_mult * slow_atr
var float slow_trend = na
var int slow_d = 1
slow_prev = nz(slow_trend[1], slow_lower)
slow_trend := slow_d[1] == 1 ? math.max(slow_lower, slow_prev) : math.min(slow_upper, slow_prev)
slow_d := close > slow_trend ? 1 : close < slow_trend ? -1 : nz(slow_d[1], 1)
slow_trend := slow_d == 1 ? math.max(slow_lower, slow_prev) : math.min(slow_upper, slow_prev)
// ============================================================
// MR SCALPY: FAST LINE
// ============================================================
fast_upper = fast_src + fast_dynamic_mult * fast_atr
fast_lower = fast_src - fast_dynamic_mult * fast_atr
var float fast_trend = na
var int fast_d = 1
fast_prev = nz(fast_trend[1], fast_lower)
fast_trend := fast_d[1] == 1 ? math.max(fast_lower, fast_prev) : math.min(fast_upper, fast_prev)
fast_d := close > fast_trend ? 1 : close < fast_trend ? -1 : nz(fast_d[1], 1)
fast_trend := fast_d == 1 ? math.max(fast_lower, fast_prev) : math.min(fast_upper, fast_prev)
// ============================================================
// MR SCALPY: PLOTS
// ============================================================
line_color = tsi_bullish ? color.green : color.red
plot(showScalpy ? slow_trend : na, "Slow line", color=line_color, linewidth=2)
plot(showScalpy ? fast_trend : na, "Fast line", color=line_color, linewidth=2)
// ============================================================
// DYNAMIC TRADER CANDLES
// Own Bollinger settings (EMA 21), calculated only, not plotted
// ============================================================
dtLength = 21
dtBasis = ta.ema(close, dtLength)
dtStd = ta.stdev(close, dtLength)
bb2Upper = dtBasis + 2.0 * dtStd // outer band
bb2Lower = dtBasis - 2.0 * dtStd
bb1Upper = dtBasis + 1.0 * dtStd // yellow band
bb1Lower = dtBasis - 1.0 * dtStd
bb01Upper = dtBasis + 0.1 * dtStd // middle lines
bb01Lower = dtBasis - 0.1 * dtStd
// PSAR - default settings, calculated only
psarVal = ta.sar(0.02, 0.02, 0.2)
psarBelow = psarVal < close
psarAbove = psarVal > close
// State: 1 = buy, -1 = sell, 0 = nothing
var int state = 0
// Exits: PSAR flips, or price closes past the far 0.1 band
if state == 1 and (psarAbove or close < bb01Lower)
state := 0
if state == -1 and (psarBelow or close > bb01Upper)
state := 0
// Entry 1: PSAR outside the 2.0 band -> instant signal
// Entry 2: PSAR inside the 2.0 band -> wait for price past the yellow 1.0 band
bullOK = close > bb01Upper and psarBelow and (psarVal < bb2Lower or close > bb1Upper)
bearOK = close < bb01Lower and psarAbove and (psarVal > bb2Upper or close < bb1Lower)
if state == 0 and bullOK
state := 1
else if state == 0 and bearOK
state := -1
// Held colour: latches the last buy/sell signal, only the opposite signal clears it
var int heldState = 0
if state == 1
heldState := 1
else if state == -1
heldState := -1
dispState = holdCol ? heldState : state
barcolor(showDT ? (dispState == 1 ? colBuy : dispState == -1 ? colSell : colNone) : na, title="DT Candle Colour")
// ============================================================
// TARGET: ENTRY RULE
// Long : Dynamic Trader candle is BUY AND price above Scalpy slow, Scalpy fast and Trendbox
// Short : Dynamic Trader candle is SELL AND price below all three lines
// ============================================================
longOk = dispState == 1 and close > slow_trend and close > fast_trend and close > sm
shortOk = dispState == -1 and close < slow_trend and close < fast_trend and close < sm
int dir = longOk ? 1 : shortOk ? -1 : 0
// ============================================================
// TARGET: STOP = furthest valid line on the correct side of price
// ============================================================
float stopPx = na
if dir == 1
float best = na
if slow_trend < close
best := slow_trend
if fast_trend < close and (na(best) or fast_trend < best)
best := fast_trend
if sm < close and (na(best) or sm < best)
best := sm
stopPx := best
else if dir == -1
float best = na
if slow_trend > close
best := slow_trend
if fast_trend > close and (na(best) or fast_trend > best)
best := fast_trend
if sm > close and (na(best) or sm > best)
best := sm
stopPx := best
stopDist = na(stopPx) ? na : math.abs(close - stopPx)
// ============================================================
// TARGET: TIME-OF-DAY MOVEMENT PROFILE
// Each bucket stores one average "N-minute travel range" per day.
// The target = typical move for this time of day x fraction x live volatility.
// "Stop too wide" = the win rate needed to break even is above the warning level.
// ============================================================
tfMin = timeframe.in_seconds() / 60.0
holdBars = math.max(1, int(math.round(holdMin / tfMin)))
nBuckets = int(1440 / bucketMin)
rng = ta.highest(high, holdBars) - ta.lowest(low, holdBars)
bucketNow = int((hour * 60 + minute) / bucketMin)
var matrix<float> prof = matrix.new<float>(nBuckets, lookDays, na)
var array<int> wIdx = array.new<int>(nBuckets, 0)
var float accSum = 0.0
var int accN = 0
var int prevB = -1
if prevB != -1 and bucketNow != prevB and accN > 0
col = array.get(wIdx, prevB)
matrix.set(prof, prevB, col, accSum / accN)
array.set(wIdx, prevB, (col + 1) % lookDays)
accSum := 0.0
accN := 0
if not na(rng)
accSum += rng
accN += 1
prevB := bucketNow
// Live volatility: recent travel range
liveRng = ta.sma(rng, 5)
// ============================================================
// TARGET: VALUE (last bar only)
// ============================================================
float tgt = na
if barstate.islast
array<float> hist = array.new<float>()
for i = 0 to lookDays - 1
v = matrix.get(prof, bucketNow, i)
if not na(v)
hist.push(v)
float typical = hist.size() >= 3 ? hist.percentile_linear_interpolation(pctl) : na
float ratio = na(typical) or typical == 0 or na(liveRng) ? na : liveRng / typical
float adj = na(ratio) ? 1.0 : math.max(0.5, math.min(1.5, 1.0 + liveWt * (ratio - 1.0)))
float rawTgt = na(typical) ? na : typical * tgtFrac * adj
tgt := na(rawTgt) ? na : math.max(roundTo, math.round(rawTgt / roundTo) * roundTo)
float beWin = na(tgt) or na(stopDist) ? na : stopDist / (stopDist + tgt) * 100
bool tooWide = not na(beWin) and beWin > maxBE
// Mr Scalpy colour must agree with the trade direction (long = green, short = red)
scalpyOk = (dir == 1 and tsi_bullish) or (dir == -1 and not tsi_bullish)
// ============================================================
// TARGET BOX
// ============================================================
posOf(s) =>
switch s
"Top Left" => position.top_left
"Middle Left" => position.middle_left
"Middle Right" => position.middle_right
"Bottom Left" => position.bottom_left
"Bottom Right" => position.bottom_right
=> position.top_right
var table dash = showTarget ? table.new(posOf(tblPos), 2, 2, border_width=1) : na
if barstate.islast and showTarget
stTxt = dir == 0 or not scalpyOk ? "NO ENTRY" : tooWide ? "STOP TOO WIDE" : "OK"
stCol = dir == 0 or not scalpyOk ? color.new(color.gray, 25) : tooWide ? color.new(color.red, 10) : color.new(color.green, 40)
table.cell(dash, 0, 0, "TARGET", text_color=color.white, text_halign=text.align_left, bgcolor=color.new(color.gray, 25))
table.cell(dash, 1, 0, na(tgt) ? "-" : str.tostring(tgt, "#") + " pts", text_color=color.white, text_halign=text.align_right, bgcolor=color.new(color.green, 20))
table.cell(dash, 0, 1, "Status", text_color=color.white, text_halign=text.align_left, bgcolor=color.new(color.gray, 25))
table.cell(dash, 1, 1, stTxt, text_color=color.white, text_halign=text.align_right, bgcolor=stCol)
// ============================================================
// TREND BIAS MA (formerly Crazy MA)
// ============================================================
getDEMA(source, length) =>
ema1 = ta.ema(source, length)
ema2 = ta.ema(ema1, length)
2 * ema1 - ema2
getTEMA(source, length) =>
ema1 = ta.ema(source, length)
ema2 = ta.ema(ema1, length)
ema3 = ta.ema(ema2, length)
3 * ema1 - 3 * ema2 + ema3
getZLEMA(source, length) =>
lag = math.floor((length - 1) / 2)
emaData = source + (source - source[lag])
ta.ema(emaData, length)
getT3(source, length, volumeFactor) =>
xe1 = ta.ema(source, length)
xe2 = ta.ema(xe1, length)
xe3 = ta.ema(xe2, length)
xe4 = ta.ema(xe3, length)
xe5 = ta.ema(xe4, length)
xe6 = ta.ema(xe5, length)
b = volumeFactor
c1 = -b * b * b
c2 = 3 * b * b + 3 * b * b * b
c3 = -6 * b * b - 3 * b - 3 * b * b * b
c4 = 1 + 3 * b + b * b * b + 3 * b * b
c1 * xe6 + c2 * xe5 + c3 * xe4 + c4 * xe3
sma_v = ta.sma(close, maLength)
ema_v = ta.ema(close, maLength)
hma_v = ta.hma(close, maLength)
vwma_v = ta.vwma(close, maLength)
alma_v = ta.alma(close, maLength, almaOffset, almaSigma)
smma_v = ta.rma(close, maLength)
wma_v = ta.wma(close, maLength)
dema_v = getDEMA(close, maLength)
tema_v = getTEMA(close, maLength)
zlema_v = getZLEMA(close, maLength)
t3_v = getT3(close, maLength, t3VolumeFactor)
lsma_v = ta.linreg(close, maLength, 0)
// McGinley Dynamic
var float mcg = na
if na(mcg)
mcg := ta.ema(close, maLength)
else
mcg := mcg + (close - mcg) / (maLength * math.pow(close / mcg, 4))
getCombinedMA(vals, wts, method, trim) =>
float result = na
float wSum = 0.0
float wTotal = 0.0
arr = array.new_float()
for i = 0 to array.size(vals) - 1
v = array.get(vals, i)
w = array.get(wts, i)
if not na(v) and w > 0
wSum += v * w
wTotal += w
array.push(arr, v)
n = array.size(arr)
if n > 0
result := switch method
"Weighted Mean" => wSum / wTotal
"Mean" => array.avg(arr)
"Median" => array.median(arr)
"Highest" => array.max(arr)
"Lowest" => array.min(arr)
"Mid-Range" => (array.max(arr) + array.min(arr)) / 2
"Trimmed Mean" =>
sortedArr = array.copy(arr)
array.sort(sortedArr)
k = math.min(math.floor(n * trim / 100), math.floor((n - 1) / 2))
array.avg(array.slice(sortedArr, k, n - k))
"Geometric Mean" =>
logSum = 0.0
cnt = 0
for j = 0 to n - 1
x = array.get(arr, j)
if x > 0
logSum += math.log(x)
cnt += 1
cnt > 0 ? math.exp(logSum / cnt) : na
=> wSum / wTotal
result
maValues = array.from(sma_v, ema_v, hma_v, vwma_v, alma_v, smma_v, wma_v, dema_v, tema_v, zlema_v, t3_v, lsma_v, mcg)
maWeights = array.from(weightSMA, weightEMA, weightHMA, weightVWMA, weightALMA, weightSMMA, weightWMA, weightDEMA, weightTEMA, weightZLEMA, weightT3, weightLSMA, weightMcGinley)
combinedMA = getCombinedMA(maValues, maWeights, avgMethod, trimPct)
singleMA = switch maType
"SMA" => sma_v
"EMA" => ema_v
"HMA" => hma_v
"VWMA" => vwma_v
"ALMA" => alma_v
"SMMA" => smma_v
"WMA" => wma_v
"DEMA" => dema_v
"TEMA" => tema_v
"ZLEMA" => zlema_v
"T3" => t3_v
"LSMA" => lsma_v
"McGinley" => mcg
=> sma_v
ma = useCombined ? combinedMA : singleMA
maAngle = ma - ma[1]
maColor = if useCombined
angleDeg = math.atan(maAngle) * 180 / math.pi
angleDeg > flatTolerance ? colorUp : angleDeg < -flatTolerance ? colorDown : colorFlat
else
maAngle > 0 ? colorUp : maAngle < 0 ? colorDown : colorFlat
plot(showMA ? ma : na, title="Trend Bias MA", color=maColor, linewidth=2)
// ============================================================
// ALERTS (Dynamic Trader)
// ============================================================
buyStart = state == 1 and state[1] != 1
sellStart = state == -1 and state[1] != -1
colFlipBuy = dispState == 1 and dispState[1] != 1
colFlipSell = dispState == -1 and dispState[1] != -1
alertcondition(buyStart, title="DT Buy (green)", message="{{exchange}}:{{ticker}} {{interval}} - DT Buy candle")
alertcondition(sellStart, title="DT Sell (red)", message="{{exchange}}:{{ticker}} {{interval}} - DT Sell candle")
alertcondition(colFlipBuy, title="Colour flip to BUY", message="{{exchange}}:{{ticker}} {{interval}} - Candles flipped to buy")
alertcondition(colFlipSell, title="Colour flip to SELL", message="{{exchange}}:{{ticker}} {{interval}} - Candles flipped to sell")