//@version=6 indicator(title = 'SAAT | 07 | 3x v6', shorttitle = '3x', overlay = true) //{ ______________________BOLLINGER BANDS________________________ BBMiddle = ta.sma(source = close, length = 21) dev = 2.0 * ta.stdev(source = close, length = 21) BBUpper = BBMiddle + dev BBLower = BBMiddle - dev plot(series = BBUpper, title = 'BB(Upper)', color = #1848cc, offset = 0, linewidth = 3, display = display.none) plot(series = BBLower, title = 'BB(Lower)', color = #1848cc, offset = 0, linewidth = 3, display = display.none) plot(series = BBMiddle, title = 'BB(Middle)/(SMA21)', color = #0c3299, offset = 0, linewidth = 3, display = display.none) //______________________SMA2 & SMA3____________________________ sma3 = ta.sma(source = close, length = 3) plot(series = sma3, title = 'SMA(3)', color = #00f50a, offset = 3, linewidth = 2, display = display.none) sma2 = ta.sma(source = close, length = 2) plot(series = sma2, title = 'SMA(2)', color = #ff0000, offset = 0, linewidth = 2, display = display.none) //______________________STOCHRSI______________________________ eighty = 80 eightyLine = plot(series = eighty, title = '80 Line', color = #009688, linewidth = 2, editable = false, display = display.none) twenty = 20 twentyLine = plot(series = twenty, title = '20 Line', color = #009688, linewidth = 2, editable = false, display = display.none) fifty = 50 fiftyLine = plot(series = fifty, title = '50 Line', color = #808080, linewidth = 1, editable = false, display = display.none) smoothK = 3 smoothD = 5 lengthStoch = 21 lengthRSI = 13 src_rsi = close rsi1 = ta.rsi(source = src_rsi, length = lengthRSI) k = ta.sma(ta.stoch(source = rsi1, high = rsi1, low = rsi1, length = lengthStoch), length = smoothK) d = ta.sma(source = k, length = smoothD) plot(series = d, title = '%D', color = #00f50a, linewidth = 2, editable = false, display = display.none) plot(series = k, title = '%K', color = #ff0000, linewidth = 2, editable = false, display = display.none) //_______________________MACD____________________________________ fast_length = 8 slow_length = 21 src_macd = close signal_length = 5 sma_source = false sma_signal = false fast_ma = sma_source ? ta.sma(source = src_macd, length = fast_length) : ta.ema(source = src_macd, length = fast_length) slow_ma = sma_source ? ta.sma(source = src_macd, length = slow_length) : ta.ema(source = src_macd, length = slow_length) macd = fast_ma - slow_ma signal = sma_signal ? ta.sma(source = macd, length = signal_length) : ta.ema(source = macd, length = signal_length) hist = macd - signal zero = 0 zeroline = plot(series = zero, title = '0 Line', color = #2a2e39, linewidth = 1, editable = false, display = display.none) plot(series = signal, title = 'Signal', color = #00ff00, linewidth = 2, editable = false, display = display.none) plot(series = macd, title = 'MACD', color = #ff0000, linewidth = 2, editable = false, display = display.none) plot(series = hist, title = 'Histogram', style = plot.style_histogram, linewidth = 3, color = hist >= 0 ? hist[1] < hist ? #000000 : #000000 : hist[1] < hist ? #000000 : #000000, editable = false, display = display.none) //} //{ ______________________________3x BULL & BEAR CONDITIONS________________________________________ bbhitbasis = input.string(defval = 'Open/Close', title = 'PRICE: Hit BB Basis', options = ['Open/Close', 'High/Low'], tooltip = '3x criteria met when price hits BB with HIGH/LOW or OPEN/CLOSE', group = '3x CRITERIA (PERFECT & IMPERFECT 3x)') bb1 = bbhitbasis == 'Open/Close' ? open : high bb2 = bbhitbasis == 'Open/Close' ? close : low bbhitmaxcandles = input(defval = 4, title = 'PRICE: Max Candles After Hitting BB', tooltip = '3x must occur within # of candles after hitting BB', group = '3x CRITERIA (PERFECT & IMPERFECT 3x)') stochcrosstype = input.string(defval = '<20 and >80', title = 'STOCHRSI: Cross Type Basis', options = ['<20 and >80', 'Anywhere'], tooltip = '3x criteria met when Stoch crosses from above 80 and below 20 OR Red crossing Green anywhere', group = '3x CRITERIA (PERFECT & IMPERFECT 3x)') showperfect = true showimperfect = true //___________________________BULL________________________________ bbbullcond = BBLower < math.max(bb1, bb2) and BBLower > math.min(bb1, bb2) stochbullcond = ta.crossover(k, d) and (stochcrosstype == '<20 and >80' ? k[1] < 20 and d[1] < 20 : true) macdbullcrossup = ta.crossover(macd, signal) macdbullcond = macdbullcrossup or macdbullcrossup[1] sma2crossup = ta.crossover(sma2, sma3[3]) sma2bullcond = sma2crossup or sma2crossup[1] perfectbull = ta.barssince(bbbullcond) <= bbhitmaxcandles and sma2bullcond and stochbullcond and macdbullcond and close > open and k[1] < 20 and d[1] < 20 imperfectbull = ta.barssince(bbbullcond) <= bbhitmaxcandles and sma2bullcond and macdbullcond and (stochbullcond[1] or stochbullcond[2] or stochbullcond[3] or stochbullcond[4]) plotshape(series = showperfect and perfectbull and not(perfectbull[1] or imperfectbull[1]), title = 'Perfect Bull 3x', style = shape.triangleup, location = location.belowbar, color = color.white, size = size.small, display = display.pane) plotshape(series = showimperfect and imperfectbull and not(perfectbull[1] or imperfectbull[1]), title = 'Imperfect Bull 3x', style = shape.triangleup, location = location.belowbar, color = #ffeb3b, size = size.small, display = display.pane) //___________________________BEAR________________________________ bbbearcond = BBUpper < math.max(bb1, bb2) and BBUpper > math.min(bb1, bb2) stochbearcond = ta.crossunder(k, d) and (stochcrosstype == '<20 and >80' ? k[1] > 80 and d[1] > 80 : true) macdbearcrossdown = ta.crossunder(macd, signal) macdbearcond = macdbearcrossdown or macdbearcrossdown[1] sma2crossdown = ta.crossunder(sma2, sma3[3]) sma2bearcond = sma2crossdown or sma2crossdown[1] perfectbear = ta.barssince(bbbearcond) <= bbhitmaxcandles and sma2bearcond and stochbearcond and macdbearcond and close < open and k[1] > 80 and d[1] > 80 imperfectbear = ta.barssince(bbbearcond) <= bbhitmaxcandles and sma2bearcond and macdbearcond and (stochbearcond[1] or stochbearcond[2] or stochbearcond[3]) plotshape(series = showperfect and perfectbear and not(perfectbear[1] or imperfectbear[1]), title = 'Perfect Bear 3x', style = shape.triangledown, location = location.abovebar, color = color.white, size = size.small, display = display.pane) plotshape(series = showimperfect and imperfectbear and not(perfectbear[1] or imperfectbear[1]), title = 'Imperfect Bear 3x', style = shape.triangledown, location = location.abovebar, color = #ffeb3b, size = size.small, display = display.pane) //}