// Here's the Pine Script code for the mentioned indicator strategy in TradingView:
//@version=4
strategy("SuperTrend, Dziwne, and QQE Strategy", overlay = true)
// Parameters for SuperTrend
atrLength = input(14, title = "ATR Length")
mult = input(3.0, title="Multiplier")
tpPercentage = input(1, title="Take Profit %")
atr = atr(atrLength)
offset = mult * atr
// SuperTrend Calculation
highWithOffset = high - offset
lowWithOffset = low + offset
greenTrend = na(greenTrend[1]) ? highWithOffset : max(highWithOffset, greenTrend[1])
redTrend = na(redTrend[1]) ? lowWithOffset : min(lowWithOffset, redTrend[1])
// SuperTrend Signal
longSignal = crossover(close, greenTrend)
shortSignal = crossunder(close, redTrend)
supertrend = close > redTrend ? na : close < greenTrend ? na : close
// Dziwne Calculation
len = input(8, title="Dziwne Length")
src = close
ema8 = ema(src, len)
atan1 = atan((ema8 - ema8[len]) / len)
atan2 = atan((atan1 - atan1[len]) / len)
slope = atan2 * 100
col = slope > 0 ? color.green : color.red
// QQE Calculation
length = input(14, title="QQE Length")
smoothing = input(5, title="Smoothing Length")
src1 = close
typicalPrice = (high + low + close) / 3
wilders(data, length) =>
na(data[length - 1]) ? sma(data, length) : ((length - 1) * nz(wilders(data, length)[1]) + data) / length
RSI = wilders(typicalPrice - typicalPrice[1], length)
smoothedRSI = wilders(RSI, smoothing)
smoothedUpper = highest(high, length)
smoothedLower = lowest(low, length)
factor = (smoothedUpper- smoothedLower) / 2
multFactor = 100 / (highest(high, length) - lowest(low, length))
result = 50 + (multFactor * (typicalPrice - smoothedLower))
longQQE = crossover(result, smoothedRSI)
shortQQE = crossunder(result, smoothedRSI)
// Overall Signals
globalLongSignal = longSignal and col == color.green and longQQE
globalShortSignal = shortSignal and col == color.red and shortQQE
// Take Profit
takeProfit = tpPercentage / 100 * close
// Trade Entry and Exit
strategy.entry("Long", strategy.long, when = globalLongSignal)
strategy.close("Long", when = globalShortSignal)
strategy.take_profit("Take Profit Long", takeProfit)
strategy.entry("Short", strategy.short, when = globalShortSignal)
strategy.close("Short", when = globalLongSignal)
strategy.take_profit("Take Profit Short", takeProfit)
// Plot Indicator
plot(greenTrend, color = color.green, title = "SuperTrend Line (Green)", style = plot.style_line)
plot(redTrend, color = color.red, title = "SuperTrend Line (Red)", style = plot.style_line)
plot(supertrend ? 1 : na, title = "SuperTrend Signal", style = plot.style_cross)
plot(ema8, color = col, title = "Dziwne Indicator", linewidth = 2)
plot(smoothedRSI, color = color.blue, title = "QQE (Blue)", linewidth = 2)
plot(result, color = color.orange, title = "QQE (Orange)", linewidth = 2)
// This code represents a custom indicator for use on the TradingView platform using Pine Script.
// It incorporates a SuperTrend, Dziwne, and QQE analysis with specific buy/sell signals and Take Profit (TP) functionality.