├── 5-8-13.pine ├── ADX Script.txt ├── AlgoPro Reverse.pine.txt ├── BollingerBand RSI Penetration.txt ├── BullRush Strategy.txt ├── BullRush v1.2.txt ├── BullRush v1.3.pine ├── BullRush v1.txt ├── CCI Double Cross.pine ├── ColorRVI.pine ├── D2 Pivots.txt ├── DivergencesEdited.pine ├── EliteAlgo_V22.pine.txt ├── EliteAlgo_V28.pine ├── Everest.txt ├── EzAlgo_V5.pine.txt ├── EzAlgo_V9.pine.txt ├── FartCloud.pine ├── GexBot Windows Client ├── Form1.Designer.cs ├── Form1.cs ├── Form1.resx ├── GrabGex.csproj ├── GrabGex.csproj.user ├── GrabGex.deps.json ├── GrabGex.dll ├── GrabGex.exe ├── GrabGex.pdb ├── GrabGex.runtimeconfig.json ├── GrabGex.sln ├── Newtonsoft.Json.dll ├── Program.cs └── a ├── GexBot.pine ├── Google.code-workspace ├── Green Hulk Strategy.txt ├── GreenHulk.txt ├── GreenHulk_v_1_3.pine ├── HAQuant.pine ├── HourlyScan.pine ├── Hulk Buy.pine ├── Hulk.pine ├── HulkScanner.pine ├── Insane Oscillator 2.1.txt ├── Insane Oscillator v2.txt ├── Insane Oscillator.pine ├── Insane Oscillator.txt ├── JohnWick v1.txt ├── JohnWick.pine ├── KillpipsScanner noworkie.pine ├── KillpipsScanner.pine ├── KillpipsZones.pine ├── LindaMACD.pine ├── LuxAlgo Oscillator.pine ├── LuxHelper.pine ├── LuxReversal.pine ├── MACD PSAR Indicator.txt ├── MMScanner.pine ├── MP Meter v1.2.pine ├── MP Meter v1.4.pine ├── MP Meter v1.5.pine ├── MP Meter v1.5.txt ├── MP Meter v1.6.pine ├── MacTastic Strategy.txt ├── MacTastic.pine ├── MacTastic.txt ├── MarketMakerScan.pine ├── McGrawPlaybook.pine ├── Medication List 4:20:2023.txt ├── MenthorQScanner.pine ├── Moody MACD Fixed.txt ├── Nebula Light v2.2.pine ├── Nebula Light v2.3.pine ├── Nebula v1.2.txt ├── Nebula v1.5.txt ├── Nebula v1.51.txt ├── Nebula v1.52.txt ├── Nebula v1.8.txt ├── Nebula v1.9.txt ├── Nebula v2.0.txt ├── Nebula v2.2.pine ├── Nebula v2.2.txt ├── Nebula.pine ├── Nebula.txt ├── PayBack.pine ├── Peleton.txt ├── Pivot Order Blocks.pine ├── Pivots Code.txt ├── PolygonTickCharts.cs ├── Primus.cs ├── QScalper.pine ├── RIFT.txt ├── RSI Cloud.pine ├── RabbitWatcher.pine ├── Rene.pine ├── ReneStrategy.pine ├── RenkoIntensity.pine ├── RenkoIntensity.txt ├── Reversal System v1.1.txt ├── Reversal System v1.2.2.txt ├── Reversal System v1.2.txt ├── Reversal System.txt ├── Shark.txt ├── SharkWaveTrend Pine5.pine ├── SharkWaveTrend.pine ├── SharkWaveTrend.txt ├── ShockWave.pine ├── Shrike Marker.pine ├── ShrikeScan.pine ├── ShrikeScan_Bad.pine ├── ShrikeScans.pine ├── Squeeze Relaxer v2.1.txt ├── Squeeze Relaxer v2.2.txt ├── StarFragment.pine ├── Storm Cloud Strategy.txt ├── StormCloud v1.txt ├── Strategy Template.pine ├── StrategyTemplate.pine ├── StrategyTest.pine ├── TO Method 1.2.pine ├── TO Method 1.2.txt ├── TO Method 1.21.txt ├── TO Method 1.3.txt ├── TO Method 1.31.pine ├── TO Method 1.4.pine ├── TO Method 1.4.txt ├── TO Method 1.5.1.txt ├── TO Method 1.52.pine ├── TO Method 1.52.txt ├── TO Method 1.6.txt ├── TO Method v1.7.pine ├── TO Method v1.7.txt ├── TO Method v1.8.pine ├── TO Method v1.8.txt ├── TO Method v1.9.pine ├── TO Method v1.9.txt ├── TO Method v1.91.txt ├── TO Method v1.92.txt ├── TO Method v1.95.txt ├── TO Method v2.0.pine ├── TO Method v2.0.txt ├── TO Method v2.1.txt ├── TO Method v2.2.pine ├── TO Volume Profile.pine ├── TO Method v1.0 ├── TO Method v1.0.pine ├── TO Method v1.0.txt ├── TestCode.cs ├── The Defibrillator 1.5.txt ├── The Defibrillator 1.6.txt ├── The Defibrillator v1.2.txt ├── The Defibrillator.pine ├── The Lion Strategy.txt ├── The One Renko 1.1.pine ├── The One Renko 1.1.txt ├── The One Renko 1.2.pine ├── The One Renko 1.2.txt ├── The One Renko 1.3.txt ├── The One Renko 1.4.pine ├── The One Renko 1.4.txt ├── The One Renko.txt ├── The One.txt ├── TheBorg.pine ├── TheBorg.txt ├── TheLion v1.txt ├── TheLion.pine ├── Tidal Wave 1.5.txt ├── Tidal Wave v2.txt ├── Tidal Wave.pine ├── Tidal Wave.txt ├── Total Recall.pine ├── Total Recall.txt ├── TradePro 78 Win.txt ├── TradePro78 Strategy.txt ├── TradePro78 v1.1.pine ├── TradePro78 v1.txt ├── TraderOracle v1.6.txt ├── TraderOracle v1.7.2.txt ├── TraderOracle v1.7.5.pine ├── TraderOracle v1.7.6.pine ├── TraderOracle v1.7.8.pine ├── TraderOracle v1.7.8.txt ├── TraderOracle v1.7.txt ├── TraderOracle v1.8.pine ├── TraderSmarts.pine ├── Trampoline Strategy.txt ├── Trampoline.txt ├── Triple SuperTrend Simplified v1.2.txt ├── Triple Supertrend Strategy.txt ├── Ultimate Reversals 1.2.2.txt ├── UltimateBuySell.pine ├── Vector Candles.txt ├── Vegas.pine ├── VodkaShot.pine ├── VodkaShot.txt ├── VolImb.pine ├── Volume Imbalances.pine ├── VuManTO.pine ├── code pool.pine ├── scanTempWorking.pine └── temp.pine /5-8-13.pine: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study(title="5-8-13", overlay=true, shorttitle="5-8-13") 3 | 4 | upwardsBR = ema(close, 5) > ema(close, 8) and close > ema(close, 13) 5 | downwardsBR = ema(close, 5) < ema(close, 8) and close < ema(close, 13) 6 | 7 | showUpBR = upwardsBR and not upwardsBR[1] 8 | showDownBR = downwardsBR and not downwardsBR[1] 9 | 10 | plotshape(showUpBR ? hl2 : na, title="Buy", text="5-8-13", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(59, 72, 210), textcolor=color.white) 11 | 12 | plotshape(showDownBR ? hl2 : na, title="Sell", text="5-8-13", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.rgb(216, 85, 233), textcolor=color.white) 13 | 14 | -------------------------------------------------------------------------------- /ADX Script.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | strategy("D2 Test", shorttitle="D2T", overlay=true) 3 | 4 | adxlen = input(14, title="ADX Smoothing") 5 | dilen = input(14, title="DI Length") 6 | dirmov(len) => 7 | up = change(high) 8 | down = -change(low) 9 | plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) 10 | minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) 11 | truerange = rma(tr, len) 12 | plus = fixnan(100 * rma(plusDM, len) / truerange) 13 | minus = fixnan(100 * rma(minusDM, len) / truerange) 14 | [plus, minus] 15 | adx(dilen, adxlen) => 16 | [plus, minus] = dirmov(dilen) 17 | sum = plus + minus 18 | adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) 19 | sig = adx(dilen, adxlen) 20 | sigabove19 = sig > 19 21 | 22 | // END OF ADX CODE 23 | 24 | length = input(20, title="BB Length") 25 | multQ = input(2.0,title="BB MultFactor") 26 | lengthKC=input(20, title="KC Length") 27 | multKC = input(1.5, title="KC MultFactor") 28 | useTrueRange = true 29 | source = close 30 | basis = sma(source, length) 31 | dev = multKC * stdev(source, length) 32 | upperBB = basis + dev 33 | lowerBB = basis - dev 34 | ma = sma(source, lengthKC) 35 | rangeQ = useTrueRange ? tr : (high - low) 36 | rangema = sma(rangeQ, lengthKC) 37 | upperKC = ma + rangema * multKC 38 | lowerKC = ma - rangema * multKC 39 | sqzOn = (lowerBB > lowerKC) and (upperBB < upperKC) 40 | avg1 = avg(highest(high, lengthKC), lowest(low, lengthKC)) 41 | avg2 = avg(avg1, sma(close,lengthKC)) 42 | 43 | val = linreg(close - avg2, lengthKC, 0) 44 | 45 | colorGreen = (val > nz(val[1])) 46 | colorRed = (val < nz(val[1])) 47 | 48 | // END OF SQUEEZE CODE 49 | sqzSig = (sqzOn == false) and (sigabove19 == true) and (val > 2) 50 | plotshape(sqzSig, title="test", style=shape.diamond) 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /BollingerBand RSI Penetration.txt: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(shorttitle="BB Penetrate", title="BB Penetrate", overlay=true, timeframe="", timeframe_gaps=true) 3 | 4 | BBTolerance = input.float(2.0, title="Bands Pentrate Distance", tooltip = "How much penetration through the bands before triggering an alert") 5 | 6 | // Bollinger Bands 7 | length = input.int(30, minval=1) 8 | src = input.source(close, title="Source") 9 | mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev") 10 | 11 | basis = ta.sma(src, length) 12 | dev = mult * ta.stdev(src, length) 13 | upper = basis + dev 14 | lower = basis - dev 15 | offset = input.int(0, "Offset", minval = -500, maxval = 500) 16 | // p1 = plot(upper, "Upper", color=#2962FF, offset = offset) 17 | // p2 = plot(lower, "Lower", color=#2962FF, offset = offset) 18 | 19 | // RSI 20 | rsiOS = input.int(30, title="Oversold Value") 21 | rsiOB = input.int(80, title="Overbought Value") 22 | rsiLengthInput = input.int(14, minval=1, title="RSI Length", group="RSI Settings") 23 | rsiSourceInput = input.source(close, "Source", group="RSI Settings") 24 | maTypeInput = "SMA" 25 | maLengthInput = input.int(14, title="MA Length", group="MA Settings") 26 | 27 | ma(source, length, type) => 28 | switch type 29 | "SMA" => ta.sma(source, length) 30 | "Bollinger Bands" => ta.sma(source, length) 31 | "EMA" => ta.ema(source, length) 32 | "SMMA (RMA)" => ta.rma(source, length) 33 | "WMA" => ta.wma(source, length) 34 | "VWMA" => ta.vwma(source, length) 35 | 36 | up = ta.rma(math.max(ta.change(rsiSourceInput), 0), rsiLengthInput) 37 | down = ta.rma(-math.min(ta.change(rsiSourceInput), 0), rsiLengthInput) 38 | rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 39 | rsiMA = ma(rsi, maLengthInput, maTypeInput) 40 | 41 | up1 = close < (lower - BBTolerance) or (lower - BBTolerance) and rsi < rsiOS 42 | down1 = close > (upper + BBTolerance) or open > (upper + BBTolerance) and rsi > rsiOB 43 | 44 | plotshape(up1 ? 1 : na, title="Buy", location=location.belowbar, style=shape.cross, size=size.tiny, color=color.rgb(37, 119, 79), textcolor=color.white) 45 | plotshape(down1 ? 1 : na, title="Sell", location=location.abovebar, style=shape.cross, size=size.tiny, color=color.rgb(127, 37, 37), textcolor=color.white) 46 | -------------------------------------------------------------------------------- /BullRush v1.2.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study("BullRush v1.2", overlay = true, format=format.price, precision=2, resolution="") 3 | 4 | iAvgType = input("SMMA", title="Moving Average Type", options=["EMA","HMA","SMA","SMMA","WMA"]) 5 | iEMAMain = input(50, "Main EMA Length", minval=1, tooltip="Normally 50. 64 is an alternative") 6 | bRSI = input(true, title="Enable RSI Verification") 7 | 8 | up = rma(max(change(close), 0), 14) 9 | down = rma(-min(change(close), 0), 14) 10 | rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 11 | rsiMA = ema(rsi, 14) 12 | 13 | var isLong = false 14 | var isShort = false 15 | 16 | bMAUp = false 17 | bMADown = false 18 | b9over21 = false 19 | b9under21 = false 20 | 21 | if (iAvgType == "HMA") 22 | bMAUp := close > wma(2*wma(close, iEMAMain/2)-wma(close, iEMAMain), floor(sqrt(iEMAMain))) 23 | bMADown := close < wma(2*wma(close, iEMAMain/2)-wma(close, iEMAMain), floor(sqrt(iEMAMain))) 24 | b9over21 := wma(2*wma(close, 9/2)-wma(close, 9), floor(sqrt(9))) > wma(2*wma(close, 21/2)-wma(close, 21), floor(sqrt(21))) 25 | b9under21 := wma(2*wma(close, 9/2)-wma(close, 9), floor(sqrt(9))) < wma(2*wma(close, 21/2)-wma(close, 21), floor(sqrt(21))) 26 | 27 | if (iAvgType == "WMA") 28 | bMAUp := close > wma(close, iEMAMain) // and open > sma(close, iEMAMain) 29 | bMADown := close < wma(close, iEMAMain) // and open < sma(close, iEMAMain) 30 | b9over21 := wma(close, 9) > wma(close, 21) 31 | b9under21 := wma(close, 9) < wma(close, 21) 32 | 33 | if (iAvgType == "SMA") 34 | bMAUp := close > sma(close, iEMAMain) // and open > sma(close, iEMAMain) 35 | bMADown := close < sma(close, iEMAMain) // and open < sma(close, iEMAMain) 36 | b9over21 := sma(close, 9) > sma(close, 21) 37 | b9under21 := sma(close, 9) < sma(close, 21) 38 | 39 | if (iAvgType == "EMA") 40 | bMAUp := close > ema(close, iEMAMain) // and open > ema(close, iEMAMain) 41 | bMADown := close < ema(close, iEMAMain) // and open < ema(close, iEMAMain) 42 | b9over21 := ema(close, 9) > ema(close, 21) 43 | b9under21 := ema(close, 9) < ema(close, 21) 44 | 45 | if (iAvgType == "SMMA") 46 | smma = 0.0 47 | smma := na(smma[1]) ? sma(close, iEMAMain) : (smma[1] * (iEMAMain - 1) + close) / iEMAMain 48 | bMAUp := close > smma // and open > smma 49 | bMADown := close < smma // and open < smma 50 | b9over21 := ema(close, 9) > ema(close, 21) 51 | b9under21 := ema(close, 9) < ema(close, 21) 52 | 53 | rsiUp = true 54 | rsiDown = true 55 | if (bRSI) 56 | rsiUp = rsi > 50 and rsi > rsiMA 57 | rsiDown = rsi < 50 and rsi < rsiMA 58 | 59 | upwards = not isLong and bMAUp and close > open and rsiUp and b9over21 // and ema(close, 9) > ema(close, 21) 60 | downwards = not isShort and bMADown and open > close and rsiDown and b9under21 // and ema(close, 9) < ema(close, 21) 61 | 62 | showUp = upwards and not upwards[1] 63 | showDown = downwards and not downwards[1] 64 | 65 | plotshape(showUp ? hl2 : na, title="BR", text="BR", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white) 66 | plotshape(showDown ? hl2 : na, title="BR", text="BR", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white) 67 | 68 | if showUp 69 | isLong := true 70 | isShort := false 71 | 72 | if showDown 73 | isLong := false 74 | isShort := true 75 | 76 | -------------------------------------------------------------------------------- /BullRush v1.3.pine: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study("BullRush v1.3", overlay = true, format=format.price, precision=2, resolution="") 3 | 4 | iAvgType = input("SMMA", title="Moving Average Type", options=["EMA","HMA","SMA","SMMA","WMA"]) 5 | iEMAMain = input(50, "Main EMA Length", minval=1, tooltip="Normally 50. 64 is an alternative") 6 | bRSI = input(true, title="Enable RSI Verification") 7 | 8 | up = rma(max(change(close), 0), 14) 9 | down = rma(-min(change(close), 0), 14) 10 | rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 11 | rsiMA = ema(rsi, 14) 12 | 13 | var isLong = false 14 | var isShort = false 15 | 16 | bMAUp = false 17 | bMADown = false 18 | b9over21 = false 19 | b9under21 = false 20 | 21 | if (iAvgType == "HMA") 22 | bMAUp := close > wma(2*wma(close, iEMAMain/2)-wma(close, iEMAMain), floor(sqrt(iEMAMain))) 23 | bMADown := close < wma(2*wma(close, iEMAMain/2)-wma(close, iEMAMain), floor(sqrt(iEMAMain))) 24 | b9over21 := wma(2*wma(close, 9/2)-wma(close, 9), floor(sqrt(9))) > wma(2*wma(close, 21/2)-wma(close, 21), floor(sqrt(21))) 25 | b9under21 := wma(2*wma(close, 9/2)-wma(close, 9), floor(sqrt(9))) < wma(2*wma(close, 21/2)-wma(close, 21), floor(sqrt(21))) 26 | 27 | if (iAvgType == "WMA") 28 | bMAUp := close > wma(close, iEMAMain) // and open > sma(close, iEMAMain) 29 | bMADown := close < wma(close, iEMAMain) // and open < sma(close, iEMAMain) 30 | b9over21 := wma(close, 9) > wma(close, 21) 31 | b9under21 := wma(close, 9) < wma(close, 21) 32 | 33 | if (iAvgType == "SMA") 34 | bMAUp := close > sma(close, iEMAMain) // and open > sma(close, iEMAMain) 35 | bMADown := close < sma(close, iEMAMain) // and open < sma(close, iEMAMain) 36 | b9over21 := sma(close, 9) > sma(close, 21) 37 | b9under21 := sma(close, 9) < sma(close, 21) 38 | 39 | if (iAvgType == "EMA") 40 | bMAUp := close > ema(close, iEMAMain) // and open > ema(close, iEMAMain) 41 | bMADown := close < ema(close, iEMAMain) // and open < ema(close, iEMAMain) 42 | b9over21 := ema(close, 9) > ema(close, 21) 43 | b9under21 := ema(close, 9) < ema(close, 21) 44 | 45 | if (iAvgType == "SMMA") 46 | smma = 0.0 47 | smma := na(smma[1]) ? sma(close, iEMAMain) : (smma[1] * (iEMAMain - 1) + close) / iEMAMain 48 | bMAUp := close > smma // and open > smma 49 | bMADown := close < smma // and open < smma 50 | b9over21 := ema(close, 9) > ema(close, 21) 51 | b9under21 := ema(close, 9) < ema(close, 21) 52 | 53 | rsiUp = true 54 | rsiDown = true 55 | if (bRSI) 56 | rsiUp := rsi > 50 and rsi > rsiMA 57 | rsiDown := rsi < 50 and rsi < rsiMA 58 | 59 | upwards = not isLong and bMAUp and close > open and rsiUp and b9over21 // and ema(close, 9) > ema(close, 21) 60 | downwards = not isShort and bMADown and open > close and rsiDown and b9under21 // and ema(close, 9) < ema(close, 21) 61 | 62 | showUp = upwards and not upwards[1] 63 | showDown = downwards and not downwards[1] 64 | 65 | plotshape(showUp ? hl2 : na, title="BR", text="BR", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white) 66 | plotshape(showDown ? hl2 : na, title="BR", text="BR", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white) 67 | 68 | if showUp 69 | isLong := true 70 | isShort := false 71 | 72 | if showDown 73 | isLong := false 74 | isShort := true 75 | 76 | -------------------------------------------------------------------------------- /BullRush v1.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study("Bullrush v1", overlay = true, format=format.price, precision=2, resolution="") 3 | upwards = (ema(close, 9) > ema(close, 21) and close > ema(close, 50) and open > ema(close, 50)) 4 | downwards = (ema(close, 9) < ema(close, 21) and close < ema(close, 50) and open < ema(close, 50)) 5 | showUp = upwards and not upwards[1] 6 | showDown = downwards and not downwards[1] 7 | plotshape(showUp ? hl2 : na, title="Buy", text="Buy", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white) 8 | plotshape(showDown ? hl2 : na, title="Sell", text="Sell", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white) 9 | -------------------------------------------------------------------------------- /CCI Double Cross.pine: -------------------------------------------------------------------------------- 1 | //@version=4 2 | // Idea from this video: https://www.youtube.com/watch?v=ZRihb2T-xWQ 3 | study(title="CCI Double Cross", format=format.price, precision=2) 4 | 5 | src = input(hlc3, title="Source") 6 | bBack = input(true, title="Show background on video rules condition") 7 | 8 | // CCI #1 - red 9 | ma1 = sma(hlc3, 14) 10 | cci1 = (src - ma1) / (0.015 * dev(src, 14)) 11 | plot(cci1, "CCI 1", color=#b72842, linewidth=2) 12 | 13 | // CCI #2 - yellow 14 | ma2 = sma(src, 100) 15 | cci2 = (src - ma2) / (0.015 * dev(src, 100)) 16 | plot(cci2, "CCI 2", color=#d4cd0f, linewidth=2) 17 | 18 | band1 = hline(100, "Upper Band", color=#787B86, linestyle=hline.style_dashed) 19 | hline(0, "Middle Band", color=color.new(#787B86, 50)) 20 | band0 = hline(-100, "Lower Band", color=#787B86, linestyle=hline.style_dashed) 21 | 22 | cci1WasGreen = cci1[1] > cci2[1] or cci1[2] > cci2[2] or cci1[3] > cci2[3] or cci1[4] > cci2[4] or cci1[5] > cci2[5] or cci1[6] > cci2[6] or cci1[7] > cci2[7] 23 | 24 | bgcolor(bBack and cci1 > cci2 and cci1 >= 100 ? color.green : bBack and cci1 < cci2 and cci1 < -100 and cci1WasGreen ? color.red : na, transp = 65, editable = false) 25 | -------------------------------------------------------------------------------- /ColorRVI.pine: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="Relative Volatility Index", shorttitle="RVI", format=format.price, precision=2, timeframe="", timeframe_gaps=true) 3 | length = input.int(10, minval=1) 4 | offset = input.int(0, "Offset", minval = -500, maxval = 500) 5 | maTypeInput = input.string("SMA", title="MA Type", options=["SMA", "Bollinger Bands", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="MA Settings") 6 | maLengthInput = input.int(14, title="MA Length", group="MA Settings") 7 | bbMultInput = input.float(2.0, minval=0.001, maxval=50, title="BB StdDev", group="MA Settings") 8 | src = close 9 | len = 14 10 | stddev = ta.stdev(src, length) 11 | upper = ta.ema(ta.change(src) <= 0 ? 0 : stddev, len) 12 | lower = ta.ema(ta.change(src) > 0 ? 0 : stddev, len) 13 | rvi = upper / (upper + lower) * 100 14 | ma(source, length, type) => 15 | switch type 16 | "SMA" => [ta.sma(source, length), na, na] 17 | "Bollinger Bands" => 18 | [middleValue, highValue, lowValue] = ta.bb(source, length, bbMultInput) 19 | [middleValue, highValue, lowValue] 20 | "EMA" => [ta.ema(source, length), na, na] 21 | "SMMA (RMA)" => [ta.rma(source, length), na, na] 22 | "WMA" => [ta.wma(source, length), na, na] 23 | "VWMA" => [ta.vwma(source, length), na, na] 24 | 25 | [rviMA,highValue,lowValue] = ma(rvi, maLengthInput, maTypeInput) 26 | 27 | h0 = hline(80, "Upper Band", color=#787B86) 28 | hline(50, "Middle Band", color=color.new(#787B86, 50)) 29 | h1 = hline(20, "Lower Band", color=#787B86) 30 | fill(h0, h1, color=color.rgb(126, 87, 194, 90), title="Background") 31 | 32 | rviColor = rvi > rviMA ? color.green : color.red 33 | 34 | plot(rvi, title="RVI", color=rviColor, offset = offset) 35 | plot(rviMA, "RVI-based MA", color=color.yellow, offset = offset) 36 | 37 | bbUpper = plot(highValue, title="Upper Bollinger Band", color=color.green) 38 | bbLower = plot(lowValue, title="Lower Bollinger Band", color=color.green) 39 | 40 | fill(bbUpper, bbLower, color = color.new(color.green, 90), title="Bollinger Bands Background Fill") 41 | 42 | -------------------------------------------------------------------------------- /GexBot Windows Client/Form1.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | 3 | namespace GrabGex 4 | { 5 | public partial class Form1 : Form 6 | { 7 | public Form1() 8 | { 9 | InitializeComponent(); 10 | cbType.SelectedIndex = 0; 11 | cbSymbol.SelectedIndex = 3; 12 | cbVolOI.SelectedIndex = 1; 13 | cbGreek.SelectedIndex = 0; 14 | } 15 | 16 | public async Task GetIt() 17 | { 18 | string Greek = cbGreek.Items[cbGreek.SelectedIndex].ToString().ToLower().Split(' ')[0]; 19 | if (cbGreek.SelectedIndex > 3) 20 | Greek = "one" + Greek; 21 | if (Greek.Equals("none")) 22 | Greek = cbType.Items[cbType.SelectedIndex].ToString(); 23 | string sCS = chkState.Checked || cbGreek.SelectedIndex != 0 ? "state" : "classic"; 24 | string sSection = Greek.Equals("none") ? "strikes" : "mini_contracts"; 25 | 26 | HttpClient http = new HttpClient(); 27 | string toSend = "https://api.gexbot.com/" + 28 | cbSymbol.Items[cbSymbol.SelectedIndex] + "/" + 29 | sCS + "/" + 30 | Greek + "?key=" + 31 | txtKey.Text.Trim(); 32 | HttpResponseMessage response = await http.GetAsync(toSend); 33 | response.EnsureSuccessStatusCode(); 34 | string jsonResponse = await response.Content.ReadAsStringAsync(); 35 | JObject jo = JObject.Parse(jsonResponse); 36 | var clientarray = jo[sSection].Value(); 37 | richTextBox1.Clear(); 38 | int ix = 1; 39 | foreach (JArray item in clientarray) 40 | if (Greek.Equals("none")) 41 | { 42 | double dd = Convert.ToDouble(item[0]) * Convert.ToDouble(txtConversion.Text); 43 | string pr = $"{dd:0.0}"; 44 | double d1 = Convert.ToDouble(item[1]) * Convert.ToDouble(txtConversion.Text); 45 | string one = $"{d1:0.00}"; 46 | double d2 = Convert.ToDouble(item[2]) * Convert.ToDouble(txtConversion.Text); 47 | string two = $"{d2:0.00}"; 48 | if (cbVolOI.SelectedIndex == 0 && d1 != 0) 49 | { 50 | if (ix > 1) richTextBox1.Text += "\n"; 51 | richTextBox1.Text += Encode(pr) + "," + Encode(one); 52 | } 53 | else if (d2 != 0) 54 | { 55 | if (ix > 1) richTextBox1.Text += "\n"; 56 | richTextBox1.Text += Encode(pr) + "," + Encode(two); 57 | } 58 | ix++; 59 | } 60 | else 61 | { 62 | double dd = Convert.ToDouble(item[0]) * Convert.ToDouble(txtConversion.Text); 63 | string pr = $"{dd:0.0}"; 64 | double d1 = Convert.ToDouble(item[1]) * Convert.ToDouble(txtConversion.Text); 65 | string one = $"{d1:0.00}"; 66 | double d2 = Convert.ToDouble(item[2]) * Convert.ToDouble(txtConversion.Text); 67 | string two = $"{d2:0.00}"; 68 | double d3 = Convert.ToDouble(item[3]) * Convert.ToDouble(txtConversion.Text); 69 | string three = $"{d3:0.00}"; 70 | if (d3 != 0) 71 | { 72 | if (ix > 1) richTextBox1.Text += "\n"; 73 | richTextBox1.Text += Encode(pr) + "," + Encode(three); 74 | } 75 | ix++; 76 | } 77 | Clipboard.SetText(richTextBox1.Text); 78 | } 79 | 80 | private string Encode(string s) 81 | { 82 | return s.Replace("53", "D") 83 | .Replace("52", "|") 84 | .Replace("54", "A") 85 | .Replace("55", "B") 86 | .Replace("56", "C") 87 | .Replace("17", "!") 88 | .Replace("18", "@") 89 | .Replace("19", "#") 90 | .Replace("20", "$") 91 | .Replace("21", "*") 92 | .Replace("22", "=") 93 | .Replace(".35", "") 94 | .Replace("0.0", "~") 95 | .Replace("-0.", ":") 96 | .Replace(".1", "E"); 97 | } 98 | 99 | private void button1_Click(object sender, EventArgs e) 100 | { 101 | GetIt(); 102 | } 103 | 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /GexBot Windows Client/GrabGex.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net8.0-windows 6 | enable 7 | true 8 | enable 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /GexBot Windows Client/GrabGex.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Form 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /GexBot Windows Client/GrabGex.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeTarget": { 3 | "name": ".NETCoreApp,Version=v8.0", 4 | "signature": "" 5 | }, 6 | "compilationOptions": {}, 7 | "targets": { 8 | ".NETCoreApp,Version=v8.0": { 9 | "GrabGex/1.0.0": { 10 | "dependencies": { 11 | "Newtonsoft.Json": "13.0.3" 12 | }, 13 | "runtime": { 14 | "GrabGex.dll": {} 15 | } 16 | }, 17 | "Newtonsoft.Json/13.0.3": { 18 | "runtime": { 19 | "lib/net6.0/Newtonsoft.Json.dll": { 20 | "assemblyVersion": "13.0.0.0", 21 | "fileVersion": "13.0.3.27908" 22 | } 23 | } 24 | } 25 | } 26 | }, 27 | "libraries": { 28 | "GrabGex/1.0.0": { 29 | "type": "project", 30 | "serviceable": false, 31 | "sha512": "" 32 | }, 33 | "Newtonsoft.Json/13.0.3": { 34 | "type": "package", 35 | "serviceable": true, 36 | "sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==", 37 | "path": "newtonsoft.json/13.0.3", 38 | "hashPath": "newtonsoft.json.13.0.3.nupkg.sha512" 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /GexBot Windows Client/GrabGex.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TraderOracle/TradingView/08b33c19614e00361b6a2fa775f6d0038a205726/GexBot Windows Client/GrabGex.dll -------------------------------------------------------------------------------- /GexBot Windows Client/GrabGex.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TraderOracle/TradingView/08b33c19614e00361b6a2fa775f6d0038a205726/GexBot Windows Client/GrabGex.exe -------------------------------------------------------------------------------- /GexBot Windows Client/GrabGex.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TraderOracle/TradingView/08b33c19614e00361b6a2fa775f6d0038a205726/GexBot Windows Client/GrabGex.pdb -------------------------------------------------------------------------------- /GexBot Windows Client/GrabGex.runtimeconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "tfm": "net8.0", 4 | "frameworks": [ 5 | { 6 | "name": "Microsoft.NETCore.App", 7 | "version": "8.0.0" 8 | }, 9 | { 10 | "name": "Microsoft.WindowsDesktop.App", 11 | "version": "8.0.0" 12 | } 13 | ], 14 | "configProperties": { 15 | "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": true 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /GexBot Windows Client/GrabGex.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.11.35312.102 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrabGex", "GrabGex.csproj", "{34F825B4-7DDA-42C0-B33D-5B5F32F20EE3}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {34F825B4-7DDA-42C0-B33D-5B5F32F20EE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {34F825B4-7DDA-42C0-B33D-5B5F32F20EE3}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {34F825B4-7DDA-42C0-B33D-5B5F32F20EE3}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {34F825B4-7DDA-42C0-B33D-5B5F32F20EE3}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {946731EC-A19D-4635-9D55-97592A7E0409} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /GexBot Windows Client/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TraderOracle/TradingView/08b33c19614e00361b6a2fa775f6d0038a205726/GexBot Windows Client/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /GexBot Windows Client/Program.cs: -------------------------------------------------------------------------------- 1 | namespace GrabGex 2 | { 3 | internal static class Program 4 | { 5 | /// 6 | /// The main entry point for the application. 7 | /// 8 | [STAThread] 9 | static void Main() 10 | { 11 | // To customize application configuration such as set high DPI settings or default font, 12 | // see https://aka.ms/applicationconfiguration. 13 | ApplicationConfiguration.Initialize(); 14 | Application.Run(new Form1()); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /GexBot Windows Client/a: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /GexBot.pine: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator("GexBot", overlay=true, max_boxes_count = 500) 3 | zones = input.text_area("", "Paste Gex values here") 4 | 5 | sFontSize = input.string(title="Font Size: ", options=["Tiny", "Small", "Normal", "Large"], defval="Normal", group="Lines") 6 | lWidth = input.int(1, "Line Width", group="Lines") 7 | iBoxTrans = input.int(50, "Line Transparency", group="Lines") 8 | 9 | colLong = input.color(color.rgb(0, 255, 0), "Positive color", group="Colors") 10 | colShort = input.color(color.rgb(255, 0, 0), "Negative color", group="Colors") 11 | left_edge = chart.left_visible_bar_time 12 | 13 | if (barstate.islast) 14 | string[] _pair = str.split(zones, "\n") 15 | 16 | for s in _pair 17 | log.info("s " + s) 18 | string[] comma = str.split(s, ",") 19 | sPrice = array.get(comma, 0) 20 | sVol = array.get(comma, 1) 21 | //log.info("sVol " + sVol) 22 | fVol = str.tonumber(sVol) * 9000000 23 | sOI = array.get(comma, 2) 24 | log.info("sOI " + sOI) 25 | fOI = str.tonumber(sOI) * 2000000 26 | oispot = math.round(left_edge + math.abs(fOI)) 27 | //log.info("oispot " + str.tostring(oispot)) 28 | colors = fOI > 0 ? colLong : colShort 29 | line.new(left_edge, str.tonumber(sPrice), oispot, str.tonumber(sPrice), xloc=xloc.bar_time, width=1, color=colors) 30 | -------------------------------------------------------------------------------- /Google.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ], 7 | "settings": {} 8 | } -------------------------------------------------------------------------------- /Green Hulk Strategy.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | strategy("Green Hulk Strategy", overlay=true) 3 | 4 | /////////////////////////////////////////////////// 5 | 6 | // Movivated by this video by Serious Backtester: https://www.youtube.com/watch?v=lXYGrhZcYBc 7 | // The Hulk has been many colors, other than green. But this is entitled Green Hulk, due to only LONGs with this strategy 8 | // This strategy works best on DAILY candles. One hour was ok, but anything lower than an hour candle performed poorly 9 | 10 | // MACD 11 | [currMacd,_,_] = macd(close[0], 12, 26, 9) 12 | [prevMacd,_,_] = macd(close[1], 12, 26, 9) 13 | signal = ema(currMacd, 9) 14 | 15 | // STOCHASTIC RSI 16 | rsiSR = rsi(close, 14) 17 | kSR = sma(stoch(rsiSR, rsiSR, rsiSR, 14), 3) 18 | dSR = sma(kSR, 3) 19 | 20 | // RSI with moving average 21 | up = rma(max(change(close), 0), 14) 22 | down = rma(-min(change(close), 0), 14) 23 | rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 24 | rsiMA = ema(rsi, 14) 25 | 26 | // If MACD is crossing up 27 | macdGood = (cross(currMacd, signal) and currMacd > signal and currMacd <= 2) 28 | // And Stochastic between 20 and 80 29 | stochGood = dSR > 19 and dSR < 80 30 | // And Stochastic recently below 20 (last 10 bars) 31 | stochRecent = dSR[1] < 20 or dSR[2] < 20 or dSR[3] < 20 or dSR[4] < 20 or dSR[5] < 20 or dSR[6] < 20 or dSR[7] < 20 or dSR[8] < 20 or dSR[9] < 20 32 | // And RSI above the MA 33 | rsiGood = rsi > rsiMA 34 | 35 | buySignal = macdGood and stochGood and stochRecent and rsiGood 36 | buyMe = buySignal and not buySignal[1] 37 | 38 | plotshape(buyMe ? close : na, title="Hulk", text="Hulk", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(40, 154, 71), textcolor=color.white) 39 | 40 | ///////////////////////////////////////////////////////////////// 41 | 42 | TimeWindow=time(timeframe.period,"1400-1900", "GMT") 43 | 44 | if (buySignal and TimeWindow) 45 | strategy.entry("Trade", strategy.long, comment="Long") 46 | //if (showSell78 and TimeWindow) 47 | // strategy.entry("Trade", strategy.short, comment="Short") 48 | 49 | trailSource = input(title="Trail Source", defval="Lows/Highs", options=["Lows/Highs", "Close", "Open"], confirm=true, group="Strategy") 50 | trailMethod = input(title="Trail Method", defval="ATR", options=["ATR", "Percent"], confirm=true, group="Strategy") 51 | trailPercent = input(title="Trail Percent", defval=10, minval=0.1, confirm=true, group="Strategy") 52 | swingLookback = input(title="Lookback", defval=7, confirm=true, group="Strategy") 53 | atrPeriod = input(title="ATR Period", defval=14, confirm=true, group="Strategy") 54 | atrMultiplier = input(title="ATR Multiplier", defval=1.0, confirm=true, group="Strategy") 55 | barTime = input(title="Bar Time", defval=timestamp("01 Jan 2021 13:30 +0000"), confirm=true, group="Strategy") 56 | 57 | var float trailPrice = na 58 | float next_trailPrice = na 59 | 60 | atrValue = atr(atrPeriod) * atrMultiplier 61 | float swingLow = lowest(low, swingLookback) 62 | float swingHigh = highest(high, swingLookback) 63 | 64 | 65 | if trailMethod == "ATR" 66 | if trailSource == "Close" 67 | next_trailPrice := strategy.position_size > 0 ? close - atrValue : close + atrValue 68 | else if trailSource == "Open" 69 | next_trailPrice := strategy.position_size > 0 ? open - atrValue : open + atrValue 70 | else 71 | next_trailPrice := strategy.position_size > 0 ? swingLow - atrValue : swingHigh + atrValue 72 | 73 | if trailMethod == "Percent" 74 | float percentMulti = strategy.position_size > 0 ? (100 - trailPercent) / 100 : (100 + trailPercent) / 100 75 | if trailSource == "Close" 76 | next_trailPrice := close * percentMulti 77 | else if trailSource == "Open" 78 | next_trailPrice := open * percentMulti 79 | else 80 | next_trailPrice := strategy.position_size > 0 ? swingLow * percentMulti : swingHigh * percentMulti 81 | 82 | if strategy.position_size != 0 and barstate.isconfirmed 83 | if (next_trailPrice > trailPrice or na(trailPrice)) and strategy.position_size > 0 84 | trailPrice := next_trailPrice 85 | if (next_trailPrice < trailPrice or na(trailPrice)) and strategy.position_size < 0 86 | trailPrice := next_trailPrice 87 | 88 | plot(strategy.position_size != 0 ? trailPrice : na, color=color.red, title="Trailing Stop") 89 | 90 | strategy.exit(id="Trail Exit", from_entry="Trade", limit=na, stop=trailPrice) 91 | 92 | if (strategy.position_size > 0 and close < trailPrice) or (strategy.position_size < 0 and close > trailPrice) 93 | strategy.close("Trade") 94 | 95 | -------------------------------------------------------------------------------- /GreenHulk.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study(title = "Green Hulk", overlay=true, format=format.price, precision=2) 3 | 4 | // Movivated by this video by Serious Backtester: https://www.youtube.com/watch?v=lXYGrhZcYBc 5 | // The Hulk has been many colors, other than green. But this is entitled Green Hulk, due to only LONGs with this strategy 6 | // This strategy works best on DAILY candles. One hour was ok, but anything lower than an hour candle performed poorly 7 | 8 | // MACD 9 | [currMacd,_,_] = macd(close[0], 12, 26, 9) 10 | [prevMacd,_,_] = macd(close[1], 12, 26, 9) 11 | signal = ema(currMacd, 9) 12 | 13 | // STOCHASTIC RSI 14 | rsiSR = rsi(close, 14) 15 | kSR = sma(stoch(rsiSR, rsiSR, rsiSR, 14), 3) 16 | dSR = sma(kSR, 3) 17 | 18 | // RSI with moving average 19 | up = rma(max(change(close), 0), 14) 20 | down = rma(-min(change(close), 0), 14) 21 | rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 22 | rsiMA = ema(rsi, 14) 23 | 24 | // If MACD is crossing up 25 | macdGood = (cross(currMacd, signal) and currMacd > signal and currMacd <= 2) 26 | // And Stochastic between 20 and 80 27 | stochGood = dSR > 19 and dSR < 80 28 | // And Stochastic recently below 20 (last 10 bars) 29 | stochRecent = dSR[1] < 20 or dSR[2] < 20 or dSR[3] < 20 or dSR[4] < 20 or dSR[5] < 20 or dSR[6] < 20 or dSR[7] < 20 or dSR[8] < 20 or dSR[9] < 20 30 | // And RSI above the MA 31 | rsiGood = rsi > rsiMA 32 | 33 | buySignal = macdGood and stochGood and stochRecent and rsiGood 34 | buyMe = buySignal and not buySignal[1] 35 | 36 | plotshape(buyMe ? close : na, title="Hulk", text="Hulk", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(40, 154, 71), textcolor=color.white) 37 | 38 | // Find swing low from past 10 candles 39 | low_10 = lowest(close, 10) 40 | // STOP = swing low, TP = 1.5 profit factor 41 | plotshape(buyMe ? abs(low - low_10) * 1.5 + high : na, title='ATR ceiling', color=color.lime, style=shape.xcross, size=size.tiny, location=location.absolute) 42 | plotshape(buyMe ? low_10 : na, title='ATR floor', color=color.red, style=shape.xcross, size=size.tiny, location=location.absolute) 43 | -------------------------------------------------------------------------------- /GreenHulk_v_1_3.pine: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="Green Hulk version 1.31 with Stochastic", overlay=true, format=format.price, precision=2) 3 | 4 | // Inputs 5 | fastLength = input.int(12, title="MACD Fast Length") 6 | slowLength = input.int(26, title="MACD Slow Length") 7 | signalLength = input.int(9, title="MACD Signal Length") 8 | macdThreshold = input.float(2.0, title="Current MACD <=", step=0.1) 9 | stochLength = input.int(14, title="Stochastic Length") 10 | kSmoothing = input.int(3, title="Stochastic %K Smoothing", minval=1) 11 | dSmoothing = input.int(3, title="Stochastic %D Smoothing", minval=1) 12 | stochKMin = input.float(20.0, title="Stochastic %K Minimum", step=0.1) 13 | stochKMax = input.float(80.0, title="Stochastic %K Maximum", step=0.1) 14 | stochDMin = input.float(20.0, title="Stochastic %D Minimum", step=0.1) 15 | stochDMax = input.float(80.0, title="Stochastic %D Maximum", step=0.1) 16 | checkDStochOnly = input.bool(false, title="Check Stochastic %D Only") 17 | rsiLength = input.int(14, title="RSI Length") 18 | rsiMALength = input.int(14, title="RSI MA Length") 19 | useTrendFilter = input.bool(false, title="Use Trend Filter") 20 | trendFilterType = input.string("EMA", title="Trend Filter Type", options=["EMA", "SMA"]) 21 | trendFilterLength = input.int(21, title="Trend Filter Length") 22 | atrPeriod = input.int(14, title="ATR Period", minval=1) 23 | slMethod = input.string("Default", title="SL Method", options=["Default", "ATR"]) 24 | slAtrMultiple = input.float(2.0, title="SL ATR Multiple", minval=0.1, step=0.1) 25 | tpMethod = input.string("Default", title="TP Method", options=["Default", "ATR"]) 26 | tpAtrMultiple = input.float(3.0, title="TP ATR Multiple", minval=0.1, step=0.1) 27 | showBacktest = input.bool(false, title="Show Backtest Results") 28 | 29 | // MACD Calculation 30 | [macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalLength) 31 | currMacd = macdLine 32 | signal = signalLine 33 | 34 | // Stochastic Calculation 35 | stochKRaw = ta.stoch(close, high, low, stochLength) 36 | stochK = ta.sma(stochKRaw, kSmoothing) 37 | stochD = ta.sma(stochK, dSmoothing) 38 | 39 | // RSI with Moving Average 40 | rsi = ta.rsi(close, rsiLength) 41 | rsiMA = ta.ema(rsi, rsiMALength) 42 | 43 | // Conditions 44 | macdGood = ta.cross(currMacd, signal) and currMacd > signal and currMacd <= macdThreshold 45 | stochGood = checkDStochOnly ? (stochD > stochDMin and stochD < stochDMax) : (stochK > stochKMin and stochK < stochKMax and stochD > stochDMin and stochD < stochDMax) 46 | stochRecent = checkDStochOnly ? (ta.barssince(stochD < stochDMin) <= 9) : (ta.barssince(stochK < stochKMin or stochD < stochDMin) <= 9) 47 | rsiGood = rsi > rsiMA 48 | 49 | // Trend Filter 50 | trendFilterValue = trendFilterType == "EMA" ? ta.ema(close, trendFilterLength) : ta.sma(close, trendFilterLength) 51 | trendFilter = useTrendFilter ? close > trendFilterValue : true 52 | 53 | // Buy Signal 54 | buySignal = macdGood and stochGood and stochRecent and rsiGood and trendFilter 55 | buyMe = buySignal and not buySignal[1] 56 | 57 | // ATR Calculation 58 | atr = ta.atr(atrPeriod) 59 | 60 | // Stop Loss and Take Profit 61 | sl = slMethod == "Default" ? ta.lowest(low, 10) : close - (atr * slAtrMultiple) 62 | tp = tpMethod == "Default" ? close + 1.5 * (close - sl) : close + (atr * tpAtrMultiple) 63 | 64 | // Plotting 65 | plotshape(buyMe ? close : na, title="Hulk", text="Hulk", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(40, 154, 71), textcolor=color.white) 66 | plotshape(buyMe ? tp : na, title="Take Profit", color=color.lime, style=shape.xcross, size=size.tiny, location=location.absolute) 67 | plotshape(buyMe ? sl : na, title="Stop Loss", color=color.red, style=shape.xcross, size=size.tiny, location=location.absolute) 68 | 69 | // Alerts 70 | alertcondition(buyMe, title="HULK BUY", message="HULK BUY") 71 | 72 | // Backtesting Logic 73 | var float entryPrice = na 74 | var float stopLoss = na 75 | var float takeProfit = na 76 | var int tradeCount = 0 77 | var int winCount = 0 78 | var bool inTrade = false 79 | 80 | if buyMe 81 | entryPrice := close 82 | stopLoss := sl 83 | takeProfit := tp 84 | inTrade := true 85 | else if inTrade 86 | if low <= stopLoss 87 | tradeCount += 1 88 | inTrade := false 89 | else if high >= takeProfit 90 | tradeCount += 1 91 | winCount += 1 92 | inTrade := false 93 | 94 | // Calculate Win Rate 95 | float winRate = na 96 | if tradeCount > 0 97 | winRate := (winCount / tradeCount) * 100 98 | 99 | // Table for Backtest Results 100 | if showBacktest 101 | var table backtestTable = table.new(position.top_right, 2, 4, border_width=1) 102 | table.cell(backtestTable, 0, 0, "Total Trades", bgcolor=color.gray) 103 | table.cell(backtestTable, 1, 0, str.tostring(tradeCount), bgcolor=color.gray) 104 | table.cell(backtestTable, 0, 1, "Winning Trades", bgcolor=color.gray) 105 | table.cell(backtestTable, 1, 1, str.tostring(winCount), bgcolor=color.gray) 106 | table.cell(backtestTable, 0, 2, "Win Rate (%)", bgcolor=color.gray) 107 | table.cell(backtestTable, 1, 2, str.tostring(winRate, "#.##"), bgcolor=color.gray) -------------------------------------------------------------------------------- /HourlyScan.pine: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study(title="Hourly Scan", overlay=true) 3 | 4 | // Idea from "Serious Backtester" - https://www.youtube.com/watch?v=2hX7qTamOAQ 5 | // Defaults are optimized for 30 min candles 6 | // This combines the idea of a trampoline with Bollinger Bands and RSI 7 | 8 | // CONFIG 9 | iBBThreshold = input(0.0010, minval=0.0, title="Bollinger Lower Threshold", tooltip="0.003 for daily, 0.0015 for 30 min candles", group="General Settings") 10 | RSIThreshold = input(25, minval=1, title="RSI Lower Threshold", tooltip="Normally 25", group="General Settings") 11 | RSIDown = input(72, minval=1, title="RSI Upper Threshold", tooltip="Normally 75", group="General Settings") 12 | 13 | rsiLengthInput = input(14, minval=1, title="RSI Length", group="RSI Settings") 14 | rsiSourceInput = input(close, "Source", group="RSI Settings") 15 | lengthBB = input(20, minval=1, group="Bollinger Bands") 16 | srcBB = input(close, title="Source", group="Bollinger Bands") 17 | multBB = input(2.0, minval=0.001, maxval=50, title="StdDev", group="Bollinger Bands") 18 | offsetBB = input(0, "Offset", minval = -500, maxval = 500, group="Bollinger Bands") 19 | 20 | isRed = close < open 21 | isGreen = close > open 22 | 23 | // BOLLINGER BANDS 24 | basisBB = sma(srcBB, lengthBB) 25 | devBB = multBB * stdev(srcBB, lengthBB) 26 | upperBB = basisBB + devBB 27 | lowerBB = basisBB - devBB 28 | downBB = low < lowerBB or high < lowerBB 29 | upBB = low > upperBB or high > upperBB 30 | bbw = (upperBB - lowerBB) / basisBB 31 | 32 | // RSI 33 | up = rma(max(change(rsiSourceInput), 0), rsiLengthInput) 34 | down = rma(-min(change(rsiSourceInput), 0), rsiLengthInput) 35 | rsiM = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 36 | back1 = isRed[1] and rsiM[1] <= RSIThreshold and close[1] < lowerBB[1] and bbw[1] > iBBThreshold 37 | for1 = isGreen[1] and rsiM[1] >= RSIDown and close[1] > upperBB[1] and bbw[1] > iBBThreshold 38 | 39 | weGoUp = isGreen and (back1 ) and (high > high[1]) 40 | upThrust = weGoUp and not weGoUp[1] and not weGoUp[2] and not weGoUp[3] and not weGoUp[4] 41 | weGoDown = isRed and (for1 ) and (low < low[1]) 42 | downThrust = weGoDown and not weGoDown[1] and not weGoDown[2] and not weGoDown[3] and not weGoDown[4] 43 | 44 | atrUp = high + atr(14) * 1.2 45 | atrDown = low - atr(14) * 1.6 46 | 47 | if (upThrust) 48 | alert("Trampoline Buy on " + syminfo.ticker + " at " + str.tostring(close, "#.##") + ", TP: " + str.tostring(atrUp, "#.##"), alert.freq_once_per_bar) 49 | if (downThrust) 50 | alert("Trampoline Sell on " + syminfo.ticker + " at " + str.tostring(close, "#.##") + ", TP: " + str.tostring(atrDown, "#.##"), alert.freq_once_per_bar) 51 | -------------------------------------------------------------------------------- /Hulk.pine: -------------------------------------------------------------------------------- 1 | // Credit @HomelessLemon and @Violents 2 | 3 | //@version=4 4 | 5 | study("Renko Scalping Idea", shorttitle="Renko Scalping Idea", overlay=true) 6 | 7 | iRed = 0 8 | iGreen = 0 9 | 10 | c1 = color.new(#26a69a, 25) 11 | c2 = color.new(#ef5350, 25) 12 | 13 | cTrans = 90 14 | 15 | cGreen1 = color.new(#d1fa02, cTrans) 16 | cGreen2 = color.new(#b0fa02, cTrans) 17 | cGreen3 = color.new(#82fa02, cTrans) 18 | cGreen4 = color.new(#17fa02, cTrans) 19 | 20 | cYellow = color.new(#baa100, cTrans) 21 | 22 | cRed1 = color.new(#fa7a02, cTrans) 23 | cRed2 = color.new(#fa4d02, cTrans) 24 | cRed3 = color.new(#fa2c02, cTrans) 25 | cRed4 = color.new(#fa0202, cTrans) 26 | 27 | count = 1 * 5 28 | maNumber = 16 29 | 30 | getMa(c)=> 31 | l = count + (1 * c) 32 | sma(close, l) 33 | 34 | sma6 = maNumber >= 6 ? getMa(5 ) : na 35 | sma7 = maNumber >= 7 ? getMa(6 ) : na 36 | sma8 = maNumber >= 8 ? getMa(7 ) : na 37 | sma9 = maNumber >= 9 ? getMa(8 ) : na 38 | sma10 = maNumber >= 10 ? getMa(9 ) : na 39 | sma11 = maNumber >= 11 ? getMa(10) : na 40 | sma12 = maNumber >= 12 ? getMa(11) : na 41 | sma13 = maNumber >= 13 ? getMa(12) : na 42 | sma14 = maNumber >= 14 ? getMa(13) : na 43 | sma15 = maNumber >= 15 ? getMa(14) : na 44 | sma16 = maNumber >= 16 ? getMa(15) : na 45 | sma17 = maNumber >= 17 ? getMa(16) : na 46 | sma18 = maNumber >= 18 ? getMa(17) : na 47 | sma19 = maNumber >= 19 ? getMa(18) : na 48 | sma20 = maNumber >= 20 ? getMa(19) : na 49 | sma21 = maNumber >= 21 ? getMa(20) : na 50 | 51 | if (sma6 <= close) 52 | iGreen := iGreen + 1 53 | else 54 | iRed := iRed + 1 55 | if (sma7 <= close) 56 | iGreen := iGreen + 1 57 | else 58 | iRed := iRed + 1 59 | if (sma8 <= close) 60 | iGreen := iGreen + 1 61 | else 62 | iRed := iRed + 1 63 | if (sma9 <= close) 64 | iGreen := iGreen + 1 65 | else 66 | iRed := iRed + 1 67 | if (sma10 <= close) 68 | iGreen := iGreen + 1 69 | else 70 | iRed := iRed + 1 71 | if (sma11 <= close) 72 | iGreen := iGreen + 1 73 | else 74 | iRed := iRed + 1 75 | if (sma12 <= close) 76 | iGreen := iGreen + 1 77 | else 78 | iRed := iRed + 1 79 | if (sma13 <= close) 80 | iGreen := iGreen + 1 81 | else 82 | iRed := iRed + 1 83 | if (sma14 <= close) 84 | iGreen := iGreen + 1 85 | else 86 | iRed := iRed + 1 87 | if (sma15 <= close) 88 | iGreen := iGreen + 1 89 | else 90 | iRed := iRed + 1 91 | if (sma16 <= close) 92 | iGreen := iGreen + 1 93 | else 94 | iRed := iRed + 1 95 | if (sma17 <= close) 96 | iGreen := iGreen + 1 97 | else 98 | iRed := iRed + 1 99 | if (sma18 <= close) 100 | iGreen := iGreen + 1 101 | else 102 | iRed := iRed + 1 103 | if (sma19 <= close) 104 | iGreen := iGreen + 1 105 | else 106 | iRed := iRed + 1 107 | if (sma20 <= close) 108 | iGreen := iGreen + 1 109 | else 110 | iRed := iRed + 1 111 | if (sma21 <= close) 112 | iGreen := iGreen + 1 113 | else 114 | iRed := iRed + 1 115 | 116 | if (iRed > 14) 117 | c1 := color.new(#ff2a2a, cTrans) 118 | c2 := color.new(#ff2a2a, 0) 119 | else if (iGreen > 10) 120 | c1 := color.new(color.lime, cTrans) 121 | c2 := color.lime 122 | else 123 | c1 := color.new(color.yellow, cTrans) 124 | 125 | // WAE - Waddah Attar Explosion v1 by LazyBear 126 | 127 | sensitivity = input(150, title="Sensitivity", group="WAE") 128 | fastLength=input(20, title="FastEMA Length", group="WAE") 129 | slowLength=input(40, title="SlowEMA Length", group="WAE") 130 | channelLength=input(20, title="BB Channel Length", group="WAE") 131 | multWAE=input(2.0, title="BB Stdev Multiplier", group="WAE") 132 | DeadZone=input(3.7, title="Dead Zone Multiplier", group="WAE") 133 | 134 | DEAD_ZONE = nz(rma(tr(true),400)) * DeadZone 135 | 136 | calc_macd(source, fastLength, slowLength) => 137 | fastMA = ema(source, fastLength) 138 | slowMA = ema(source, slowLength) 139 | fastMA - slowMA 140 | 141 | calc_BBUpper(source, length, mult) => 142 | basis = sma(source, length) 143 | dev = mult * stdev(source, length) 144 | basis + dev 145 | 146 | calc_BBLower(source, length, mult) => 147 | basis = sma(source, length) 148 | dev = mult * stdev(source, length) 149 | basis - dev 150 | 151 | t1 = (calc_macd(close, fastLength, slowLength) - calc_macd(close[1], fastLength, slowLength))*sensitivity 152 | e1 = (calc_BBUpper(close, channelLength, multWAE) - calc_BBLower(close, channelLength, multWAE)) 153 | 154 | trendUp = (t1 >= 0) ? t1 : 0 155 | trendDown = (t1 < 0) ? (-1*t1) : 0 156 | 157 | barcolor((trendUp >= 120 or trendDown >= 120)? c2: c1) 158 | plot(sma6, color = (trendUp >= 120 or trendDown >= 120)? c2: c1, title="MA21", linewidth=2, style=plot.style_line) 159 | -------------------------------------------------------------------------------- /HulkScanner.pine: -------------------------------------------------------------------------------- 1 | //@version=6 2 | indicator("HULK Scanner", overlay=true) 3 | // vim: syntax=pine 4 | 5 | // Movivated by this video by Serious Backtester: https://www.youtube.com/watch?v=lXYGrhZcYBc 6 | // The Hulk has been many colors, other than green. But this is entitled Green Hulk, due to only LONGs with this strategy 7 | // This strategy works best on DAILY candles. One hour was ok, but anything lower than an hour candle performed poorly 8 | 9 | bool bf = input.bool(true, "PERIOD MUST BE SET TO ONE DAY !", group="Pay the fuck attention") 10 | bool bNASDAQ = input.bool(true, "Scan NASDAQ", group="Stocks to scan") 11 | bool bNYSE = input.bool(false, "Scan NYSE", group="Stocks to scan") 12 | bool bGold = input.bool(false, "Scan Commodities", group="Stocks to scan") 13 | 14 | var tbl = table.new(position.top_right, 2, 50) 15 | table.cell(tbl, 0, 0, "Ticker", width = 5, height = 2, text_color = color.orange, text_size = size.tiny) 16 | table.cell(tbl, 1, 0, "Last Hulk", bgcolor = color.rgb(0, 0, 0), width = 5, height = 2, text_color = color.orange, text_size = size.tiny) 17 | var int iRow = 1 18 | 19 | GreenHulk(pair) => 20 | [currMacd, tickM2, tickMacdHist] = request.security(pair, "1D", ta.macd(close, 12, 26, 9)) 21 | //rsiSR = request.security(pair, "1D", ta.rsi(close, 14)) 22 | //dSR = request.security(pair, "1D", ta.sma(ta.stoch(ta.rsi(close, 14), ta.rsi(close, 14), ta.rsi(close, 14), 14), 3)) 23 | [Close, signal, kSR, up, down, rsiMA] = request.security(pair, "1D", [close, ta.ema(currMacd, 9), ta.sma(ta.sma(ta.stoch(ta.rsi(close, 14), ta.rsi(close, 14), ta.rsi(close, 14), 14), 3), 3), ta.rma(math.max(ta.change(close), 0), 14), ta.rma(-math.min(ta.change(close), 0), 14), ta.ema(ta.rsi(close, 14), 14)]) 24 | 25 | rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 26 | macdGood = (ta.cross(currMacd, signal) and currMacd > signal and currMacd <= 2) 27 | 28 | stochGood = dSR > 19 and dSR < 80 29 | stochRecent = dSR[1] < 20 or dSR[2] < 20 or dSR[3] < 20 or dSR[4] < 20 or dSR[5] < 20 or dSR[6] < 20 or dSR[7] < 20 or dSR[8] < 20 or dSR[9] < 20 30 | rsiGood = rsi > rsiMA 31 | buySignal = macdGood and stochGood and stochRecent and rsiGood 32 | buyMe = buySignal and not buySignal[1] 33 | buyMe 34 | 35 | InvestCheck(pair, row) => 36 | Time = time(timeframe.period) 37 | color Cl = month(Time) == month(timenow) and year(Time) == year(timenow) and dayofmonth(Time) == dayofmonth(timenow)-1 ? color.lime : color.white 38 | if GreenHulk(pair) and row < 40 and month(Time) == month(timenow) and year(Time) == year(timenow) 39 | table.cell(tbl, 0, row, pair, bgcolor = color.rgb(0, 0, 0), width = 5, height = 2, text_color = Cl, text_size = size.tiny) 40 | table.cell(tbl, 1, row, str.tostring(month(Time)) + "/" + str.tostring(dayofmonth(Time)) + "/" + str.tostring(year(Time)), bgcolor = color.rgb(0, 0, 0), width = 5, height = 2, text_color = Cl, text_size = size.tiny) 41 | row + 1 42 | else 43 | row 44 | 45 | if bNASDAQ 46 | iRow := InvestCheck("NASDAQ:NVDA", iRow) 47 | iRow := InvestCheck("NASDAQ:TSLA", iRow) 48 | iRow := InvestCheck("NASDAQ:AAPL", iRow) 49 | iRow := InvestCheck("NASDAQ:NFLX", iRow) 50 | iRow := InvestCheck("NASDAQ:MSFT", iRow) 51 | iRow := InvestCheck("NASDAQ:GOOGL", iRow) 52 | iRow := InvestCheck("NASDAQ:COST", iRow) 53 | iRow := InvestCheck("NASDAQ:DLTR", iRow) 54 | iRow := InvestCheck("NASDAQ:ADBE", iRow) 55 | iRow := InvestCheck("NASDAQ:META", iRow) 56 | iRow := InvestCheck("NASDAQ:AMD", iRow) 57 | iRow := InvestCheck("NASDAQ:COIN", iRow) 58 | iRow := InvestCheck("NASDAQ:MSTR", iRow) 59 | iRow := InvestCheck("NASDAQ:MU", iRow) 60 | iRow := InvestCheck("NASDAQ:SBUX", iRow) 61 | iRow := InvestCheck("NASDAQ:QCOM", iRow) 62 | 63 | 64 | if bNYSE 65 | //iRow := InvestCheck("NYSE:BABA", iRow) 66 | //iRow := InvestCheck("NYSE:SNAP", iRow) 67 | //iRow := InvestCheck("NYSE:NKE", iRow) 68 | //iRow := InvestCheck("NYSE:UBER", iRow) 69 | //iRow := InvestCheck("NYSE:DIS", iRow) 70 | //iRow := InvestCheck("NYSE:WMT", iRow) 71 | //iRow := InvestCheck("NYSE:DELL", iRow) 72 | //iRow := InvestCheck("NYSE:CMG", iRow) 73 | //iRow := InvestCheck("NYSE:JPM", iRow) 74 | //iRow := InvestCheck("NYSE:BAC", iRow) 75 | //iRow := InvestCheck("NYSE:PFE", iRow) 76 | //iRow := InvestCheck("NYSE:INFY", iRow) 77 | //iRow := InvestCheck("NYSE:MCD", iRow) 78 | 79 | if bGold 80 | //iRow := InvestCheck("AMEX:GDX", iRow) 81 | //iRow := InvestCheck("AMEX:GLD", iRow) 82 | //iRow := InvestCheck("AMEX:SLV", iRow) 83 | //iRow := InvestCheck("AMEX:COPX", iRow) 84 | //iRow := InvestCheck("AMEX:CMDY", iRow) 85 | //iRow := InvestCheck("AMEX:DBA", iRow) 86 | //iRow := InvestCheck("AMEX:OIH", iRow) 87 | //iRow := InvestCheck("AMEX:VTI", iRow) 88 | 89 | plotshape(false ? close : na, title="Hulk", text="Hulk", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(40, 154, 71), textcolor=color.white) 90 | 91 | -------------------------------------------------------------------------------- /LindaMACD.pine: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator("Linda MACD", shorttitle="Linda MACD", overlay=false) 3 | 4 | res = input.timeframe("", "Indicator TimeFrame") 5 | fastMA = input.int(title="Fast moving average", defval=3) 6 | slowMA = input.int(title="Slow moving average", defval=10) 7 | signalLength = input.int(title="Slow moving average", defval=26) 8 | 9 | fast_ma = request.security(syminfo.tickerid, res, ta.ema(close, fastMA)) 10 | slow_ma = request.security(syminfo.tickerid, res, ta.ema(close, slowMA)) 11 | macd = fast_ma - slow_ma 12 | signal = request.security(syminfo.tickerid, res, ta.ema(macd, signalLength)) 13 | t1 = macd - signal 14 | 15 | trendUp = (t1 >= 0) ? t1 : 0 16 | trendDown = (t1 < 0) ? (-1*t1) : 0 17 | 18 | plot(trendUp, style=plot.style_columns, linewidth=1, color=(trendUp 19 | fastMA = ta.ema(source, fastLength) 20 | slowMA = ta.ema(source, slowLength) 21 | fastMA - slowMA 22 | 23 | calc_BBUpper(source, length, mult) => 24 | basis = ta.sma(source, length) 25 | dev = mult * ta.stdev(source, length) 26 | basis + dev 27 | 28 | calc_BBLower(source, length, mult) => 29 | basis = ta.sma(source, length) 30 | dev = mult * ta.stdev(source, length) 31 | basis - dev 32 | 33 | t1 = (calc_macd(close, fastLength, slowLength) - calc_macd(close[1], fastLength, slowLength))*sensitivity 34 | t2 = (calc_macd(close[2], fastLength, slowLength) - calc_macd(close[3], fastLength, slowLength))*sensitivity 35 | 36 | e1 = (calc_BBUpper(close, channelLength, mult) - calc_BBLower(close, channelLength, mult)) 37 | e2 = (calc_BBUpper(close[1], channelLength, mult) - calc_BBLower(close[1], channelLength, mult)) 38 | 39 | waeUp = (t1 >= 0) ? t1 : 0 40 | waeDown = (t1 < 0) ? (-1*t1) : 0 41 | 42 | psar = ta.sar(0.02, 0.02, 0.2) 43 | psarDir = psar < close ? 1 : -1 44 | 45 | fast_ma = request.security(syminfo.tickerid, "", ta.sma(close, 3)) 46 | slow_ma = request.security(syminfo.tickerid, "", ta.sma(close, 10)) 47 | macd = fast_ma - slow_ma 48 | signal = request.security(syminfo.tickerid, "", ta.sma(macd, 16)) 49 | r1 = macd - signal 50 | LindaUp = (r1 >= 0) ? r1 : 0 51 | LindaDown = (r1 < 0) ? (-1*r1) : 0 52 | 53 | hullma = ta.wma(2*ta.wma(close, 5)-ta.wma(close, 10), math.floor(math.sqrt(10))) 54 | 55 | high_ = ta.highest(hl2, 10) 56 | low_ = ta.lowest(hl2, 10) 57 | round_(val) => val > .99 ? .999 : val < -.99 ? -.999 : val 58 | value = 0.0 59 | value := round_(.66 * ((hl2 - low_) / (high_ - low_) - .5) + .67 * nz(value[1])) 60 | fish1 = 0.0 61 | fish1 := .5 * math.log((1 + value) / (1 - value)) + .5 * nz(fish1[1]) 62 | fish2 = fish1[1] 63 | 64 | // CCI #1 - red 65 | ma1 = ta.sma(hlc3, 14) 66 | cci1 = (close - ma1) / (0.015 * ta.dev(close, 14)) 67 | plot(cci1, "CCI 1", color=#b72842, linewidth=2) 68 | // CCI #2 - yellow 69 | ma2 = ta.sma(close, 100) 70 | cci2 = (close - ma2) / (0.015 * ta.dev(close, 100)) 71 | plot(cci2, "CCI 2", color=#d4cd0f, linewidth=2) 72 | 73 | 74 | 75 | // Halftrend 76 | amplitude = input(title="Amplitude", defval=2, group="Halftrend") 77 | channelDeviation = input(title="Channel Deviation", defval=2, group="Halftrend") 78 | 79 | var int trend = 0 80 | var int nextTrend = 0 81 | var float maxLowPrice = nz(low[1], low) 82 | var float minHighPrice = nz(high[1], high) 83 | 84 | var float up1 = 0.0 85 | var float down1 = 0.0 86 | float atrHigh = 0.0 87 | float atrLow = 0.0 88 | float arrowUp = na 89 | float arrowDown = na 90 | 91 | atr2 = ta.atr(100) / 2 92 | dev = channelDeviation * atr2 93 | 94 | highPrice = high[math.abs(ta.highestbars(amplitude))] 95 | lowPrice = low[math.abs(ta.lowestbars(amplitude))] 96 | highma = ta.sma(high, amplitude) 97 | lowma = ta.sma(low, amplitude) 98 | 99 | if nextTrend == 1 100 | maxLowPrice := math.max(lowPrice, maxLowPrice) 101 | 102 | if highma < maxLowPrice and close < nz(low[1], low) 103 | trend := 1 104 | nextTrend := 0 105 | minHighPrice := highPrice 106 | else 107 | minHighPrice := math.min(highPrice, minHighPrice) 108 | 109 | if lowma > minHighPrice and close > nz(high[1], high) 110 | trend := 0 111 | nextTrend := 1 112 | maxLowPrice := lowPrice 113 | 114 | if trend == 0 115 | if not na(trend[1]) and trend[1] != 0 116 | up1 := na(down1[1]) ? down1 : down1[1] 117 | arrowUp := up1 - atr2 118 | else 119 | up1 := na(up1[1]) ? maxLowPrice : math.max(maxLowPrice, up1[1]) 120 | atrHigh := up1 + dev 121 | atrLow := up1 - dev 122 | else 123 | if not na(trend[1]) and trend[1] != 1 124 | down1 := na(up1[1]) ? up1 : up1[1] 125 | arrowDown := down1 + atr2 126 | else 127 | down1 := na(down1[1]) ? minHighPrice : math.min(minHighPrice, down1[1]) 128 | atrHigh := down1 + dev 129 | atrLow := down1 - dev 130 | 131 | HalfTrue = trend == 0 132 | 133 | plotshape(true ? 55 : na, style=shape.triangleup, location=location.absolute, size=size.tiny, title="eMAMA Cross Up", color=#00ff84) 134 | plotshape(true ? 55 : na, style=shape.triangledown, location=location.absolute, size=size.tiny, title="eMAMA Cross Down", color=#ff0000) -------------------------------------------------------------------------------- /MACD PSAR Indicator.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study(title = "MACD Psar v1.1", overlay = true, format=format.price, precision=2) 3 | 4 | var crossoverBear = false 5 | var crossoverBull = false 6 | 7 | // gapMACD = input(title="MACD Gap Threshold", type=input.integer, defval=1, group="Basic Settings", tooltip="How much distance between MACD line and the zero line is acceptable to show an indicator? Larger numbers will filter out more noise") 8 | adxThreshold = input(0, title="ADX Threshold", group="Basic Settings", tooltip="ADX value that must be reached in order for an indicator to display. Larger numbers will filter out more noise") 9 | filter200 = input(false, title="Filter by 200 EMA", group="Basic Settings", tooltip="Use 200 EMA to determine trend direction. Only show SELL below it, only show BUY above it") 10 | filter850 = input(false, title="Filter by 8/50 EMA", group="Basic Settings", tooltip="Use 8/50 inverse combo to show BUY/SELL. If 8 is above 50, then we're too high up and need to sell, thus only show SELL during that, and vice versa for BUY. NOTE: This is INVERSE") 11 | 12 | psarStart = input(title="PSAR Start", type=input.float, step=0.001, defval=0.02, group="PSAR") 13 | psarIncrement = input(title="PSAR Increment", type=input.float, step=0.001, defval=0.02, group="PSAR") 14 | psarMaximum = input(title="PSAR Maximum", type=input.float, step=0.01, defval=0.2, group="PSAR") 15 | 16 | // Average Directional Index 17 | adxlen = input(14, title="ADX Smoothing", group="ADX") 18 | dilen = input(14, title="DI Length", group="ADX") 19 | dirmov(len) => 20 | up = change(high) 21 | down = -change(low) 22 | plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) 23 | minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) 24 | truerange = rma(tr, len) 25 | plus = fixnan(100 * rma(plusDM, len) / truerange) 26 | minus = fixnan(100 * rma(minusDM, len) / truerange) 27 | [plus, minus] 28 | adx(dilen, adxlen) => 29 | [plus, minus] = dirmov(dilen) 30 | sum = plus + minus 31 | adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) 32 | adxValue = adx(dilen, adxlen) 33 | 34 | // Parabolic SAR 35 | psar = sar(psarStart, psarIncrement, psarMaximum) 36 | psarDir = psar < close ? 1 : -1 37 | 38 | // MACD 39 | fastMA = input(title="Fast moving average", type=input.integer, defval=12, minval=7, group="MACD") 40 | slowMA = input(title="Slow moving average", type=input.integer, defval=26, minval=7, group="MACD") 41 | signalLength = input(9,minval=1) 42 | 43 | [currMacd,_,_] = macd(close[0], fastMA, slowMA, signalLength) 44 | [prevMacd,_,_] = macd(close[1], fastMA, slowMA, signalLength) 45 | signal = ema(currMacd, signalLength) 46 | 47 | if (cross(currMacd, signal) and currMacd < signal and currMacd >= -2) 48 | crossoverBear := true 49 | crossoverBull := false 50 | 51 | if (cross(currMacd, signal) and currMacd > signal and currMacd <= 2) 52 | crossoverBull := true 53 | crossoverBear := false 54 | 55 | iBuy = (crossoverBull and psar < close and adxValue > adxThreshold) 56 | iSell = (crossoverBear and psar > close and adxValue > adxThreshold) 57 | 58 | showBuy = iBuy and not iBuy[1] 59 | showSell = iSell and not iSell[1] 60 | 61 | filterBuy200 = (filter200 and ema(close,200) > close) or (filter850 and ema(close,8) < ema(close,50)) 62 | filterSell200 = (filter200 and ema(close,200) < close) or (filter850 and ema(close,8) > ema(close,50)) 63 | 64 | // plotchar(showBuy and adxValue > adxThreshold and not filterBuy200 ? 1 : na, title="Buy", char='❄', location=location.belowbar, color=color.rgb(37, 119, 79), textcolor=color.white) 65 | // plotchar(showSell and adxValue > adxThreshold and not filterSell200 ? 1 : na, title="Sell", char='❄', location=location.abovebar, color=color.rgb(127, 37, 37), textcolor=color.white) 66 | 67 | plotshape(showBuy and adxValue > adxThreshold and not filterBuy200 ? 1 : na, title="Buy", text="Buy", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(37, 119, 79), textcolor=color.white) 68 | plotshape(showSell and adxValue > adxThreshold and not filterSell200 ? 1 : na, title="Sell", text="Sell", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.rgb(127, 37, 37), textcolor=color.white) 69 | 70 | -------------------------------------------------------------------------------- /MacTastic Strategy.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | strategy("MacTastic Strategy", overlay=true) 3 | 4 | /////////////////////////////////////////////////// 5 | 6 | var isLong = false 7 | var isShort = false 8 | 9 | // CONFIG 10 | rsiLengthInput = input(15, minval=1, title="RSI Length", group="RSI Settings") 11 | rsiSourceInput = input(close, "Source", group="RSI Settings") 12 | 13 | periodK = input(14, title="%K Length", minval=1, group="Stochastic") 14 | smoothK = input(1, title="%K Smoothing", minval=1, group="Stochastic") 15 | 16 | fastMA = input(title="Fast moving average", defval=12, minval=7, group="MACD") 17 | slowMA = input(title="Slow moving average", defval=26, minval=7, group="MACD") 18 | signalLength = input(9,minval=1, group="MACD") 19 | 20 | adxThreshold = input(title="ADX Threshold", defval=0, minval=0, group="ADX") 21 | adxlen = input(14, title="ADX Smoothing", group="ADX") 22 | dilen = input(14, title="DI Length", group="ADX") 23 | 24 | // ADX 25 | dirmov(len) => 26 | up = change(high) 27 | down = -change(low) 28 | plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) 29 | minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) 30 | truerange = rma(tr, len) 31 | plus = fixnan(100 * rma(plusDM, len) / truerange) 32 | minus = fixnan(100 * rma(minusDM, len) / truerange) 33 | [plus, minus] 34 | adx(dilen, adxlen) => 35 | [plus, minus] = dirmov(dilen) 36 | sum = plus + minus 37 | adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) 38 | sig = adx(dilen, adxlen) 39 | 40 | // MACD 41 | [currMacd,_,_] = macd(close[0], fastMA, slowMA, signalLength) 42 | [prevMacd,_,_] = macd(close[1], fastMA, slowMA, signalLength) 43 | signal = ema(currMacd, signalLength) 44 | 45 | // RSI 46 | up = rma(max(change(rsiSourceInput), 0), rsiLengthInput) 47 | down = rma(-min(change(rsiSourceInput), 0), rsiLengthInput) 48 | rsiM = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 49 | 50 | // STOCHASTIC - 80/20 upper/lower bands 51 | k = sma(stoch(close, high, low, periodK), smoothK) 52 | stochOS = k[1] <= 20 or k[2] <= 20 or k[3] <= 20 or k[4] <= 20 or k[5] <= 20 or k[6] <= 20 or k[7] <= 20 or k[8] <= 20 or k[9] <= 20 53 | stochOB = k[1] >= 80 or k[2] >= 80 or k[3] >= 80 or k[4] >= 80 or k[5] >= 80 or k[6] >= 80 or k[7] >= 80 or k[8] >= 80 or k[9] >= 80 54 | 55 | weGoUp = sig > adxThreshold and not isLong and rsiM >= 50 and currMacd > signal and stochOS 56 | weGoDown = sig > adxThreshold and not isShort and rsiM <= 50 and currMacd < signal and stochOB 57 | 58 | upThrust = weGoUp and not weGoUp[1] and not weGoUp[2] and not weGoUp[3] and not weGoUp[4] 59 | downThrust = weGoDown and not weGoDown[1] and not weGoDown[2] and not weGoDown[3] and not weGoDown[4] 60 | 61 | // PLOT THE THINGS 62 | plotshape(upThrust ? hl2 : na, title="MacTastic", text="MT", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(56, 182, 93), textcolor=color.white) 63 | plotshape(downThrust ? hl2 : na, title="MacTastic", text="MT", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.rgb(145, 42, 61), textcolor=color.white) 64 | 65 | if weGoUp 66 | isLong := true 67 | isShort := false 68 | 69 | if weGoDown 70 | isLong := false 71 | isShort := true 72 | 73 | ///////////////////////////////////////////////////////////////// 74 | 75 | TimeWindow=time(timeframe.period,"1400-1900", "GMT") 76 | 77 | if (weGoUp and TimeWindow) 78 | strategy.entry("Trade", strategy.long, comment="Long") 79 | if (weGoDown and TimeWindow) 80 | strategy.entry("Trade", strategy.short, comment="Short") 81 | 82 | trailSource = input(title="Trail Source", defval="Lows/Highs", options=["Lows/Highs", "Close", "Open"], confirm=true, group="Strategy") 83 | trailMethod = input(title="Trail Method", defval="ATR", options=["ATR", "Percent"], confirm=true, group="Strategy") 84 | trailPercent = input(title="Trail Percent", defval=10, minval=0.1, confirm=true, group="Strategy") 85 | swingLookback = input(title="Lookback", defval=7, confirm=true, group="Strategy") 86 | atrPeriod = input(title="ATR Period", defval=14, confirm=true, group="Strategy") 87 | atrMultiplier = input(title="ATR Multiplier", defval=1.0, confirm=true, group="Strategy") 88 | barTime = input(title="Bar Time", defval=timestamp("01 Jan 2021 13:30 +0000"), confirm=true, group="Strategy") 89 | 90 | var float trailPrice = na 91 | float next_trailPrice = na 92 | 93 | atrValue = atr(atrPeriod) * atrMultiplier 94 | float swingLow = lowest(low, swingLookback) 95 | float swingHigh = highest(high, swingLookback) 96 | 97 | 98 | if trailMethod == "ATR" 99 | if trailSource == "Close" 100 | next_trailPrice := strategy.position_size > 0 ? close - atrValue : close + atrValue 101 | else if trailSource == "Open" 102 | next_trailPrice := strategy.position_size > 0 ? open - atrValue : open + atrValue 103 | else 104 | next_trailPrice := strategy.position_size > 0 ? swingLow - atrValue : swingHigh + atrValue 105 | 106 | if trailMethod == "Percent" 107 | float percentMulti = strategy.position_size > 0 ? (100 - trailPercent) / 100 : (100 + trailPercent) / 100 108 | if trailSource == "Close" 109 | next_trailPrice := close * percentMulti 110 | else if trailSource == "Open" 111 | next_trailPrice := open * percentMulti 112 | else 113 | next_trailPrice := strategy.position_size > 0 ? swingLow * percentMulti : swingHigh * percentMulti 114 | 115 | if strategy.position_size != 0 and barstate.isconfirmed 116 | if (next_trailPrice > trailPrice or na(trailPrice)) and strategy.position_size > 0 117 | trailPrice := next_trailPrice 118 | if (next_trailPrice < trailPrice or na(trailPrice)) and strategy.position_size < 0 119 | trailPrice := next_trailPrice 120 | 121 | plot(strategy.position_size != 0 ? trailPrice : na, color=color.red, title="Trailing Stop") 122 | 123 | strategy.exit(id="Trail Exit", from_entry="Trade", limit=na, stop=trailPrice) 124 | 125 | if (strategy.position_size > 0 and close < trailPrice) or (strategy.position_size < 0 and close > trailPrice) 126 | strategy.close("Trade") 127 | 128 | -------------------------------------------------------------------------------- /MacTastic.pine: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study(title="MacTastic", shorttitle="MacTastic", overlay=true) 3 | 4 | // Idea from - https://www.youtube.com/watch?v=vI7Rpexh9X8 5 | 6 | var isLong = false 7 | var isShort = false 8 | 9 | // CONFIG 10 | rsiLengthInput = input(15, minval=1, title="RSI Length", group="RSI Settings") 11 | rsiSourceInput = input(close, "Source", group="RSI Settings") 12 | 13 | periodK = input(14, title="%K Length", minval=1, group="Stochastic") 14 | smoothK = input(1, title="%K Smoothing", minval=1, group="Stochastic") 15 | 16 | fastMA = input(title="Fast moving average", defval=12, minval=7, group="MACD") 17 | slowMA = input(title="Slow moving average", defval=26, minval=7, group="MACD") 18 | signalLength = input(9,minval=1, group="MACD") 19 | 20 | adxThreshold = input(title="ADX Threshold", defval=0, minval=0, group="ADX") 21 | adxlen = input(14, title="ADX Smoothing", group="ADX") 22 | dilen = input(14, title="DI Length", group="ADX") 23 | 24 | // ADX 25 | dirmov(len) => 26 | up = change(high) 27 | down = -change(low) 28 | plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) 29 | minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) 30 | truerange = rma(tr, len) 31 | plus = fixnan(100 * rma(plusDM, len) / truerange) 32 | minus = fixnan(100 * rma(minusDM, len) / truerange) 33 | [plus, minus] 34 | adx(dilen, adxlen) => 35 | [plus, minus] = dirmov(dilen) 36 | sum = plus + minus 37 | adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) 38 | sig = adx(dilen, adxlen) 39 | 40 | // MACD 41 | [currMacd,_,_] = macd(close[0], fastMA, slowMA, signalLength) 42 | [prevMacd,_,_] = macd(close[1], fastMA, slowMA, signalLength) 43 | signal = ema(currMacd, signalLength) 44 | 45 | // RSI 46 | up = rma(max(change(rsiSourceInput), 0), rsiLengthInput) 47 | down = rma(-min(change(rsiSourceInput), 0), rsiLengthInput) 48 | rsiM = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 49 | 50 | // STOCHASTIC - 80/20 upper/lower bands 51 | k = sma(stoch(close, high, low, periodK), smoothK) 52 | stochOS = k[1] <= 20 or k[2] <= 20 or k[3] <= 20 or k[4] <= 20 or k[5] <= 20 or k[6] <= 20 or k[7] <= 20 or k[8] <= 20 or k[9] <= 20 53 | stochOB = k[1] >= 80 or k[2] >= 80 or k[3] >= 80 or k[4] >= 80 or k[5] >= 80 or k[6] >= 80 or k[7] >= 80 or k[8] >= 80 or k[9] >= 80 54 | 55 | weGoUp = sig > adxThreshold and not isLong and rsiM >= 50 and currMacd > signal and stochOS 56 | weGoDown = sig > adxThreshold and not isShort and rsiM <= 50 and currMacd < signal and stochOB 57 | 58 | upThrust = weGoUp and not weGoUp[1] and not weGoUp[2] and not weGoUp[3] and not weGoUp[4] 59 | downThrust = weGoDown and not weGoDown[1] and not weGoDown[2] and not weGoDown[3] and not weGoDown[4] 60 | 61 | // PLOT THE THINGS 62 | plotshape(upThrust ? hl2 : na, title="MacTastic", text="MT", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(56, 182, 93), textcolor=color.white) 63 | plotshape(downThrust ? hl2 : na, title="MacTastic", text="MT", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.rgb(145, 42, 61), textcolor=color.white) 64 | 65 | if weGoUp 66 | isLong := true 67 | isShort := false 68 | 69 | if weGoDown 70 | isLong := false 71 | isShort := true 72 | 73 | // ALERTS 74 | alertcondition(upThrust, title='MacTastic BUY', message='MacTastic BUY') 75 | alertcondition(downThrust, title='MacTastic SELL', message='MacTastic SELL') 76 | 77 | -------------------------------------------------------------------------------- /MacTastic.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study(title="MacTastic", shorttitle="MacTastic", overlay=true) 3 | 4 | // Idea from - https://www.youtube.com/watch?v=vI7Rpexh9X8 5 | 6 | var isLong = false 7 | var isShort = false 8 | 9 | // CONFIG 10 | rsiLengthInput = input(15, minval=1, title="RSI Length", group="RSI Settings") 11 | rsiSourceInput = input(close, "Source", group="RSI Settings") 12 | 13 | periodK = input(14, title="%K Length", minval=1, group="Stochastic") 14 | smoothK = input(1, title="%K Smoothing", minval=1, group="Stochastic") 15 | 16 | fastMA = input(title="Fast moving average", defval=12, minval=7, group="MACD") 17 | slowMA = input(title="Slow moving average", defval=26, minval=7, group="MACD") 18 | signalLength = input(9,minval=1, group="MACD") 19 | 20 | adxThreshold = input(title="ADX Threshold", defval=0, minval=0, group="ADX") 21 | adxlen = input(14, title="ADX Smoothing", group="ADX") 22 | dilen = input(14, title="DI Length", group="ADX") 23 | 24 | // ADX 25 | dirmov(len) => 26 | up = change(high) 27 | down = -change(low) 28 | plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) 29 | minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) 30 | truerange = rma(tr, len) 31 | plus = fixnan(100 * rma(plusDM, len) / truerange) 32 | minus = fixnan(100 * rma(minusDM, len) / truerange) 33 | [plus, minus] 34 | adx(dilen, adxlen) => 35 | [plus, minus] = dirmov(dilen) 36 | sum = plus + minus 37 | adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) 38 | sig = adx(dilen, adxlen) 39 | 40 | // MACD 41 | [currMacd,_,_] = macd(close[0], fastMA, slowMA, signalLength) 42 | [prevMacd,_,_] = macd(close[1], fastMA, slowMA, signalLength) 43 | signal = ema(currMacd, signalLength) 44 | 45 | // RSI 46 | up = rma(max(change(rsiSourceInput), 0), rsiLengthInput) 47 | down = rma(-min(change(rsiSourceInput), 0), rsiLengthInput) 48 | rsiM = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 49 | 50 | // STOCHASTIC - 80/20 upper/lower bands 51 | k = sma(stoch(close, high, low, periodK), smoothK) 52 | stochOS = k[1] <= 20 or k[2] <= 20 or k[3] <= 20 or k[4] <= 20 or k[5] <= 20 or k[6] <= 20 or k[7] <= 20 or k[8] <= 20 or k[9] <= 20 53 | stochOB = k[1] >= 80 or k[2] >= 80 or k[3] >= 80 or k[4] >= 80 or k[5] >= 80 or k[6] >= 80 or k[7] >= 80 or k[8] >= 80 or k[9] >= 80 54 | 55 | weGoUp = sig > adxThreshold and not isLong and rsiM >= 50 and currMacd > signal and stochOS 56 | weGoDown = sig > adxThreshold and not isShort and rsiM <= 50 and currMacd < signal and stochOB 57 | 58 | upThrust = weGoUp and not weGoUp[1] and not weGoUp[2] and not weGoUp[3] and not weGoUp[4] 59 | downThrust = weGoDown and not weGoDown[1] and not weGoDown[2] and not weGoDown[3] and not weGoDown[4] 60 | 61 | // PLOT THE THINGS 62 | plotshape(upThrust ? hl2 : na, title="MacTastic", text="MT", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(56, 182, 93), textcolor=color.white) 63 | plotshape(downThrust ? hl2 : na, title="MacTastic", text="MT", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.rgb(145, 42, 61), textcolor=color.white) 64 | 65 | if weGoUp 66 | isLong := true 67 | isShort := false 68 | 69 | if weGoDown 70 | isLong := false 71 | isShort := true 72 | 73 | // ALERTS 74 | alertcondition(upThrust, title='MacTastic BUY', message='MacTastic BUY') 75 | alertcondition(downThrust, title='MacTastic SELL', message='MacTastic SELL') 76 | 77 | -------------------------------------------------------------------------------- /McGrawPlaybook.pine: -------------------------------------------------------------------------------- 1 | //@version=6 2 | indicator("McGraw Playbook v2", overlay=true, max_boxes_count = 500) 3 | zones = input.text_area("", "Paste McGraw text here") 4 | // vim: syntax=pine 5 | 6 | sFontSize = input.string(title="Font Size: ", options=["Tiny", "Small", "Normal", "Large"], defval="Normal", group="Options") 7 | lWidth = input.int(1, "Line Width", group="Options") 8 | iBoxTrans = input.int(50, "Box Transparency", group="Options") 9 | // bAlert = input.bool(title="Line Penetration Alerts?", defval=true, group="Options") 10 | 11 | colLong = input.color(color.rgb(0, 255, 0), "Long color", group="Colors") 12 | colShort = input.color(color.rgb(255, 0, 0), "Short color", group="Colors") 13 | 14 | myFont = sFontSize == "Tiny" ? size.tiny : sFontSize == "Small" ? size.small : sFontSize == "Normal" ? size.normal : sFontSize == "Large" ? size.large : size.auto 15 | 16 | var box[] boxes = array.new_box() 17 | 18 | if (barstate.islast) 19 | string[] _pair = str.split(zones, "\n") 20 | 21 | if (array.size(boxes) > 0) 22 | _pair.clear() 23 | 24 | for s in _pair 25 | string price = "" 26 | string desc = "" 27 | 28 | str.trim(s) 29 | desc := str.replace_all(s, "IF ", "") 30 | desc := str.replace_all(s, "THEN ", "") 31 | string[] comma = str.split(desc, " ") 32 | string IFs = array.get(comma, 1) 33 | price := array.get(comma, 2) 34 | log.info("price = " + price) 35 | 36 | // IF below 5475, THEN magnet at 5450. 37 | if str.contains(s, "IF <") 38 | box bahx = box.new(bar_index[100], str.tonumber(price), bar_index, str.tonumber(price), text_size=myFont, text= "▼▼ " + desc, text_color=color.new(colShort, 0), border_color=color.new(colShort, iBoxTrans), bgcolor=color.new(colShort, iBoxTrans), border_width=lWidth, extend=extend.both, text_halign = text.align_center) 39 | array.push(boxes, bahx) 40 | 41 | // IF above 5500, THEN quick move to 5525/35. 42 | if str.contains(s, "IF >") 43 | box bahx = box.new(bar_index[100], str.tonumber(price), bar_index, str.tonumber(price), text_size=myFont, text= "▲▲ " + desc, text_color=color.new(colLong, 0), border_color=color.new(colLong, iBoxTrans), bgcolor=color.new(colLong, iBoxTrans), border_width=lWidth, extend=extend.both, text_halign = text.align_left) 44 | array.push(boxes, bahx) 45 | 46 | -------------------------------------------------------------------------------- /Medication List 4:20:2023.txt: -------------------------------------------------------------------------------- 1 | Gabapentin Oral - 300mg daily 2 | Lexapro (Escitalopram Oral) - 10mg daily 3 | Lisinopril Oral - 2.5mg daily 4 | Prednisone Oral - 50 mg 5 consecutive days after chemo day 5 | Compazine (Prochlorperazine Oral) - 10 mg 6 | Lidocaine-Prilocaine Topical Cream 2.5 %-2.5 % 7 | Montelukast Oral - 10 mg 8 | Olanzapine Oral - 2.5 mg 9 | Ondansetron Oral Disintegrating Tablet - 8 mg 10 | Pegfilgrastim Subcutaneous (via wearable injector) - ONCE 4/20/2023 only 11 | Acetaminophen Oral 12 | 13 | IV Meds on Chemo days (6 cycles spaced 3 weeks apart, started 4/17/2023) 14 | Doxorubicin IV 15 | Vincristine IV 16 | Cyclophosphamide IV 17 | Truxima (Rituximab-abbs IV) 18 | Diphenhydramine IV (Benadryl) 19 | Fosaprepitant IV (anti-nausea) 20 | Palonosetron IV (anti-nausea) 21 | 22 | Chemo days: 23 | 4/17/2023 9am - 3pm 24 | 5/08/2023 9am - 3pm 25 | 5/29/2023 9am - 3pm 26 | 6/19/2023 9am - 3pm 27 | 7/10/2023 9am - 3pm 28 | 7/31/2023 9am - 3pm 29 | 30 | -------------------------------------------------------------------------------- /Moody MACD Fixed.txt: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="Moody MACD Fixed", shorttitle="Moody MACD Fixed") 3 | 4 | res = input.timeframe("", "Indicator TimeFrame") 5 | fast_length = input.int(title="Fast Length", defval=12) 6 | slow_length = input.int(title="Slow Length", defval=26) 7 | src = input.source(title="Source", defval=close) 8 | signal_length = input.int(title="Signal Smoothing", minval = 1, maxval = 999, defval = 9) 9 | sma_source = input.string(title="Oscillator MA Type", defval="EMA", options=["SMA", "EMA"]) 10 | sma_signal = input.string(title="Signal Line MA Type", defval="EMA", options=["SMA", "EMA"]) 11 | show_macd = input.bool(true, title="Show MACD Lines", group="Show Plots?", inline="SP10") 12 | show_macd_LW = input.int(3, minval=0, maxval=5, title = "MACD Width", group="Show Plots?", inline="SP11") 13 | show_signal_LW= input.int(2, minval=0, maxval=5, title = "Signal Width", group="Show Plots?", inline="SP11") 14 | show_Hist = input.bool(true, title="Show Histogram", group="Show Plots?", inline="SP20") 15 | show_hist_LW = input.int(5, minval=0, maxval=5, title = "-- Width", group="Show Plots?", inline="SP20") 16 | show_trend = input.bool(true, title = "Show MACD Lines w/ Trend Color", group="Show Plots?", inline="SP30") 17 | show_HB = input.bool(false, title="Show Highlight Price Bars", group="Show Plots?", inline="SP40") 18 | show_cross = input.bool(true, title = "Show BackGround on Cross", group="Show Plots?", inline="SP50") 19 | show_dots = input.bool(true, title = "Show Circle on Cross", group="Show Plots?", inline="SP60") 20 | show_dots_LW = input.int(5, minval=0, maxval=5, title = "-- Width", group="Show Plots?", inline="SP60") 21 | 22 | col_macd = input.color(#FF6D00, "MACD Line  ", group="Color Settings", inline="CS1") 23 | col_signal = input.color(#2962FF, "Signal Line  ", group="Color Settings", inline="CS1") 24 | col_trnd_Up = input.color(#4BAF4F, "Trend Up      ", group="Color Settings", inline="CS2") 25 | col_trnd_Dn = input.color(#B71D1C, "Trend Down    ", group="Color Settings", inline="CS2") 26 | col_grow_above = input.color(#26A69A, "Above   Grow", group="Histogram Colors", inline="Hist10") 27 | col_fall_above = input.color(#B2DFDB, "Fall", group="Histogram Colors", inline="Hist10") 28 | col_grow_below = input.color(#FF5252, "Below Grow", group="Histogram Colors", inline="Hist20") 29 | col_fall_below = input.color(#FFCDD2, "Fall", group="Histogram Colors", inline="Hist20") 30 | alert_Long = input.bool(true, title = "MACD Cross Up", group = "Alerts", inline="Alert10") 31 | alert_Short = input.bool(true, title = "MACD Cross Dn", group = "Alerts", inline="Alert10") 32 | alert_Long_A = input.bool(false, title = "MACD Cross Up & > 0", group = "Alerts", inline="Alert20") 33 | alert_Short_B = input.bool(false, title = "MACD Cross Dn & < 0", group = "Alerts", inline="Alert20") 34 | fast_ma = request.security(syminfo.tickerid, res, sma_source == "SMA" ? ta.sma(src, fast_length) : ta.ema(src, fast_length)) 35 | slow_ma = request.security(syminfo.tickerid, res, sma_source == "SMA" ? ta.sma(src, slow_length) : ta.ema(src, slow_length)) 36 | macd = fast_ma - slow_ma 37 | signal = request.security(syminfo.tickerid, res, sma_signal == "SMA" ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length)) 38 | hist = macd - signal 39 | trend_up = macd > signal 40 | trend_dn = macd < signal 41 | cross_UP = signal[1] >= macd[1] and signal < macd 42 | cross_DN = signal[1] <= macd[1] and signal > macd 43 | cross_UP_A = (signal[1] >= macd[1] and signal < macd) and macd > 0 44 | cross_DN_B = (signal[1] <= macd[1] and signal > macd) and macd < 0 45 | trend_col = show_trend and trend_up ? col_trnd_Up : trend_up ? col_macd : show_trend and trend_dn ? col_trnd_Dn: trend_dn ? col_macd : na 46 | 47 | var bool histA_IsUp = false 48 | var bool histA_IsDown = false 49 | var bool histB_IsDown = false 50 | var bool histB_IsUp = false 51 | histA_IsUp := hist == hist[1] ? histA_IsUp[1] : hist > hist[1] and hist > 0 52 | histA_IsDown := hist == hist[1] ? histA_IsDown[1] : hist < hist[1] and hist > 0 53 | histB_IsDown := hist == hist[1] ? histB_IsDown[1] : hist < hist[1] and hist <= 0 54 | histB_IsUp := hist == hist[1] ? histB_IsUp[1] : hist > hist[1] and hist <= 0 55 | 56 | hist_col = histA_IsUp ? col_grow_above : histA_IsDown ? col_fall_above : histB_IsDown ? col_grow_below : histB_IsUp ? col_fall_below :color.silver 57 | 58 | bgcolor(show_cross and cross_UP and macd < 0 ? col_trnd_Up : na, editable=false) 59 | bgcolor(show_cross and cross_DN and macd > 0 ? col_trnd_Dn : na, editable=false) 60 | 61 | barcolor(show_HB and trend_up ? col_trnd_Up : na, title="Trend Up", offset = 0, editable=false) 62 | barcolor(show_HB and trend_dn ? col_trnd_Dn : na, title="Trend Dn", offset = 0, editable=false) 63 | 64 | plot(show_Hist and hist ? hist : na, title="Histogram", style=plot.style_columns, color=color.new(hist_col ,0),linewidth=show_hist_LW) 65 | plot(show_macd and signal ? signal : na, title="Signal", color=color.new(col_signal, 0), style=plot.style_line ,linewidth=show_signal_LW) 66 | plot(show_macd and macd ? macd : na, title="MACD", color=color.new(trend_col, 0), style=plot.style_line ,linewidth=show_macd_LW) 67 | 68 | hline(0, title="0 Line", color=color.new(color.gray, 0), linestyle=hline.style_dashed, linewidth=1, editable=false) 69 | 70 | plot(show_dots and cross_UP ? macd : na, title="Dots", color=color.new(#00ff6e, 0), style=plot.style_circles, linewidth=show_dots_LW, editable=false) 71 | plot(show_dots and cross_DN ? macd : na, title="Dots", color=color.new(#ff2c2c, 0), style=plot.style_circles, linewidth=show_dots_LW, editable=false) 72 | 73 | -------------------------------------------------------------------------------- /Nebula.txt: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="Nebula", shorttitle="Nebula v1", overlay=true) 3 | 4 | // ========================== Bixord: FantailVMA ================================ 5 | 6 | cloudType = input.string(title="Cloud Type", options=["Relative Strength", "Money Flow", "Commodity Channel"], defval="Relative Strength", group="Basic Settings") 7 | 8 | ADX_Length = input.int(2, title="ADX_Length", group="FantailVMA") 9 | Weighting = input.float(10.0, title="Weighting", group="FantailVMA") 10 | MA_Length = input.int(6, minval=1, title="MA_Length", group="FantailVMA") 11 | 12 | float iSource = 0.0 13 | float MIN_CLOUD = 0.0 14 | float MID_CLOUD = 0.0 15 | float MAX_CLOUD = 0.0 16 | 17 | rsi = ta.rsi(close, 14) 18 | mfi = ta.mfi(hlc3, 14) 19 | maCCI = ta.sma(hlc3, 20) 20 | cci = (hlc3 - maCCI) / (0.015 * ta.dev(hlc3, 20)) 21 | 22 | if cloudType=="Relative Strength" 23 | iSource := rsi 24 | MIN_CLOUD := 20 25 | MID_CLOUD := 50 26 | MAX_CLOUD := 80 27 | 28 | if cloudType=="Money Flow" 29 | iSource := mfi 30 | MIN_CLOUD := 20 31 | MID_CLOUD := 50 32 | MAX_CLOUD := 80 33 | 34 | if cloudType=="Commodity Channel" 35 | iSource := cci 36 | MIN_CLOUD := 20 37 | MID_CLOUD := -100 38 | MAX_CLOUD := 100 39 | 40 | VMA=close 41 | VarMA=close 42 | MA=close 43 | STR = high-low 44 | sPDI = 0.0 45 | sMDI = 0.0 46 | ADX=0.0 47 | ADXR=0.0 48 | Hi = high 49 | Hi1 = high[1] 50 | Lo = low 51 | Lo1 = low[1] 52 | Close1= close[1] 53 | 54 | Bulls1 = 0.5*(math.abs(Hi-Hi1)+(Hi-Hi1)) 55 | Bears1 = 0.5*(math.abs(Lo1-Lo)+(Lo1-Lo)) 56 | Bears = Bulls1 > Bears1 ? 0 : (Bulls1 == Bears1 ? 0 : Bears1) 57 | Bulls = Bulls1 < Bears1 ? 0 : (Bulls1 == Bears1 ? 0 : Bulls1) 58 | 59 | if (bar_index > 0) 60 | sPDI := (Weighting*sPDI[1] + Bulls)/(Weighting+1) 61 | sMDI := (Weighting*sMDI[1] + Bears)/(Weighting+1) 62 | 63 | TR = math.max(Hi-Lo,Hi-Close1) 64 | if (bar_index > 0) 65 | STR := (Weighting*STR[1] + TR)/(Weighting+1) 66 | 67 | PDI = STR > 0 ? sPDI/STR : 0 68 | MDI = STR > 0 ? sMDI/STR: 0 69 | DX = (PDI + MDI) > 0 ? math.abs(PDI - MDI)/(PDI + MDI) : 0 70 | if (bar_index > 0) 71 | ADX := (Weighting*ADX[1] + DX)/(Weighting+1) 72 | vADX = ADX 73 | 74 | adxlow = ta.lowest(ADX, ADX_Length) 75 | adxmax = ta.highest(ADX, ADX_Length) 76 | ADXmin = math.min(1000000.0, adxlow) 77 | ADXmax = math.max(-1.0, adxmax) 78 | Diff = ADXmax - ADXmin 79 | Const = Diff > 0 ? (vADX- ADXmin)/Diff : 0 80 | 81 | if (bar_index > 0) 82 | VarMA:=((2-Const)*VarMA[1]+Const*close)/2 83 | 84 | FanVMA = ta.sma(VarMA,MA_Length) 85 | 86 | 87 | // ========================== McGinley Dynamic ================================ 88 | mg = 0.0 89 | mg := na(mg[1]) ? ta.ema(close, 14) : mg[1] + (close - mg[1]) / (14 * math.pow(close/mg[1], 4)) 90 | 91 | 92 | // ========================== Waddah Attar Explosion v1 by LazyBear ================================ 93 | sensitivity = input.int(150, title="Sensitivity", group="WAE") 94 | fastLength = input.int(20, title="FastEMA Length", group="WAE") 95 | slowLength = input.int(40, title="SlowEMA Length", group="WAE") 96 | channelLength = input.int(20, title="BB Channel Length", group="WAE") 97 | multWAE = input.float(2.0, title="BB Stdev Multiplier", group="WAE") 98 | 99 | calc_macd(source, fastLength, slowLength) => 100 | fastMA = ta.ema(source, fastLength) 101 | slowMA = ta.ema(source, slowLength) 102 | fastMA - slowMA 103 | 104 | calc_BBUpper(source, length, mult) => 105 | basis = ta.sma(source, length) 106 | dev = mult * ta.stdev(source, length) 107 | basis + dev 108 | 109 | calc_BBLower(source, length, mult) => 110 | basis = ta.sma(source, length) 111 | dev = mult * ta.stdev(source, length) 112 | basis - dev 113 | 114 | upper = calc_BBUpper(close, channelLength, multWAE) 115 | lower = calc_BBLower(close, channelLength, multWAE) 116 | 117 | t1 = (calc_macd(close, fastLength, slowLength) - calc_macd(close[1], fastLength, slowLength))*sensitivity 118 | e1 = (upper - lower) 119 | 120 | trendUpWAE = (t1 >= 0) ? t1 : 0 121 | trendDownWAE = (t1 < 0) ? (-1*t1) : 0 122 | 123 | waeColor = if trendUpWAE > 0 124 | color.from_gradient(math.abs(trendUpWAE - e1), 1, 50, color.new(color.rgb(0, 255, 132), 50), color.new(color.rgb(0, 255, 132), 0)) 125 | else 126 | color.from_gradient(math.abs(trendDownWAE - e1), 1, 50, color.new(color.rgb(255, 0, 0), 50), color.new(color.rgb(255, 0, 0), 0)) 127 | 128 | barcolor(waeColor) 129 | 130 | 131 | // ========================== PLOTS ================================ 132 | 133 | transparencyValue= math.abs(FanVMA - mg) 134 | bColor = if FanVMA > mg 135 | color.from_gradient(iSource, MID_CLOUD, MAX_CLOUD, color.new(color.rgb(0, 255, 132), 80), color.new(color.rgb(0, 255, 132), 50)) 136 | else 137 | color.from_gradient(iSource, MIN_CLOUD, MID_CLOUD, color.new(color.rgb(255, 0, 0), 50), color.new(color.rgb(255, 0, 0), 80)) 138 | 139 | lineMD = plot(mg, title="", color=color.new(color.blue, 100)) 140 | FVMA = plot(FanVMA, color=color.new(color.white, 100), title="Bixord FVMA") 141 | fill(FVMA, lineMD, color=bColor, title="Cloud") 142 | 143 | //plotshape(buySignal1 and FanVMA > mg ? mg : na, title="Shark", color=color.rgb(255, 255, 255), style=shape.diamond, size=size.tiny, location=location.absolute) 144 | //plotshape(buySignal1 and FanVMA < mg ? FanVMA : na, title="Shark", color=color.rgb(255, 255, 255), style=shape.diamond, size=size.tiny, location=location.absolute) 145 | 146 | //plotshape(sellSignal1 and FanVMA > mg ? FanVMA : na, title="Shark", color=color.rgb(255, 255, 255), style=shape.diamond, size=size.tiny, location=location.absolute) 147 | //plotshape(sellSignal1 and FanVMA < mg ? mg : na, title="Shark", color=color.rgb(255, 255, 255), style=shape.diamond, size=size.tiny, location=location.absolute) 148 | 149 | -------------------------------------------------------------------------------- /PayBack.pine: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="PayBack", shorttitle="PayBack v1.0", overlay=true, max_bars_back=1000, max_lines_count=500, max_labels_count=500, max_boxes_count=500) 3 | 4 | emaLength = input.int(21, "EMA Length", group="Basic Settings") 5 | useKAMA = input.bool(false, "Use KAMA instead of EMA", group="Basic Settings") 6 | prevCandles = input.int(3, "Lookback Candles", group="Basic Settings") 7 | bOnlyWicks = input.bool(true, "Only Use Wicks", group="Basic Settings") 8 | bReqPSAR = input.bool(false, "Only When PSAR Agrees", group="Basic Settings") 9 | bReqMACD = input.bool(false, "Only When MACD Agrees", group="Basic Settings") 10 | 11 | [macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9) 12 | macdUp = macdLine > signalLine 13 | macdDown = macdLine < signalLine 14 | 15 | psar = ta.sar(0.02, 0.02, 0.2) 16 | sarUp = psar < low 17 | sarDown = psar > low 18 | 19 | bool bWicked = false 20 | bool bCrossed = false 21 | 22 | bGreen = open[1] < close[1] 23 | bRed = open[1] > close[1] 24 | ema = ta.ema(close, emaLength) 25 | bWickFromAbove = (low[1] <= ema and open[1] > ema and bGreen) or (low[1] <= ema and close[1] > ema and bRed) 26 | bNextHigher = high > high[1] 27 | if (bReqMACD and macdDown) or (bReqPSAR and sarDown) 28 | bNextHigher := false 29 | bWickFromBelow = (high[1] > ema and close[1] < ema and bGreen) or (high[1] > ema and open[1] < ema and bRed) 30 | bNextLower = low < low[1] 31 | if (bReqMACD and macdUp) or (bReqPSAR and sarUp) 32 | bNextLower := false 33 | 34 | bPrevCandlesHigher = true 35 | bPrevCandlesLower = true 36 | 37 | if bOnlyWicks 38 | for i = 2 to prevCandles 39 | if open[i] < ema or close[i] < ema 40 | bPrevCandlesHigher := false 41 | if open[i] > ema or close[i] > ema 42 | bPrevCandlesLower := false 43 | else 44 | for i = 3 to prevCandles 45 | if open[i] < ema or close[i] < ema 46 | bPrevCandlesHigher := false 47 | if open[i] > ema or close[i] > ema 48 | bPrevCandlesLower := false 49 | 50 | plotchar(bWickFromAbove and bNextHigher and bPrevCandlesHigher ? 1 : na, char="👆", location=location.belowbar, color=color.lime, size=size.tiny, offset=-1) 51 | plotchar(bWickFromBelow and bNextLower and bPrevCandlesLower ? 1 : na, char="👇", location=location.abovebar, color=color.red, size=size.tiny, offset=-1) 52 | 53 | alertcondition(bWickFromAbove and bNextHigher and bPrevCandlesHigher, title="PayBack Alert", message="{{exchange}}:{{ticker}} {{interval}} wick pullback") 54 | -------------------------------------------------------------------------------- /Peleton.txt: -------------------------------------------------------------------------------- 1 | 2 | //@version=5 3 | indicator("Peloton", overlay=true) 4 | 5 | // based upon this video: https://www.youtube.com/watch?v=83QbGd1n2po 6 | // Video claims: 7 | // 76% win rate, 4.06 PF on BTC 5min candles 8 | 9 | ema21 = ta.ema(close, 21) 10 | ema50 = ta.ema(close, 50) 11 | ema144 = ta.ema(close, 144) 12 | 13 | bullishtrend = ema144 < ema50 and ema50 < ema21 ? true : false 14 | bearishtrend = ema144 > ema50 and ema50 > ema21 ? true : false 15 | 16 | EHMA(_src, _length) => ta.ema(2 * ta.ema(_src, _length / 2) - ta.ema(_src, _length), math.round(math.sqrt(_length))) 17 | 18 | // SWITCH 19 | Mode(modeSwitch, src, len) => 20 | EHMA(close, len) 21 | 22 | // OUT 23 | _hull = Mode("Ehma", close, int(34 * 2.0)) 24 | hullColor = _hull > _hull[2] ? color.green : color.red 25 | 26 | 27 | ////////////////////////////////////////////////////////////// 28 | 29 | greencolor = #2DD204 30 | redcolor = #D2042D 31 | 32 | SM02 = 'Slope' 33 | SM03 = 'Middle Crosses' 34 | SM04 = 'Levels Crosses' 35 | 36 | _stepma(float sense, float size, float stepMulti, phigh, plow, pprice)=> 37 | float trend = 0. 38 | float out = 0. 39 | float sensitivity = sense == 0 ? 0.0001 : sense 40 | float stepSize = size == 0 ? 0.0001 : size 41 | float sizea = sensitivity * stepSize 42 | 43 | float smax = phigh + 2.0 * sizea * stepMulti 44 | float smin = plow - 2.0 * sizea * stepMulti 45 | 46 | trend := nz(trend[1]) 47 | if (pprice > nz(smax[1])) 48 | trend := 1 49 | if (pprice < nz(smin[1])) 50 | trend := -1 51 | if (trend == 1) 52 | if (smin < nz(smin[1])) 53 | smin := nz(smin[1]) 54 | out := smin + sizea * stepMulti 55 | if (trend == -1) 56 | if (smax > nz(smax[1])) 57 | smax := nz(smax[1]) 58 | out := smax - sizea * stepMulti 59 | out 60 | 61 | src = input(hlc3, title="Source", group = "Basic Settings") 62 | per = input.int(55, "Period", minval=1, group = "Basic Settings") 63 | 64 | Sensitivity = input.float(4, group = "Step MA Settings") 65 | StepSize = input.float(5, group = "Step MA Settings") 66 | StepMultiplier = input.float(5, group = "Step MA Settings") 67 | 68 | lvlup = input.int(100, "Upper Level", group = "Levels Settings") 69 | lvldn = input.int(-100, "Bottom Level", group = "Levels Settings") 70 | 71 | sigtype = input.string(SM03, "Signal type", options = [SM02, SM03, SM04], group = "Signal Settings") 72 | 73 | colorbars = input.bool(true, "Color bars?", group= "UI Options") 74 | showSigs = input.bool(true, "Show signals?", group= "UI Options") 75 | 76 | cci = ta.cci(src, per) 77 | 78 | out = _stepma(Sensitivity, StepSize, StepMultiplier, cci, cci, cci) 79 | 80 | sig = out[1] 81 | mid = 0 82 | 83 | state = 0. 84 | if sigtype == SM02 85 | if (out < sig) 86 | state :=-1 87 | if (out > sig) 88 | state := 1 89 | else if sigtype == SM03 90 | if (out < mid) 91 | state :=-1 92 | if (out > mid) 93 | state := 1 94 | else if sigtype == SM04 95 | if (out < lvldn) 96 | state := -1 97 | if (out > lvlup) 98 | state := 1 99 | 100 | colorout = state == 1 ? greencolor : state == -1 ? redcolor : color.gray 101 | 102 | ////////////////////////////////////////////////////////////// 103 | 104 | txtcol=input.color(color.gray,'Text Color') 105 | [p,m,a]=ta.dmi(14,14) 106 | // plot(a,style = plot.style_area,color=color.red) 107 | m1=ta.ema(close,12) 108 | m2=ta.ema(close,50) 109 | mcolor=m1>m2?color.rgb(79, 163, 81):color.rgb(77, 23, 28) 110 | // plot(p,color=color.rgb(4, 104, 1),style = plot.style_columns,title='Buy') 111 | // plot(m,color=color.rgb(163, 2, 2),style = plot.style_columns,title='Sell') 112 | // barcolor(p>m and a>20?color.rgb(4, 104, 1):p20?color.rgb(163, 2, 2):color.rgb(247, 222, 4)) 113 | // plot(20,style = plot.style_area,color=mcolor,title='MA BAND') 114 | // plotshape(ta.crossover(p,m) and p>m?2:na,title = 'ADX up',color=color.rgb(3, 136, 8),location=location.absolute,style = shape.triangleup,size=size.tiny) 115 | // plotshape(ta.crossunder(p,m) and pm2?color.green:color.red 119 | adxdir=p>m?color.green:color.red 120 | adxstren=p>m and a>20?color.rgb(4, 104, 1):p20?color.rgb(163, 2, 2):color.rgb(247, 222, 4) 121 | candle=openm and a>20 125 | downwards = hullColor == color.red and state == -1 and p20 126 | 127 | showUp = upwards and not upwards[1] 128 | showDown = downwards and not downwards[1] 129 | 130 | plotshape(showUp ? hl2 : na, title="P", text="P", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white) 131 | plotshape(showDown ? hl2 : na, title="P", text="P", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white) 132 | 133 | -------------------------------------------------------------------------------- /Pivot Order Blocks.pine: -------------------------------------------------------------------------------- 1 | // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 2 | // © MensaTrader 3 | 4 | //@version=5 5 | indicator("Pivot Order Blocks", shorttitle="Pivot - OB", overlay=true, max_bars_back=500, max_boxes_count=250) 6 | 7 | //Titles 8 | inputGroupTitle = "=== Pivots ===" 9 | plotGroupTitle = "=== Plots ===" 10 | 11 | 12 | //Inputs 13 | source = input.string("Wicks", options=['Wicks','Bodys'], title="Source", group=inputGroupTitle) 14 | 15 | leftLenH = input.int(title="Pivot High", defval=25, minval=1, inline="Pivot High", group=inputGroupTitle) 16 | rightLenH = input.int(title="/", defval=25, minval=1, inline="Pivot High", group=inputGroupTitle) 17 | 18 | leftLenL = input.int(title="Pivot Low", defval=25, minval=1, inline="Pivot Low", group=inputGroupTitle) 19 | rightLenL = input.int(title="/", defval=25, minval=1, inline="Pivot Low", group=inputGroupTitle) 20 | 21 | bullBoxColor = input.color(color.new(#00E600,90), title="Bullish Color", group=plotGroupTitle, inline="1") 22 | bearBoxColor = input.color(color.new(#FF0000,90), title="Bearish Color", group=plotGroupTitle, inline="1") 23 | closedBoxColor = input.color(color.new(color.gray,90), title="Closed", group=plotGroupTitle, inline="1") 24 | 25 | extendBox = input.bool(true, title="Extend Boxes", group=plotGroupTitle, tooltip="Extend boxes until price hits them") 26 | boxLength = input.int(30, title="Box Size", tooltip="if Extend boxes is off, boxes will be drawn this long", group=plotGroupTitle) 27 | 28 | //Wick / Body option 29 | phOption = source == "Wicks" ? high : close 30 | plOption = source == "Wicks" ? low : close 31 | 32 | 33 | ph = ta.pivothigh(phOption,leftLenH, rightLenH) 34 | pl = ta.pivotlow(plOption,leftLenL, rightLenL) 35 | 36 | //Variables 37 | var leftBull = bar_index 38 | var rightBull = bar_index 39 | var topBull = close 40 | var bottomBull = close 41 | 42 | var leftBear = bar_index 43 | var rightBear = bar_index 44 | var topBear = close 45 | var bottomBear = close 46 | 47 | var box[] _bearBoxes = array.new_box() 48 | var box[] _bullBoxes = array.new_box() 49 | 50 | 51 | //Bear Box Calc 52 | if ph 53 | leftBear := bar_index-leftLenH 54 | rightBear := bar_index-(leftLenH-boxLength) 55 | topBear := source == "Bodys" ? (close[leftLenL]>open[leftLenL] ? close[leftLenH] : open[leftLenH]) : high[leftLenL] 56 | bottomBear := source == "Bodys" ? (close[leftLenL]>open[leftLenL] ? open[leftLenH] : close[leftLenH]) : close[leftLenL] > open[leftLenL] ? close[leftLenL] : open[leftLenL] 57 | 58 | //Bull Box Calc 59 | if pl 60 | leftBull := bar_index-leftLenL 61 | rightBull := bar_index-(leftLenL-boxLength) 62 | topBull := source == "Bodys" ? (close[leftLenL]>open[leftLenL] ? close[leftLenL] : open[leftLenL]) : close[leftLenL] > open[leftLenL] ? open[leftLenL] : close[leftLenL] 63 | bottomBull := source == "Bodys" ? (close[leftLenL]>open[leftLenL] ? open[leftLenL] : close[leftLenL]) : low[leftLenL] 64 | 65 | 66 | if pl 67 | array.push(_bullBoxes, box.new(left=leftBull, right=rightBull, top=topBull, bottom=bottomBull, bgcolor=color.new(bullBoxColor,80), border_color=bullBoxColor)) 68 | 69 | if ph 70 | array.push(_bearBoxes, box.new(left=leftBear, right=rightBear, top=topBear, bottom=bottomBear, bgcolor=color.new(bearBoxColor,80), border_color=bearBoxColor)) 71 | 72 | 73 | 74 | 75 | extend_boxes(_array, _type)=> 76 | if array.size(_array)>0 77 | for i = 0 to array.size(_array)-1 78 | _box = array.get(_array,i) 79 | _boxLow = box.get_bottom(_box) 80 | _boxHigh = box.get_top(_box) 81 | _boxLeft = box.get_left(_box) 82 | _boxRight = box.get_right(_box) 83 | 84 | if _type=="bull" and _boxRight == bar_index 85 | if low > _boxHigh 86 | box.set_right(_box,bar_index+1) 87 | else 88 | box.set_bgcolor(_box, closedBoxColor) 89 | box.set_border_color(_box, closedBoxColor) 90 | box.set_text_color(_box, closedBoxColor) 91 | box.set_right(_box,bar_index) 92 | 93 | if _type=="bear" and _boxRight == bar_index 94 | if high < _boxLow 95 | box.set_right(_box,bar_index+1) 96 | else 97 | box.set_bgcolor(_box, closedBoxColor) 98 | box.set_border_color(_box, closedBoxColor) 99 | box.set_text_color(_box, closedBoxColor) 100 | box.set_right(_box,bar_index) 101 | 102 | 103 | if extendBox 104 | extend_boxes(_bullBoxes,"bull") 105 | extend_boxes(_bearBoxes,"bear") 106 | -------------------------------------------------------------------------------- /QScalper.pine: -------------------------------------------------------------------------------- 1 | // Credit @HomelessLemon and @Violents 2 | 3 | //@version=4 4 | 5 | study("Renko Scalping Idea", shorttitle="Renko Scalping Idea", overlay=true) 6 | 7 | iRed = 0 8 | iGreen = 0 9 | 10 | c1 = color.new(#26a69a, 25) 11 | c2 = color.new(#ef5350, 25) 12 | 13 | cGreen1 = color.new(#d1fa02, 25) 14 | cGreen2 = color.new(#b0fa02, 25) 15 | cGreen3 = color.new(#82fa02, 25) 16 | cGreen4 = color.new(#17fa02, 25) 17 | 18 | cYellow = color.new(#baa100, 25) 19 | 20 | cRed1 = color.new(#fa7a02, 25) 21 | cRed2 = color.new(#fa4d02, 25) 22 | cRed3 = color.new(#fa2c02, 25) 23 | cRed4 = color.new(#fa0202, 25) 24 | 25 | count = 1 * 5 26 | maNumber = 16 27 | 28 | getMa(c)=> 29 | l = count + (1 * c) 30 | sma(close, l) 31 | 32 | sma6 = maNumber >= 6 ? getMa(5 ) : na 33 | sma7 = maNumber >= 7 ? getMa(6 ) : na 34 | sma8 = maNumber >= 8 ? getMa(7 ) : na 35 | sma9 = maNumber >= 9 ? getMa(8 ) : na 36 | sma10 = maNumber >= 10 ? getMa(9 ) : na 37 | sma11 = maNumber >= 11 ? getMa(10) : na 38 | sma12 = maNumber >= 12 ? getMa(11) : na 39 | sma13 = maNumber >= 13 ? getMa(12) : na 40 | sma14 = maNumber >= 14 ? getMa(13) : na 41 | sma15 = maNumber >= 15 ? getMa(14) : na 42 | sma16 = maNumber >= 16 ? getMa(15) : na 43 | sma17 = maNumber >= 17 ? getMa(16) : na 44 | sma18 = maNumber >= 18 ? getMa(17) : na 45 | sma19 = maNumber >= 19 ? getMa(18) : na 46 | sma20 = maNumber >= 20 ? getMa(19) : na 47 | sma21 = maNumber >= 21 ? getMa(20) : na 48 | 49 | if (sma6 <= close) 50 | iGreen := iGreen + 1 51 | else 52 | iRed := iRed + 1 53 | if (sma7 <= close) 54 | iGreen := iGreen + 1 55 | else 56 | iRed := iRed + 1 57 | if (sma8 <= close) 58 | iGreen := iGreen + 1 59 | else 60 | iRed := iRed + 1 61 | if (sma9 <= close) 62 | iGreen := iGreen + 1 63 | else 64 | iRed := iRed + 1 65 | if (sma10 <= close) 66 | iGreen := iGreen + 1 67 | else 68 | iRed := iRed + 1 69 | if (sma11 <= close) 70 | iGreen := iGreen + 1 71 | else 72 | iRed := iRed + 1 73 | if (sma12 <= close) 74 | iGreen := iGreen + 1 75 | else 76 | iRed := iRed + 1 77 | if (sma13 <= close) 78 | iGreen := iGreen + 1 79 | else 80 | iRed := iRed + 1 81 | if (sma14 <= close) 82 | iGreen := iGreen + 1 83 | else 84 | iRed := iRed + 1 85 | if (sma15 <= close) 86 | iGreen := iGreen + 1 87 | else 88 | iRed := iRed + 1 89 | if (sma16 <= close) 90 | iGreen := iGreen + 1 91 | else 92 | iRed := iRed + 1 93 | if (sma17 <= close) 94 | iGreen := iGreen + 1 95 | else 96 | iRed := iRed + 1 97 | if (sma18 <= close) 98 | iGreen := iGreen + 1 99 | else 100 | iRed := iRed + 1 101 | if (sma19 <= close) 102 | iGreen := iGreen + 1 103 | else 104 | iRed := iRed + 1 105 | if (sma20 <= close) 106 | iGreen := iGreen + 1 107 | else 108 | iRed := iRed + 1 109 | if (sma21 <= close) 110 | iGreen := iGreen + 1 111 | else 112 | iRed := iRed + 1 113 | 114 | if (iRed > 15) 115 | c1 := color.red 116 | else if (iGreen > 15) 117 | c1 := color.lime 118 | else 119 | c1 := color.yellow 120 | 121 | barcolor(c1) 122 | plot(sma6, color=c1, title="MA21", linewidth=2, style=plot.style_line) 123 | -------------------------------------------------------------------------------- /RIFT.txt: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="RSI Fisher Transform", shorttitle="RIFT", format=format.price, precision=2, timeframe="", timeframe_gaps=true) 3 | 4 | len = input.int(9, minval=1, title="Length", group="Settings") 5 | advMode = input.bool(false, title="Advanced Mode", group="Settings") 6 | 7 | up = ta.rma(math.max(ta.change(close), 0), 14) 8 | down = ta.rma(-math.min(ta.change(close), 0), 14) 9 | rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 10 | rsiMA = ta.ema(rsi, 14) 11 | 12 | high_ = ta.highest(hl2, len) 13 | low_ = ta.lowest(hl2, len) 14 | round_(val) => val > .99 ? .999 : val < -.99 ? -.999 : val 15 | value = 0.0 16 | value := round_(.66 * ((hl2 - low_) / (high_ - low_) - .5) + .67 * nz(value[1])) 17 | fish1 = 0.0 18 | fish1 := .5 * math.log((1 + value) / (1 - value)) + .5 * nz(fish1[1]) 19 | fish2 = fish1[1] 20 | 21 | hline(1.5, "1.5", color=#b33660) 22 | hline(0, "0", color=#aba6a8) 23 | hline(-1.5, "-1.5", color=#a82c55) 24 | 25 | plot(fish1, color=#269950, title="Fisher", linewidth=3) 26 | plot(advMode ? na : fish2, color=#a82b2b, title="Trigger", linewidth=3) 27 | 28 | plot((rsi / 10) - 4.9, "RSI", color=#7E57C2, linewidth=3) 29 | plot(advMode ? na : (rsiMA / 10) - 4.9, "EMA", color=color.rgb(119, 145, 190)) 30 | 31 | 32 | -------------------------------------------------------------------------------- /RSI Cloud.pine: -------------------------------------------------------------------------------- 1 | // @version=5 2 | 3 | indicator(title="TO RSI Cloud", max_bars_back = 1000, max_lines_count = 500, max_labels_count = 500) 4 | 5 | rsiLengthInput = input.int(14, minval=1, title="RSI Length", group="RSI Settings") 6 | rsiSourceInput = input.source(close, "Source", group="RSI Settings") 7 | 8 | 9 | up = ta.rma(math.max(ta.change(rsiSourceInput), 0), rsiLengthInput) 10 | down = ta.rma(-math.min(ta.change(rsiSourceInput), 0), rsiLengthInput) 11 | rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 12 | rsiPlot = plot(rsi, "RSI", color=#7E57C2) 13 | 14 | ma = ta.sma(src, 20) 15 | cci = (src - ma) / (0.015 * ta.dev(src, 20)) 16 | cciPlot = plot(cci, "CCI", color=#2962FF) 17 | 18 | ad = close==high and close==low or high==low ? 0 : ((2*close-low-high)/(high-low))*volume 19 | mf = math.sum(ad, 20) / math.sum(volume, 20) 20 | mfPlot = plot(mf, color=#43A047, title="Money Flow") 21 | // fill(rsiPlot, mfPlot, 30, 0, top_color = color.new(color.red, 100), bottom_color = color.new(color.red, 0)) 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /RabbitWatcher.pine: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="Rabbit Watcher v1.0", shorttitle="Rabbit Watcher", overlay=true, timeframe="", timeframe_gaps=true) 3 | ema = ta.ema(close, 100) 4 | mfi = ta.mfi(close, 14) 5 | colMFI = mfi >= 50 ? #00ff84 : #ff0000 6 | plot(ema, title="EMA", color=colMFI, linewidth = 2, style = plot.style_line) 7 | bgcolor(mfi > 75 ? color.new(#00ff84, 80) : mfi < 25 ? color.new(#ff0000, 80) : na) 8 | [macd, signal, hist] = ta.macd(close, 12, 26, 9) 9 | downwards = ta.crossunder(macd, signal) 10 | upwards = ta.crossover(macd, signal) 11 | showUp = upwards and not upwards[1] 12 | showDown = downwards and not downwards[1] 13 | plotshape(showUp and close > ema ? hl2 : na, title="Buy", text="Buy", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white) 14 | plotshape(showDown and close < ema ? hl2 : na, title="Sell", text="Sell", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white) 15 | 16 | -------------------------------------------------------------------------------- /Reversal System.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | 3 | // Future ideas: 4 | // Declining stairs 5 | 6 | // Version 1.1 7 | // - Added an additional volume pattern 8 | // - Adjusted RSI logic so it works better 9 | // - Added candlestick detection 10 | // - Removed Keltner (redundant with RSI) 11 | // - Added option to turn off certain patterns 12 | 13 | var cColor = color.aqua 14 | study(title="Reversal Volume Patterns", overlay=true, shorttitle="Reversal Vol Patterns") 15 | 16 | show1Input = input(true, "Show Pattern #1", group="Basic Settings", tooltip = "small red bar, larger red bar, small green bar") 17 | show2Input = input(true, "Show Pattern #2", group="Basic Settings", tooltip = "small red bar, larger red bar, even LARGER red bar, small green bar") 18 | show3Input = input(true, "Show Pattern #3", group="Basic Settings", tooltip = "4 bars of the same color, then a different color bar that's larger than all 4 previous") 19 | show4Input = input(true, "Show Pattern #4", group="Basic Settings", tooltip = "candlestick patterns") 20 | rsiFilter = input(true, title="Filter using RSI", tooltip = "Only show if RSI is leaning towards overbought or oversold", group="Basic Settings") 21 | 22 | rsiOver = input(56, title="RSI Overbought Value", group="RSI Settings", tooltip = "Higher values filter out more flags") 23 | rsiUnder = input(44, title="RSI Oversold Value", group="RSI Settings", tooltip = "Lower values filter out more flags") 24 | rsiLengthInput = input(14, minval=1, title="RSI Length", group="RSI Settings") 25 | rsiSourceInput = input(close, "Source", group="RSI Settings") 26 | 27 | is0Green = close > open 28 | is1Green = close[1] > open[1] 29 | is2Green = close[2] > open[2] 30 | is3Green = close[3] > open[3] 31 | is4Green = close[4] > open[4] 32 | // I'm lazy with the syntax later, sue me 33 | is0Red = not is0Green 34 | is1Red = not is1Green 35 | is2Red = not is2Green 36 | is3Red = not is3Green 37 | is4Red = not is4Green 38 | 39 | // Pattern #1 - small red bar, larger red bar, small green bar 40 | up1 = (volume[1] > volume[2] and volume < volume[1] and is0Green and is1Red and is2Red) 41 | down1 = (volume[1] > volume[2] and volume < volume[1] and is0Red and is1Green and is2Green) 42 | 43 | // Pattern #2 - small red bar, larger red bar, even LARGER red bar, small green bar 44 | up2 = (volume[2] > volume[3] and volume[3] > volume[4] and volume[1] < volume[2] and volume < volume[2] and is0Green and is1Red and is2Red and is3Red and is4Red) 45 | down2 = (volume[2] > volume[3] and volume[3] > volume[4] and volume[1] < volume[2] and volume < volume[2] and is0Red and is1Green and is2Green and is3Green and is4Green) 46 | 47 | // Pattern #3 - 4 bars of the same color, then a different color bar that's larger than all 4 previous 48 | up3 = (is1Red and is2Red and is3Red and is4Red and is0Green and volume > volume[1] and volume > volume[2] and volume > volume[3] and volume > volume[4]) 49 | down3 = (is1Green and is2Green and is3Green and is4Green and is0Red and volume > volume[1] and volume > volume[2] and volume > volume[3] and volume > volume[4]) 50 | 51 | // snippet from Candlestick Reversal System by LonesomeTheDove 52 | 53 | pivotlbar = 5 54 | highleftempty = pivothigh(pivotlbar, 0) 55 | lowleftempty = pivotlow(pivotlbar, 0) 56 | wick_multiplier = 10 57 | body_percentage = 1 58 | 59 | O = open 60 | C = close 61 | H = high 62 | L = low 63 | 64 | Wlongsignal = (C > O) and (O - L) >= ((C - O) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or 65 | (C < O) and (C - L) >= ((O - C) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or 66 | (C == O and C != H) and (H - L) >= ((H - C) * wick_multiplier) and (H - C) <= ((H - L) * body_percentage) or 67 | (O == H and C == H) and (H - L) >= sma((H - L), 50) 68 | 69 | Wshortsignal = (C < O) and (H - O) >= ((O - C) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or 70 | (C > O) and (H - C) >= ((C - O) * wick_multiplier) and (C - L) <= ((H -L) * body_percentage) or 71 | (C == O and C != L) and (H - L) >= ((C - L) * wick_multiplier) and (C - L) <= ((H - L) * body_percentage) or 72 | (O == L and C == L) and (H - L) >= sma((H - L), 50) 73 | 74 | // Candlestick pattern is technically Pattern #4 75 | up4 = lowleftempty and Wlongsignal 76 | down4 = highleftempty and Wshortsignal 77 | 78 | upsie1 = rma(max(change(rsiSourceInput), 0), rsiLengthInput) 79 | downsie1 = rma(-min(change(rsiSourceInput), 0), rsiLengthInput) 80 | rsi = downsie1 == 0 ? 100 : upsie1 == 0 ? 0 : 100 - (100 / (1 + upsie1 / downsie1)) 81 | 82 | KeltnerCross = false 83 | 84 | // Debugging purposes 85 | if (up1 or down1) 86 | cColor := color.fuchsia 87 | if (up2 or down2) 88 | cColor := color.purple 89 | if (up3 or down3) 90 | cColor := color.blue 91 | if (up4 or down4) 92 | cColor := color.yellow 93 | 94 | if (not show1Input) 95 | up1 := false 96 | down1 := false 97 | if (not show2Input) 98 | up2 := false 99 | down2 := false 100 | if (not show3Input) 101 | up3 := false 102 | down3 := false 103 | if (not show4Input) 104 | up4 := false 105 | down4 := false 106 | 107 | up = (up1 or up2 or up3 or up4) 108 | down = (down1 or down2 or down3 or down4) 109 | 110 | // eliminate dupes 111 | if (up[1]) 112 | up := false 113 | if (down[1]) 114 | down := false 115 | 116 | if (rsiFilter and rsi < rsiOver) 117 | down := false 118 | if (rsiFilter and rsi > rsiUnder) 119 | up := false 120 | 121 | plotshape(down, title="Buy Signal", style=shape.flag, location=location.abovebar, color=color.blue, size=size.tiny) 122 | plotshape(up, title="Buy Signal", style=shape.flag, location=location.belowbar, color=color.blue, size=size.tiny) 123 | 124 | 125 | -------------------------------------------------------------------------------- /Shark.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study(title = "Shark", shorttitle="Shark") 3 | 4 | rsiLengthInput = input(14, minval=1, title="RSI Length", group="RSI Settings") 5 | rsiSourceInput = input(close, "Source", group="RSI Settings") 6 | 7 | length2 = input(30, minval=1, group="Bollinger Bands") 8 | src = input(close, title="Source", group="Bollinger Bands") 9 | mult = input(2.0, minval=0.001, maxval=50, title="StdDev", group="Bollinger Bands") 10 | offset = input(0, "Offset", minval = -500, maxval = 500, group="Bollinger Bands") 11 | 12 | HighlightBreaches = input(true, title="Highlight Oversold/Overbought", group="Basic Settings") 13 | bApply25and75 = input(true, title="Apply 25/75 RSI rule", group="Basic Settings") 14 | 15 | ema50 = ema(close, 50) 16 | ema200 = ema(close, 200) 17 | ema400 = ema(close, 400) 18 | ema800 = ema(close, 800) 19 | wapwap = vwap(close) 20 | 21 | bTouchedLine = (ema50low) or (ema200low) or (ema400low) or (ema800low) or (wapwaplow) 22 | 23 | // RSI 24 | upTR = rma(max(change(rsiSourceInput), 0), rsiLengthInput) 25 | downTR = rma(-min(change(rsiSourceInput), 0), rsiLengthInput) 26 | rsiM = downTR == 0 ? 100 : upTR == 0 ? 0 : 100 - (100 / (1 + upTR / downTR)) 27 | 28 | plot(rsiM, color=color.new(color.purple, transp=0), linewidth=3) 29 | 30 | basis = sma(rsiM, length2) 31 | dev = mult * stdev(rsiM, length2) 32 | upper = basis + dev 33 | lower = basis - dev 34 | plot(upper, color=color.new(color.blue, transp=0), linewidth=1) 35 | plot(lower, color=color.new(color.blue, transp=0), linewidth=1) 36 | 37 | bBelow25 = rsiM < 26 38 | bAbove75 = rsiM > 74 39 | 40 | if not bApply25and75 41 | bBelow25 := true 42 | bAbove75 := true 43 | 44 | b_color = (rsiM > upper and bAbove75) ? color.new(color.red, transp=60) : (rsiM < lower and bBelow25) ? color.new(color.green, transp=60) : na 45 | 46 | if bTouchedLine and b_color == color.new(color.red, transp=60) 47 | b_color := color.new(color.orange, transp=50) 48 | 49 | if bTouchedLine and b_color == color.new(color.green, transp=60) 50 | b_color := color.new(color.lime, transp=50) 51 | 52 | bgcolor(HighlightBreaches ? b_color : na) 53 | 54 | -------------------------------------------------------------------------------- /ShockWave.pine: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="Tidal Wave", shorttitle="Tidal Wave v1", overlay=true, max_bars_back=1000, max_labels_count=500, max_lines_count=500) 3 | 4 | trendMarker = input.bool(false, "Show UpTrend markers") 5 | UseSession = input.bool(false, "Only show during NY session") 6 | tradeTimes = input.session("1630-2300", title="Trading Times") 7 | 8 | InSession(sessionTimes) => 9 | not na(time(timeframe.period, sessionTimes)) 10 | bool iss = InSession(tradeTimes) 11 | if (not UseSession) 12 | iss := true 13 | 14 | const int upTrend = 1 15 | const int downTrend = 2 16 | 17 | colorRed = color.rgb(255, 0, 0) 18 | colorGreen = color.rgb(0, 255, 132) 19 | 20 | var int waveState = na 21 | var float prevRedLow = 9999999 22 | var float prevGreenHigh = 0 23 | 24 | bool bFirstGreenCandleFound = false 25 | bool bFirstRedCandleFound = false 26 | 27 | redCandle = close < open 28 | greenCandle = close > open 29 | noOverlapRed = false 30 | noOverlapGreen = false 31 | 32 | brightGreen = false 33 | brightRed = false 34 | 35 | if (iss and greenCandle and open > close[1] and greenCandle[1]) 36 | noOverlapGreen := true 37 | waveState := upTrend 38 | 39 | if (iss and redCandle and open > close[1] and redCandle[1]) 40 | noOverlapRed := true 41 | waveState := downTrend 42 | 43 | if (iss and greenCandle) 44 | for i = 1 to 200 45 | if (brightRed[i]) // if bright red candle, stop 46 | break 47 | else if (waveState==upTrend and redCandle[i]) // if we're in a uptrend, and the candle is red, stop 48 | break 49 | else if (waveState==downTrend and open > close[i] and greenCandle[i]) 50 | noOverlapGreen := true 51 | waveState := upTrend 52 | bFirstGreenCandleFound := true 53 | break 54 | 55 | if (iss and redCandle) 56 | for i = 1 to 200 57 | if (brightGreen[i]) // if bright green candle, stop 58 | break 59 | else if (waveState==downTrend and greenCandle[i]) // if we're in a downtrend, and the candle is green, stop 60 | break 61 | else if (waveState==upTrend and open < close[i] and redCandle[i]) 62 | noOverlapRed := true 63 | waveState := downTrend 64 | bFirstRedCandleFound := true 65 | break 66 | 67 | barcolor(iss and noOverlapRed ? colorRed : iss and noOverlapGreen ? colorGreen : na) 68 | 69 | if (iss and noOverlapGreen) 70 | brightGreen := true 71 | 72 | if (iss and noOverlapRed) 73 | brightRed := true 74 | 75 | //plotshape(bFirstGreenCandleFound and brightGreen ? 1 : na, style=shape.square, location = location.belowbar, color=color.yellow) 76 | //plotshape(bFirstRedCandleFound and brightRed ? 1 : na, style=shape.square, location = location.abovebar, color=color.yellow) 77 | 78 | plotchar(trendMarker and waveState==upTrend ? 1 : na, char="^", location = location.abovebar) 79 | 80 | //swing_high = ta.highest(20) 81 | //swing_low = ta.lowest(20) 82 | //high_when_swing_high = ta.valuewhen(swing_high > swing_high[1], high, 0) 83 | //low_when_swing_high = ta.valuewhen(swing_high > swing_high[1], low, 0) 84 | //_bar_index_swing_high = ta.valuewhen(swing_high > swing_high[1], bar_index, 0) 85 | //is_swing_high_found = close < low_when_swing_high ? 1 : 0 86 | //swing_high_bar_diff = if(is_swing_high_found) 87 | //-1 * (bar_index - _bar_index_swing_high) 88 | 89 | //line.new(bar_index+swing_high_bar_diff-1, high_when_swing_high, bar_index+swing_high_bar_diff+1, high_when_swing_high, color=colorGreen, style=line.style_arrow_both) 90 | // label.new(bar_index+swing_high_bar_diff, high_when_swing_high, text="Wave", color=color.blue, textcolor=color.yellow) 91 | 92 | // Store current candle high/low 93 | 94 | //if (redCandle and not bFirstRedCandleFound and waveState == upTrend) 95 | // prevRedLow := close 96 | // bFirstRedCandleFound := true 97 | 98 | // if (redCandle and close > prevRedLow) // and waveState==downTrend) 99 | //bFirstRedCandleFound := true 100 | // prevRedLow := close 101 | 102 | //if (greenCandle and close < prevGreenHigh) 103 | // prevGreenHigh := close 104 | 105 | -------------------------------------------------------------------------------- /Squeeze Relaxer v2.2.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | // Squeeze Relaxer version 2.2 3 | 4 | study("Squeeze Relaxer", shorttitle="SqueezeRelax", overlay=true) 5 | 6 | var cGreen = 0 7 | var cRed = 0 8 | var pos = false 9 | var neg = false 10 | 11 | ignoreDots = input(false, title="Ignore dots on Squeeze Indicator", group="Relaxing Settings", tooltip="Any squeeze bar is counted, no matter if it has a white dot or not") 12 | sqTolerance = input(0, title="Squeeze Tolerance (lower = more sensitive)", group="Relaxing Settings", tooltip="How many bars to look back on the squeeze indicator") 13 | adxValue = input(23, title="ADX Threshold", group="Relaxing Settings", tooltip="Anything over 19 filters out low volume periods. Set to 11 as a default, feel free to increase to get less noise") 14 | 15 | adxlen = input(14, title="ADX Smoothing", group="ADX Settings") 16 | dilen = input(14, title="DI Length", group="ADX Settings") 17 | 18 | rsiOver = input(66, title="RSI Oversold Value", group="RSI Settings") 19 | rsiUnder = input(34, title="RSI Overbought Value", group="RSI Settings") 20 | rsiLengthInput = input(14, minval=1, title="RSI Length", group="RSI Settings") 21 | rsiSourceInput = input(close, "Source", group="RSI Settings") 22 | 23 | // ADX 24 | 25 | up1 = rma(max(change(rsiSourceInput), 0), rsiLengthInput) 26 | down1 = rma(-min(change(rsiSourceInput), 0), rsiLengthInput) 27 | rsi = down1 == 0 ? 100 : up1 == 0 ? 0 : 100 - (100 / (1 + up1 / down1)) 28 | 29 | dirmov(len) => 30 | up = change(high) 31 | down = -change(low) 32 | plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) 33 | minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) 34 | truerange = rma(tr, len) 35 | plus = fixnan(100 * rma(plusDM, len) / truerange) 36 | minus = fixnan(100 * rma(minusDM, len) / truerange) 37 | [plus, minus] 38 | adx(dilen, adxlen) => 39 | [plus, minus] = dirmov(dilen) 40 | sum = plus + minus 41 | adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) 42 | sig = adx(dilen, adxlen) 43 | sigabove19 = sig > adxValue 44 | 45 | // Squeeze Momentum 46 | 47 | length = input(20, title="BB Length", group="Squeeze Momentum Settings") 48 | multQ = input(2.0,title="BB MultFactor", group="Squeeze Momentum Settings") 49 | lengthKC=input(20, title="KC Length", group="Squeeze Momentum Settings") 50 | multKC = input(1.5, title="KC MultFactor", group="Squeeze Momentum Settings") 51 | 52 | useTrueRange = true 53 | source = close 54 | basis = sma(source, length) 55 | dev1 = multKC * stdev(source, length) 56 | upperBB = basis + dev1 57 | lowerBB = basis - dev1 58 | ma = sma(source, lengthKC) 59 | rangeQ = useTrueRange ? tr : (high - low) 60 | rangema = sma(rangeQ, lengthKC) 61 | upperKC = ma + rangema * multKC 62 | lowerKC = ma - rangema * multKC 63 | sqzOn = iff(ignoreDots, false, (lowerBB > lowerKC) and (upperBB < upperKC)) 64 | sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC) 65 | noSqz = (sqzOn == false) and (sqzOff == false) 66 | 67 | // Had to change this from the original 68 | avg1 = avg(highest(high, lengthKC), lowest(low, lengthKC)) 69 | avg2 = avg(avg1, sma(close,lengthKC)) 70 | val = linreg(close - avg2, lengthKC, 0) 71 | 72 | pos := false 73 | neg := false 74 | 75 | // if squeeze is bright RED, increment by one 76 | if (val < nz(val[1]) and val < 5 and not sqzOn) 77 | cRed := cRed + 1 78 | 79 | // if squeeze is bright GREEN, increment by one 80 | if (val > nz(val[1]) and val > 5 and not sqzOn) 81 | cGreen := cGreen + 1 82 | 83 | // if bright RED squeeze is now dim, momentum has changed. Is ADX also above 19? - add a marker to chart 84 | if (val > nz(val[1]) and cRed > sqTolerance and val < 5 and not pos[1] and sigabove19 == true) 85 | cRed := 0 86 | pos := true 87 | 88 | // if bright GREEN squeeze is now dim, momentum has changed. Is ADX also above 19? - add a marker to chart 89 | if (val < nz(val[1]) and cGreen > sqTolerance and val > 5 and not neg[1] and sigabove19 == true) 90 | cGreen := 0 91 | neg := true 92 | 93 | buySignal1 = pos 94 | sellSignal1 = neg 95 | 96 | bColor = iff(rsi < rsiUnder or rsi > rsiOver, color.red, color.yellow) 97 | 98 | plotshape(buySignal1 ? pos : na, title="Buy Signal", style=shape.diamond, location=location.belowbar, color=bColor, size=size.tiny) 99 | plotshape(sellSignal1 ? neg : na, title="Sell Signal", style=shape.diamond, location=location.abovebar, color=bColor, size=size.tiny) 100 | 101 | -------------------------------------------------------------------------------- /StarFragment.pine: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator("Star Fragment", overlay=true, max_bars_back=500, max_labels_count=500, max_lines_count=500) 3 | 4 | sessionTimes = input.session("0845-0846", title="45 minutes after NY open, plus one minute") 5 | timeZone = input.string("GMT-5", title="Time Zone", options=["GMT-10", "GMT-9", "GMT-8", "GMT-7", "GMT-6", "GMT-5", "GMT-4", "GMT-3", "GMT-2", "GMT-1", "GMT-0", "GMT+1", "GMT+2", "GMT+3", "GMT+4", "GMT+5", "GMT+6", "GMT+7", "GMT+8", "GMT+9", "GMT+10"]) 6 | 7 | [high2D, high10D, low2D, low10D] = request.security(syminfo.tickerid, "1D", [ta.highest(2), ta.highest(10), ta.lowest(2), ta.lowest(10)]) 8 | 9 | arLow = request.security(syminfo.tickerid, '15', low) 10 | arHigh = request.security(syminfo.tickerid, '15', high) 11 | 12 | timeIsAllowed = time(timeframe.period, sessionTimes) 13 | if timeIsAllowed 14 | line.new(bar_index, arHigh, bar_index + 72, arHigh, extend=extend.right, width = 2, color=color.white, style = line.style_dotted) 15 | line.new(bar_index, arLow, bar_index + 72, arLow, extend=extend.right, width = 2, color=color.white, style = line.style_dotted) 16 | line.new(bar_index, arLow + (arHigh - arLow) / 2, bar_index + 72, arLow + (arHigh - arLow) / 2, extend=extend.right, width = 2, color=color.white, style = line.style_dotted) 17 | 18 | InSession(sessionTimes) => 19 | not na(time(timeframe.period, sessionTimes)) 20 | bool iss = InSession(sessionTimes) 21 | 22 | -------------------------------------------------------------------------------- /StormCloud v1.txt: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="Storm Cloud v1", shorttitle="Storm Cloud", overlay=true) 3 | 4 | conversionPeriods = input.int(9, minval=1, title="Conversion Line Length") 5 | basePeriods = input.int(26, minval=1, title="Base Line Length") 6 | laggingSpan2Periods = input.int(52, minval=1, title="Leading Span B Length") 7 | displacement = input.int(26, minval=1, title="Lagging Span") 8 | bShowCloud = input.bool(false, title="Show Cloud") 9 | 10 | sStrategy = input.string(title="Choose Your Strategy", defval="Lines cross above/below CURRENT cloud", options=["Lines cross above/below CURRENT cloud","Lines cross above/below FUTURE cloud","Conversion crosses base ONLY","Price crosses FUTURE cloud"]) 11 | 12 | donchian(len) => math.avg(ta.lowest(len), ta.highest(len)) 13 | 14 | conversionLine = donchian(conversionPeriods) 15 | baseLine = donchian(basePeriods) 16 | leadLine1 = math.avg(conversionLine, baseLine) 17 | leadLine2 = donchian(laggingSpan2Periods) 18 | 19 | bGreenCloudCurrent = leadLine1[displacement] > leadLine2[displacement] 20 | bRedCloudCurrent = not bGreenCloudCurrent 21 | bGreenCloudFuture = leadLine1 > leadLine2 22 | bRedCloudFuture = not bGreenCloudFuture 23 | 24 | p1 = plot(bShowCloud ? leadLine1 : na, offset = displacement - 1, color=color.new(color.black, 100), title="Leading Span A") 25 | p2 = plot(bShowCloud ? leadLine2 : na, offset = displacement - 1, color=color.new(color.black, 100), title="Leading Span B") 26 | fill(p1, p2, color = leadLine1 > leadLine2 ? color.rgb(67, 160, 71, 60) : color.rgb(244, 67, 54, 60)) 27 | 28 | var upwards = false 29 | var downwards = false 30 | 31 | if sStrategy == "Lines cross above/below CURRENT cloud" 32 | upwards := bGreenCloudCurrent and conversionLine > baseLine and close > leadLine1[displacement] and close > leadLine2[displacement] 33 | downwards := bRedCloudCurrent and conversionLine < baseLine and close < leadLine1[displacement] and close < leadLine2[displacement] 34 | 35 | if sStrategy == "Lines cross above/below FUTURE cloud" 36 | upwards := bGreenCloudFuture and conversionLine > baseLine and close > leadLine1 and close > leadLine2 37 | downwards := bRedCloudFuture and conversionLine < baseLine and close < leadLine1 and close < leadLine2 38 | 39 | if sStrategy == "Price crosses FUTURE cloud" 40 | upwards := bGreenCloudFuture and close > leadLine2 and (close > leadLine1 or close < leadLine2) and (close < leadLine1 or close > leadLine2) 41 | downwards := bRedCloudFuture and close < leadLine1 and (close < leadLine1 or close > leadLine2) and (close > leadLine1 or close < leadLine2) 42 | 43 | if sStrategy == "Conversion crosses base ONLY" 44 | upwards := conversionLine > baseLine 45 | downwards := conversionLine < baseLine 46 | 47 | showUp = upwards and not upwards[1] and not upwards[2] and not upwards[3] and not upwards[4] and not upwards[5] and not upwards[6] and not upwards[7] 48 | showDown = downwards and not downwards[1] and not downwards[2] and not downwards[3] and not downwards[4] and not downwards[5] and not downwards[6] and not downwards[7] 49 | 50 | plotshape(showUp? hl2 : na, title="Cloud", text="Cloud", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(10, 118, 14), textcolor=color.white) 51 | plotshape(showDown ? hl2 : na, title="Cloud", text="Cloud", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.rgb(125, 6, 6), textcolor=color.white) 52 | -------------------------------------------------------------------------------- /Strategy Template.pine: -------------------------------------------------------------------------------- 1 | // @version=5 2 | strategy("D2 Strategy", 3 | overlay=true, 4 | initial_capital=50000, 5 | default_qty_type=strategy.percent_of_equity, 6 | default_qty_value=100, // 100% of balance invested on each trade 7 | commission_type=strategy.commission.cash_per_contract, 8 | commission_value=0.005) // Interactive Brokers rate 9 | 10 | pctProfit = input.float(0.3, "Percent Profit") * 0.01 11 | pctLoss = input.float(0.4, "Percent Loss") * 0.01 12 | 13 | // Get inputs 14 | atrLength = input.int(title="ATR Length", defval=14, minval=1) 15 | useStructure = input.bool(title="Use Structure?", defval=true) 16 | lookback = input.int(title="How Far To Look Back For High/Lows:", defval=7, minval=1) 17 | atrStopMultiplier = input.float(title="ATR x ?", defval=1.0, minval=0.1) 18 | 19 | highestHigh = ta.highest(high, lookback) 20 | lowestLow = ta.lowest(low, lookback) 21 | 22 | // Calculate data 23 | atr = ta.atr(atrLength) 24 | longStop = (useStructure ? lowestLow : close) - atr * atrStopMultiplier 25 | shortStop = (useStructure ? highestHigh : close) + atr * atrStopMultiplier 26 | 27 | ma1 = ta.ema(close, 9) 28 | ma2 = ta.ema(close, 21) 29 | ma3 = ta.ema(close, 50) 30 | ma5 = ta.ema(close, 200) 31 | 32 | t = time(timeframe.period, "0930-1600") 33 | 34 | buyCondition = ma1 > ma2 and ma2 > ma3 and close > ma3 // and na(t) and strategy.position_size == 0 35 | sellCondition = ma1 < ma2 and ma2 < ma3 and close < ma3 // and na(t) and strategy.position_size == 0 36 | 37 | if sellCondition // and ma3 > ma5 38 | strategy.entry(id="ES", direction=strategy.short) 39 | if (strategy.position_size > 0) 40 | strategy.close("EL") 41 | 42 | if buyCondition // and ma3 < ma5 43 | strategy.entry(id="EL", direction=strategy.long) 44 | if (strategy.position_size > 0) 45 | strategy.close("ES") 46 | 47 | if (strategy.position_size > 0) 48 | long_profit = strategy.position_avg_price * (1 + pctProfit) 49 | long_stop = strategy.position_avg_price * (1 - pctLoss) 50 | if close >= long_profit 51 | strategy.exit(id='PROFIT LONG 1', from_entry="EL", limit=long_profit, comment="EL Profit") 52 | if close <= long_stop 53 | strategy.exit(id="STOP LONG", from_entry="EL", stop=long_stop, comment="EL Stop") 54 | 55 | if (strategy.position_size < 0) 56 | short_profit = strategy.position_avg_price * (1 - pctProfit) 57 | short_stop = strategy.position_avg_price * (1 + pctLoss) 58 | if close <= short_profit 59 | strategy.exit(id='PROFIT SHORT 1', from_entry="ES", limit=short_profit, comment="ES Profit") 60 | if close >= short_stop 61 | strategy.exit(id="STOP SHORT", from_entry="ES", stop=short_stop, comment="ES Stop") 62 | -------------------------------------------------------------------------------- /StrategyTemplate.pine: -------------------------------------------------------------------------------- 1 | //@version=4 2 | strategy("TO Strategy", overlay=true) 3 | 4 | 5 | 6 | 7 | TimeWindow=time(timeframe.period,"1400-1900", "GMT") 8 | 9 | upwards = (ema(close, 9) > ema(close, 21) and close > ema(close, 50) and open > ema(close, 50)) 10 | downwards = (ema(close, 9) < ema(close, 21) and close < ema(close, 50) and open < ema(close, 50)) 11 | showUp = upwards and not upwards[1] 12 | showDown = downwards and not downwards[1] 13 | 14 | if (showUp and TimeWindow) 15 | strategy.entry("Trade", strategy.long, comment="Long") 16 | if (showDown and TimeWindow) 17 | strategy.entry("Trade", strategy.short, comment="Short") 18 | 19 | trailSource = input(title="Trail Source", defval="Lows/Highs", options=["Lows/Highs", "Close", "Open"], confirm=true) 20 | trailMethod = input(title="Trail Method", defval="ATR", options=["ATR", "Percent"], confirm=true) 21 | trailPercent = input(title="Trail Percent", defval=10, minval=0.1, confirm=true) 22 | swingLookback = input(title="Lookback", defval=7, confirm=true) 23 | atrPeriod = input(title="ATR Period", defval=14, confirm=true) 24 | atrMultiplier = input(title="ATR Multiplier", defval=1.0, confirm=true) 25 | barTime = input(title="Bar Time", defval=timestamp("01 Jan 2021 13:30 +0000"), confirm=true) 26 | 27 | // Declare trailing price variable (stores our trail stop value) 28 | var float trailPrice = na 29 | float next_trailPrice = na 30 | 31 | // Get required trailing stop variables 32 | atrValue = atr(atrPeriod) * atrMultiplier 33 | float swingLow = lowest(low, swingLookback) 34 | float swingHigh = highest(high, swingLookback) 35 | 36 | // Get trailing stop price 37 | if trailMethod == "ATR" // Determine ATR trailing stop price based on price source 38 | if trailSource == "Close" 39 | next_trailPrice := strategy.position_size > 0 ? close - atrValue : close + atrValue 40 | else if trailSource == "Open" 41 | next_trailPrice := strategy.position_size > 0 ? open - atrValue : open + atrValue 42 | else 43 | next_trailPrice := strategy.position_size > 0 ? swingLow - atrValue : swingHigh + atrValue 44 | 45 | if trailMethod == "Percent" 46 | float percentMulti = strategy.position_size > 0 ? (100 - trailPercent) / 100 : (100 + trailPercent) / 100 47 | if trailSource == "Close" 48 | next_trailPrice := close * percentMulti 49 | else if trailSource == "Open" 50 | next_trailPrice := open * percentMulti 51 | else 52 | next_trailPrice := strategy.position_size > 0 ? swingLow * percentMulti : swingHigh * percentMulti 53 | 54 | // Check for trailing stop update 55 | if strategy.position_size != 0 and barstate.isconfirmed 56 | // Trail long stop ONLY IF temp trailPrice is not set or is a higher price 57 | if (next_trailPrice > trailPrice or na(trailPrice)) and strategy.position_size > 0 58 | trailPrice := next_trailPrice 59 | // Trail short stop ONLY IF temp trailPrice is not set or is a lower price 60 | if (next_trailPrice < trailPrice or na(trailPrice)) and strategy.position_size < 0 61 | trailPrice := next_trailPrice 62 | 63 | // Draw data to chart 64 | plot(strategy.position_size != 0 ? trailPrice : na, color=color.red, title="Trailing Stop") 65 | 66 | // Exit trade if stop is hit 67 | // strategy.exit(id="Trail Exit", from_entry="Trade", limit=na, stop=trailPrice) 68 | 69 | if (strategy.position_size > 0 and close < trailPrice) or (strategy.position_size < 0 and close > trailPrice) 70 | strategy.close("Trade") 71 | 72 | -------------------------------------------------------------------------------- /StrategyTest.pine: -------------------------------------------------------------------------------- 1 | //@version=5 2 | strategy("BullRush Strategy", overlay=true) 3 | 4 | TimeWindow=time(timeframe.period,"1400-1900", "GMT") 5 | 6 | upwards = (ta.ema(close, 9) > ta.ema(close, 21) and close > ta.ema(close, 50) and open > ta.ema(close, 50)) 7 | downwards = (ta.ema(close, 9) < ta.ema(close, 21) and close < ta.ema(close, 50) and open < ta.ema(close, 50)) 8 | showUp = upwards and not upwards[1] 9 | showDown = downwards and not downwards[1] 10 | 11 | if (showUp and TimeWindow) 12 | strategy.entry("Trade", strategy.long, comment="Long") 13 | if (showDown and TimeWindow) 14 | strategy.entry("Trade", strategy.short, comment="Short") 15 | 16 | trailSource = input.string(title="Trail Source", defval="Lows/Highs", options=["Lows/Highs", "Close", "Open"], confirm=true) 17 | trailMethod = input.string(title="Trail Method", defval="ATR", options=["ATR", "Percent"], confirm=true) 18 | trailPercent = input.float(title="Trail Percent", defval=10, minval=0.1, confirm=true) 19 | swingLookback = input.int(title="Lookback", defval=7, confirm=true) 20 | atrPeriod = input.int(title="ATR Period", defval=14, confirm=true) 21 | atrMultiplier = input.float(title="ATR Multiplier", defval=1.0, confirm=true) 22 | barTime = input.time(title="Bar Time", defval=timestamp("01 Jan 2021 13:30 +0000"), confirm=true) 23 | 24 | // Declare trailing price variable (stores our trail stop value) 25 | var float trailPrice = na 26 | float next_trailPrice = na 27 | 28 | // Get required trailing stop variables 29 | atrValue = ta.atr(atrPeriod) * atrMultiplier 30 | float swingLow = ta.lowest(low, swingLookback) 31 | float swingHigh = ta.highest(high, swingLookback) 32 | 33 | // Get trailing stop price 34 | if trailMethod == "ATR" // Determine ATR trailing stop price based on price source 35 | next_trailPrice := switch trailSource 36 | "Close" => strategy.position_size > 0 ? close - atrValue : close + atrValue 37 | "Open" => strategy.position_size > 0 ? open - atrValue : open + atrValue 38 | => strategy.position_size > 0 ? swingLow - atrValue : swingHigh + atrValue 39 | else if trailMethod == "Percent" // Determine percentage trailing stop price based on price source 40 | float percentMulti = strategy.position_size > 0 ? (100 - trailPercent) / 100 : (100 + trailPercent) / 100 41 | next_trailPrice := switch trailSource 42 | "Close" => close * percentMulti 43 | "Open" => open * percentMulti 44 | => strategy.position_size > 0 ? swingLow * percentMulti : swingHigh * percentMulti 45 | 46 | // Check for trailing stop update 47 | if strategy.position_size != 0 and barstate.isconfirmed 48 | // Trail long stop ONLY IF temp trailPrice is not set or is a higher price 49 | if (next_trailPrice > trailPrice or na(trailPrice)) and strategy.position_size > 0 50 | trailPrice := next_trailPrice 51 | // Trail short stop ONLY IF temp trailPrice is not set or is a lower price 52 | if (next_trailPrice < trailPrice or na(trailPrice)) and strategy.position_size < 0 53 | trailPrice := next_trailPrice 54 | 55 | // Draw data to chart 56 | plot(strategy.position_size != 0 ? trailPrice : na, color=color.red, title="Trailing Stop") 57 | 58 | // Exit trade if stop is hit 59 | // strategy.exit(id="Trail Exit", from_entry="Trade", limit=na, stop=trailPrice) 60 | 61 | if (strategy.position_size > 0 and close < trailPrice) or (strategy.position_size < 0 and close > trailPrice) 62 | strategy.close("Trade") 63 | 64 | -------------------------------------------------------------------------------- /TO Method 1.52.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TraderOracle/TradingView/08b33c19614e00361b6a2fa775f6d0038a205726/TO Method 1.52.txt -------------------------------------------------------------------------------- /TO Method v1.0: -------------------------------------------------------------------------------- 1 | // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 2 | // © jdehorty 3 | // @version=5 4 | 5 | indicator(title="Dave Envelope", overlay=true, timeframe='') 6 | 7 | import jdehorty/KernelFunctions/2 as kernels 8 | 9 | getBounds(_atr, _nearFactor, _farFactor, _yhat) => 10 | _upper_far = _yhat + _farFactor*_atr 11 | _upper_near = _yhat + _nearFactor*_atr 12 | _lower_near = _yhat - _nearFactor*_atr 13 | _lower_far = _yhat - _farFactor*_atr 14 | _upper_avg = (_upper_far + _upper_near) / 2 15 | _lower_avg = (_lower_far + _lower_near) / 2 16 | [_upper_near, _upper_far, _upper_avg, _lower_near, _lower_far, _lower_avg] 17 | 18 | kernel_atr(length, _high, _low, _close) => 19 | trueRange = na(_high[1])? _high-_low : math.max(math.max(_high - _low, math.abs(_high - _close[1])), math.abs(_low - _close[1])) 20 | ta.rma(trueRange, length) 21 | 22 | h = input.int(256, 'Lookback Window', tooltip='The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars. Recommended range: 3-50', group='Kernel Settings') 23 | alpha = input.float(3.5, 'Relative Weighting', step=0.25, tooltip='Relative weighting of time frames. As this value approaches zero, the longer time frames will exert more influence on the estimation. As this value approaches infinity, the behavior of the Rational Quadratic Kernel will become identical to the Gaussian kernel. Recommended range: 0.25-25', group='Kernel Settings') 24 | x_0 = input.int(30, "Start Regression at Bar", tooltip='Bar index on which to start regression. The first bars of a chart are often highly volatile, and omission of these initial bars often leads to a better overall fit. Recommended range: 5-25', group='Kernel Settings') 25 | 26 | yhat_close = kernels.rationalQuadratic(close, h, alpha, x_0) 27 | yhat_high = kernels.rationalQuadratic(high, h, alpha, x_0) 28 | yhat_low = kernels.rationalQuadratic(low, h, alpha, x_0) 29 | yhat = yhat_close 30 | atr_length = input.int(66, 'ATR Length', minval=1, tooltip='The number of bars associated with the Average True Range (ATR).') 31 | ktr = kernel_atr(atr_length, yhat_high, yhat_low, yhat_close) 32 | nearFactor = input.float(1.95, 'Near ATR Factor', minval=0.5, step=0.25, tooltip='The factor by which to multiply the ATR to calculate the near bound of the envelope. Recommended range: 0.5-2.0') 33 | farFactor = input.float(7, 'Far ATR Factor', minval=1.0, step=0.25, tooltip='The factor by which to multiply the ATR to calculate the far bound of the envelope. Recommended range: 6.0-8.0') 34 | [upper_near, upper_far, upper_avg, lower_near, lower_far, lower_avg] = getBounds(ktr, nearFactor, farFactor, yhat_close) 35 | 36 | red_far = input.color(color.new(color.red, 60), title='Upper Boundary Color: Far', tooltip='The color of the farmost upper boundary of the envelope.', group='Color Settings') 37 | red_near = input.color(color.new(color.red, 80), title='Upper Boundary Color: Near', tooltip='The color of the nearmost upper boundary of the envelope.', group='Color Settings') 38 | yhat_green = input.color(color.new(color.green, 50), title='Bullish Estimator Color', tooltip='The Bullish color of the Nadaraya-Watson estimator.', group='Color Settings') 39 | yhat_red = input.color(color.new(color.red, 50), title='Bearish Estimator Color', tooltip='The Bearish color of the Nadaraya-Watson estimator.', group='Color Settings') 40 | green_near = input.color(color.new(color.green, 80), title='Lower Boundary Color: Near', tooltip='The color of the nearmost lower boundary of the envelope.', group='Color Settings') 41 | green_far = input.color(color.new(color.green, 60), title='Lower Boundary Color: Far', tooltip='The color of the farmost lower boundary of the envelope.', group='Color Settings') 42 | 43 | p_upper_far = plot(upper_far, color=red_far, title='Upper Boundary: Far') 44 | p_upper_avg = plot(upper_avg, color=red_near,title='Upper Boundary: Average') 45 | p_upper_near = plot(upper_near, color=red_near, title='Upper Boundary: Near') 46 | p_yhat = plot(yhat_close, color=yhat > yhat[1] ? yhat_green : yhat_red, linewidth=2, title='Nadaraya-Watson Estimation') 47 | p_lower_near = plot(lower_near, color=green_near, title='Lower Boundary: Near') 48 | p_lower_avg = plot(lower_avg, color=green_near, title='Lower Boundary: Average') 49 | p_lower_far = plot(lower_far, color=green_far, title='Lower Boundary: Far') 50 | 51 | fill(p_upper_far, p_upper_avg, color=red_far, title='Upper Boundary: Farmost Region') 52 | fill(p_upper_near, p_upper_avg, color=red_near, title='Upper Boundary: Nearmost Region') 53 | fill(p_lower_near, p_lower_avg, color=green_near, title='Lower Boundary: Nearmost Region') 54 | fill(p_lower_far, p_lower_avg, color=green_far, title='Lower Boundary: Farmost Region') -------------------------------------------------------------------------------- /TestCode.cs: -------------------------------------------------------------------------------- 1 | 2 | private decimal prevADX; 3 | private decimal pprevADX; 4 | private decimal prevSTR; 5 | private decimal prevsMDI; 6 | private decimal prevsPDI; 7 | 8 | 9 | var VMA = candle.Close; 10 | var MA = candle.Close; 11 | var STR = = candle.High - candle.Low; 12 | var Hi = candle.High; 13 | var Hi1 = p1C.High; 14 | var Lo = candle.Low; 15 | var Lo1 = p1C.Low; 16 | var Close1 = p1C.Close; 17 | 18 | var Bulls1 = 0.5 * (Math.Abs(Hi-Hi1)+(Hi-Hi1)); 19 | var Bears1 = 0.5 * (Math.Abs(Lo1-Lo)+(Lo1-Lo)); 20 | var Bears = Bulls1 > Bears1 ? 0 : (Bulls1 == Bears1 ? 0 : Bears1); 21 | var Bulls = Bulls1 < Bears1 ? 0 : (Bulls1 == Bears1 ? 0 : Bulls1); 22 | 23 | var sPDI = (10.0 * prevsPDI + Bulls) / (10.0+1); 24 | var sMDI = (10.0 * prevsMDI + Bears) / (10.0+1); 25 | 26 | var TR = Math.Max(Hi - Lo, Hi - Close1); 27 | var STR = (10.0 * prevSTR + TR) / (10.0 + 1); 28 | 29 | var PDI = STR > 0 ? sPDI/STR : 0; 30 | var MDI = STR > 0 ? sMDI/STR: 0; 31 | DX = (PDI + MDI) > 0 ? Math.Abs(PDI - MDI)/(PDI + MDI) : 0; 32 | var ADX = (10.0 * prevADX + DX) / (10.0+1); 33 | var vADX = ADX; 34 | 35 | var adxlow = pprevADX < prevADX? pprevADX : prevADX; 36 | var adxmax = pprevADX > prevADX? pprevADX : prevADX; 37 | var ADXmin = Math.Min(1000000.0, adxlow); 38 | var ADXmax = Math.Max(-1.0, adxmax); 39 | var Diff = ADXmax - ADXmin; 40 | var Const = Diff > 0 ? (vADX- ADXmin) / Diff : 0; 41 | var VarMA = ((2 - Const) * p1C.Close + Const * close) / 2; 42 | 43 | var FanVMA = sma(VarMA,6) 44 | 45 | pprevADX = prevADX; 46 | prevADX = ADX; 47 | prevSTR = STR; 48 | prevsMDI = sMDI; 49 | prevsPDI = sPDI; 50 | -------------------------------------------------------------------------------- /The Lion Strategy.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | strategy("The Lion Strategy", overlay=true) 3 | 4 | /////////////////////////////////////////////////// 5 | // Parabolic SAR 6 | psarStart = input(title="PSAR Start", type=input.float, step=0.001, defval=0.02, group="PSAR") 7 | psarIncrement = input(title="PSAR Increment", type=input.float, step=0.001, defval=0.02, group="PSAR") 8 | psarMaximum = input(title="PSAR Maximum", type=input.float, step=0.01, defval=0.2, group="PSAR") 9 | psar = sar(psarStart, psarIncrement, psarMaximum) 10 | 11 | // STOCHASTIC RSI 12 | smoothK = input(3, "K", minval=1) 13 | smoothD = input(3, "D", minval=1) 14 | lengthRSI = input(14, "RSI Length", minval=1) 15 | lengthStoch = input(14, "Stochastic Length", minval=1) 16 | srcR = input(close, title="RSI Source") 17 | rsi1 = rsi(srcR, lengthRSI) 18 | k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK) // PRIMARY LINE 19 | d = sma(k, smoothD) 20 | 21 | // 200 DEMA 22 | length = input(200, minval=1) 23 | src = input(close, title="Source") 24 | e1 = ema(src, length) 25 | e2 = ema(e1, length) 26 | dema = 2 * e1 - e2 27 | 28 | // HALFTREND 29 | var int trend = 0 30 | var int nextTrend = 0 31 | var float maxLowPrice = nz(low[1], low) 32 | var float minHighPrice = nz(high[1], high) 33 | 34 | var float up = 0.0 35 | var float down = 0.0 36 | float atrHigh = 0.0 37 | float atrLow = 0.0 38 | float arrowUp = na 39 | float arrowDown = na 40 | 41 | atr2 = atr(100) / 2 42 | dev = 2 * atr2 43 | 44 | highPrice = high[abs(highestbars(2))] 45 | lowPrice = low[abs(lowestbars(2))] 46 | highma = sma(high, 2) 47 | lowma = sma(low, 2) 48 | 49 | if nextTrend == 1 50 | maxLowPrice := max(lowPrice, maxLowPrice) 51 | 52 | if highma < maxLowPrice and close < nz(low[1], low) 53 | trend := 1 54 | nextTrend := 0 55 | minHighPrice := highPrice 56 | else 57 | minHighPrice := min(highPrice, minHighPrice) 58 | 59 | if lowma > minHighPrice and close > nz(high[1], high) 60 | trend := 0 61 | nextTrend := 1 62 | maxLowPrice := lowPrice 63 | 64 | if trend == 0 65 | if not na(trend[1]) and trend[1] != 0 66 | up := na(down[1]) ? down : down[1] 67 | arrowUp := up - atr2 68 | else 69 | up := na(up[1]) ? maxLowPrice : max(maxLowPrice, up[1]) 70 | atrHigh := up + dev 71 | atrLow := up - dev 72 | else 73 | if not na(trend[1]) and trend[1] != 1 74 | down := na(up[1]) ? up : up[1] 75 | arrowDown := down + atr2 76 | else 77 | down := na(down[1]) ? minHighPrice : min(minHighPrice, down[1]) 78 | atrHigh := down + dev 79 | atrLow := down - dev 80 | 81 | ht = trend == 0 ? up : down 82 | htColor = color.blue 83 | // htPlot = plot(ht, title="HalfTrend", linewidth=2, color=htColor) 84 | 85 | upwards = close > ht and psar < close and open < close and k > d 86 | downwards = close < ht and psar > close and open > close and k < d 87 | 88 | showUp = upwards and not upwards[1] and not upwards[2] and not upwards[3] and not upwards[4] and not upwards[5] and not upwards[6] and not upwards[7] and not upwards[8] and not upwards[9] 89 | showDown = downwards and not downwards[1] and not downwards[2] and not downwards[3] and not downwards[4] and not downwards[5] and not downwards[6] and not downwards[7] and not downwards[8] and not downwards[9] 90 | 91 | ///////////////////////////////////////////////////////////////// 92 | 93 | TimeWindow=time(timeframe.period,"1400-1900", "GMT") 94 | 95 | if (showUp and TimeWindow) 96 | strategy.entry("Trade", strategy.long, comment="Long") 97 | if (showDown and TimeWindow) 98 | strategy.entry("Trade", strategy.short, comment="Short") 99 | 100 | trailSource = input(title="Trail Source", defval="Lows/Highs", options=["Lows/Highs", "Close", "Open"], confirm=true, group="Strategy") 101 | trailMethod = input(title="Trail Method", defval="ATR", options=["ATR", "Percent"], confirm=true, group="Strategy") 102 | trailPercent = input(title="Trail Percent", defval=10, minval=0.1, confirm=true, group="Strategy") 103 | swingLookback = input(title="Lookback", defval=7, confirm=true, group="Strategy") 104 | atrPeriod = input(title="ATR Period", defval=14, confirm=true, group="Strategy") 105 | atrMultiplier = input(title="ATR Multiplier", defval=1.0, confirm=true, group="Strategy") 106 | barTime = input(title="Bar Time", defval=timestamp("01 Jan 2021 13:30 +0000"), confirm=true, group="Strategy") 107 | 108 | var float trailPrice = na 109 | float next_trailPrice = na 110 | 111 | atrValue = atr(atrPeriod) * atrMultiplier 112 | float swingLow = lowest(low, swingLookback) 113 | float swingHigh = highest(high, swingLookback) 114 | 115 | 116 | if trailMethod == "ATR" 117 | if trailSource == "Close" 118 | next_trailPrice := strategy.position_size > 0 ? close - atrValue : close + atrValue 119 | else if trailSource == "Open" 120 | next_trailPrice := strategy.position_size > 0 ? open - atrValue : open + atrValue 121 | else 122 | next_trailPrice := strategy.position_size > 0 ? swingLow - atrValue : swingHigh + atrValue 123 | 124 | if trailMethod == "Percent" 125 | float percentMulti = strategy.position_size > 0 ? (100 - trailPercent) / 100 : (100 + trailPercent) / 100 126 | if trailSource == "Close" 127 | next_trailPrice := close * percentMulti 128 | else if trailSource == "Open" 129 | next_trailPrice := open * percentMulti 130 | else 131 | next_trailPrice := strategy.position_size > 0 ? swingLow * percentMulti : swingHigh * percentMulti 132 | 133 | if strategy.position_size != 0 and barstate.isconfirmed 134 | if (next_trailPrice > trailPrice or na(trailPrice)) and strategy.position_size > 0 135 | trailPrice := next_trailPrice 136 | if (next_trailPrice < trailPrice or na(trailPrice)) and strategy.position_size < 0 137 | trailPrice := next_trailPrice 138 | 139 | plot(strategy.position_size != 0 ? trailPrice : na, color=color.red, title="Trailing Stop") 140 | 141 | strategy.exit(id="Trail Exit", from_entry="Trade", limit=na, stop=trailPrice) 142 | 143 | if (strategy.position_size > 0 and close < trailPrice) or (strategy.position_size < 0 and close > trailPrice) 144 | strategy.close("Trade") 145 | 146 | -------------------------------------------------------------------------------- /TheLion v1.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | // Halftrend copyright (c) 2021-present, Alex Orekhov (everget) 3 | // Modified by TraderOracle April 4th 2023 4 | study("TheLion v1", overlay=true) 5 | 6 | // Parabolic SAR 7 | psarStart = input(title="PSAR Start", type=input.float, step=0.001, defval=0.02, group="PSAR") 8 | psarIncrement = input(title="PSAR Increment", type=input.float, step=0.001, defval=0.02, group="PSAR") 9 | psarMaximum = input(title="PSAR Maximum", type=input.float, step=0.01, defval=0.2, group="PSAR") 10 | psar = sar(psarStart, psarIncrement, psarMaximum) 11 | 12 | // HALFTREND 13 | var int trend = 0 14 | var int nextTrend = 0 15 | var float maxLowPrice = nz(low[1], low) 16 | var float minHighPrice = nz(high[1], high) 17 | 18 | var float up = 0.0 19 | var float down = 0.0 20 | float atrHigh = 0.0 21 | float atrLow = 0.0 22 | float arrowUp = na 23 | float arrowDown = na 24 | 25 | atr2 = atr(100) / 2 26 | dev = 2 * atr2 27 | 28 | highPrice = high[abs(highestbars(2))] 29 | lowPrice = low[abs(lowestbars(2))] 30 | highma = sma(high, 2) 31 | lowma = sma(low, 2) 32 | 33 | if nextTrend == 1 34 | maxLowPrice := max(lowPrice, maxLowPrice) 35 | 36 | if highma < maxLowPrice and close < nz(low[1], low) 37 | trend := 1 38 | nextTrend := 0 39 | minHighPrice := highPrice 40 | else 41 | minHighPrice := min(highPrice, minHighPrice) 42 | 43 | if lowma > minHighPrice and close > nz(high[1], high) 44 | trend := 0 45 | nextTrend := 1 46 | maxLowPrice := lowPrice 47 | 48 | if trend == 0 49 | if not na(trend[1]) and trend[1] != 0 50 | up := na(down[1]) ? down : down[1] 51 | arrowUp := up - atr2 52 | else 53 | up := na(up[1]) ? maxLowPrice : max(maxLowPrice, up[1]) 54 | atrHigh := up + dev 55 | atrLow := up - dev 56 | else 57 | if not na(trend[1]) and trend[1] != 1 58 | down := na(up[1]) ? up : up[1] 59 | arrowDown := down + atr2 60 | else 61 | down := na(down[1]) ? minHighPrice : min(minHighPrice, down[1]) 62 | atrHigh := down + dev 63 | atrLow := down - dev 64 | 65 | ht = trend == 0 ? up : down 66 | htColor = color.blue 67 | htPlot = plot(ht, title="HalfTrend", linewidth=2, color=htColor) 68 | 69 | upwards = close > ht and psar < close and open < close 70 | downwards = close < ht and psar > close and open > close 71 | 72 | showUp = upwards and not upwards[1] and not upwards[2] and not upwards[3] and not upwards[4] and not upwards[5] and not upwards[6] and not upwards[7] and not upwards[8] and not upwards[9] 73 | showDown = downwards and not downwards[1] and not downwards[2] and not downwards[3] and not downwards[4] and not downwards[5] and not downwards[6] and not downwards[7] and not downwards[8] and not downwards[9] 74 | 75 | plotshape(showUp ? hl2 : na, title="Buy", text="Buy", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(10, 118, 14), textcolor=color.white) 76 | plotshape(showDown ? hl2 : na, title="Sell", text="Sell", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.rgb(125, 6, 6), textcolor=color.white) 77 | -------------------------------------------------------------------------------- /TheLion.pine: -------------------------------------------------------------------------------- 1 | //@version=4 2 | // Halftrend copyright (c) 2021-present, Alex Orekhov (everget) 3 | // Modified by TraderOracle April 4th 2023 4 | study("TheLion v1", overlay=true) 5 | 6 | // Parabolic SAR 7 | psarStart = input(title="PSAR Start", type=input.float, step=0.001, defval=0.02, group="PSAR") 8 | psarIncrement = input(title="PSAR Increment", type=input.float, step=0.001, defval=0.02, group="PSAR") 9 | psarMaximum = input(title="PSAR Maximum", type=input.float, step=0.01, defval=0.2, group="PSAR") 10 | psar = sar(psarStart, psarIncrement, psarMaximum) 11 | 12 | // STOCHASTIC RSI 13 | smoothK = input(3, "K", minval=1) 14 | smoothD = input(3, "D", minval=1) 15 | lengthRSI = input(14, "RSI Length", minval=1) 16 | lengthStoch = input(14, "Stochastic Length", minval=1) 17 | srcR = input(close, title="RSI Source") 18 | rsi1 = rsi(srcR, lengthRSI) 19 | k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK) // PRIMARY LINE 20 | d = sma(k, smoothD) 21 | 22 | // 200 DEMA 23 | length = input(200, minval=1) 24 | src = input(close, title="Source") 25 | e1 = ema(src, length) 26 | e2 = ema(e1, length) 27 | dema = 2 * e1 - e2 28 | 29 | // HALFTREND 30 | var int trend = 0 31 | var int nextTrend = 0 32 | var float maxLowPrice = nz(low[1], low) 33 | var float minHighPrice = nz(high[1], high) 34 | 35 | var float up = 0.0 36 | var float down = 0.0 37 | float atrHigh = 0.0 38 | float atrLow = 0.0 39 | float arrowUp = na 40 | float arrowDown = na 41 | 42 | atr2 = atr(100) / 2 43 | dev = 2 * atr2 44 | 45 | highPrice = high[abs(highestbars(2))] 46 | lowPrice = low[abs(lowestbars(2))] 47 | highma = sma(high, 2) 48 | lowma = sma(low, 2) 49 | 50 | if nextTrend == 1 51 | maxLowPrice := max(lowPrice, maxLowPrice) 52 | 53 | if highma < maxLowPrice and close < nz(low[1], low) 54 | trend := 1 55 | nextTrend := 0 56 | minHighPrice := highPrice 57 | else 58 | minHighPrice := min(highPrice, minHighPrice) 59 | 60 | if lowma > minHighPrice and close > nz(high[1], high) 61 | trend := 0 62 | nextTrend := 1 63 | maxLowPrice := lowPrice 64 | 65 | if trend == 0 66 | if not na(trend[1]) and trend[1] != 0 67 | up := na(down[1]) ? down : down[1] 68 | arrowUp := up - atr2 69 | else 70 | up := na(up[1]) ? maxLowPrice : max(maxLowPrice, up[1]) 71 | atrHigh := up + dev 72 | atrLow := up - dev 73 | else 74 | if not na(trend[1]) and trend[1] != 1 75 | down := na(up[1]) ? up : up[1] 76 | arrowDown := down + atr2 77 | else 78 | down := na(down[1]) ? minHighPrice : min(minHighPrice, down[1]) 79 | atrHigh := down + dev 80 | atrLow := down - dev 81 | 82 | ht = trend == 0 ? up : down 83 | htColor = color.blue 84 | // htPlot = plot(ht, title="HalfTrend", linewidth=2, color=htColor) 85 | 86 | upwards = close > ht and psar < close and open < close and k > d 87 | downwards = close < ht and psar > close and open > close and k < d 88 | 89 | showUp = upwards and not upwards[1] and not upwards[2] and not upwards[3] and not upwards[4] and not upwards[5] and not upwards[6] and not upwards[7] and not upwards[8] and not upwards[9] 90 | showDown = downwards and not downwards[1] and not downwards[2] and not downwards[3] and not downwards[4] and not downwards[5] and not downwards[6] and not downwards[7] and not downwards[8] and not downwards[9] 91 | 92 | plotshape(showUp? hl2 : na, title="Buy", text="Buy", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(10, 118, 14), textcolor=color.white) 93 | plotshape(showDown ? hl2 : na, title="Sell", text="Sell", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.rgb(125, 6, 6), textcolor=color.white) 94 | -------------------------------------------------------------------------------- /Tidal Wave 1.5.txt: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="Tidal Wave", shorttitle="Tidal Wave v1", overlay=true, max_bars_back=1000, max_labels_count=500, max_lines_count=500) 3 | 4 | bShowII = input.bool(false, "Show ii pattern") 5 | bShowIOI = input.bool(false, "Show iOi pattern") 6 | trendMarker = input.bool(false, "Show UpTrend markers") 7 | UseSession = input.bool(false, "Only show during NY session") 8 | tradeTimes = input.session("0830-1500", title="Trading Times") 9 | 10 | InSession(sessionTimes) => 11 | not na(time(timeframe.period, sessionTimes)) 12 | bool iss = InSession(tradeTimes) 13 | if (not UseSession) 14 | iss := true 15 | 16 | isInside() => 17 | bodyStatus = (close >= open) ? 1 : -1 18 | isInsidePattern = high < high[1] and low > low[1] 19 | isInsidePattern ? bodyStatus : 0 20 | 21 | isOutside() => 22 | bodyStatus = (close >= open) ? 1 : -1 23 | isOutsidePattern = low < low[1] and high > high[1] 24 | isOutsidePattern ? bodyStatus : 0 25 | 26 | const int upTrend = 1 27 | const int downTrend = 2 28 | 29 | colorRed = color.rgb(255, 0, 0) 30 | colorGreen = color.rgb(0, 255, 132) 31 | 32 | var int waveState = na 33 | var float prevRedLow = 9999999 34 | var float prevGreenHigh = 0 35 | 36 | bool bFirstGreenCandleFound = false 37 | bool bFirstRedCandleFound = false 38 | 39 | redCandle = close < open 40 | greenCandle = close > open 41 | noOverlapRed = false 42 | noOverlapGreen = false 43 | 44 | brightGreen = false 45 | brightRed = false 46 | 47 | if (iss and greenCandle and open > close[1] and greenCandle[1]) 48 | noOverlapGreen := true 49 | waveState := upTrend 50 | 51 | if (iss and redCandle and open > close[1] and redCandle[1]) 52 | noOverlapRed := true 53 | waveState := downTrend 54 | 55 | if (iss and greenCandle) 56 | for i = 1 to 200 57 | if (brightRed[i]) // if bright red candle, stop 58 | break 59 | else if (waveState==upTrend and redCandle[i]) // if we're in a uptrend, and the candle is red, stop 60 | break 61 | else if (waveState==downTrend and open > close[i] and greenCandle[i]) 62 | noOverlapGreen := true 63 | waveState := upTrend 64 | bFirstGreenCandleFound := true 65 | break 66 | 67 | if (iss and redCandle) 68 | for i = 1 to 200 69 | if (brightGreen[i]) // if bright green candle, stop 70 | break 71 | else if (waveState==downTrend and greenCandle[i]) // if we're in a downtrend, and the candle is green, stop 72 | break 73 | else if (waveState==upTrend and open < close[i] and redCandle[i]) 74 | noOverlapRed := true 75 | waveState := downTrend 76 | bFirstRedCandleFound := true 77 | break 78 | 79 | barcolor(iss and noOverlapRed ? colorRed : iss and noOverlapGreen ? colorGreen : na) 80 | 81 | if (iss and noOverlapGreen) 82 | brightGreen := true 83 | 84 | if (iss and noOverlapRed) 85 | brightRed := true 86 | 87 | //plotshape(bFirstGreenCandleFound and brightGreen ? 1 : na, style=shape.square, location = location.belowbar, color=color.yellow) 88 | //plotshape(bFirstRedCandleFound and brightRed ? 1 : na, style=shape.square, location = location.abovebar, color=color.yellow) 89 | 90 | plotchar(trendMarker and waveState==upTrend ? 1 : na, char="^", location = location.abovebar) 91 | 92 | InsideBar = isInside() 93 | OutsideBar = isOutside() 94 | plotchar(bShowII and InsideBar and InsideBar[1] ? 1 : na, char="⛄", location = location.abovebar, color=color.white, size=size.small) 95 | plotchar(bShowIOI and InsideBar and OutsideBar[1] and InsideBar[2] ? 1 : na, char="⌛", location = location.abovebar, color=color.white, size=size.tiny) 96 | 97 | //swing_high = ta.highest(20) 98 | //swing_low = ta.lowest(20) 99 | //high_when_swing_high = ta.valuewhen(swing_high > swing_high[1], high, 0) 100 | //low_when_swing_high = ta.valuewhen(swing_high > swing_high[1], low, 0) 101 | //_bar_index_swing_high = ta.valuewhen(swing_high > swing_high[1], bar_index, 0) 102 | //is_swing_high_found = close < low_when_swing_high ? 1 : 0 103 | //swing_high_bar_diff = if(is_swing_high_found) 104 | //-1 * (bar_index - _bar_index_swing_high) 105 | 106 | //line.new(bar_index+swing_high_bar_diff-1, high_when_swing_high, bar_index+swing_high_bar_diff+1, high_when_swing_high, color=colorGreen, style=line.style_arrow_both) 107 | // label.new(bar_index+swing_high_bar_diff, high_when_swing_high, text="Wave", color=color.blue, textcolor=color.yellow) 108 | 109 | // Store current candle high/low 110 | 111 | //if (redCandle and not bFirstRedCandleFound and waveState == upTrend) 112 | // prevRedLow := close 113 | // bFirstRedCandleFound := true 114 | 115 | // if (redCandle and close > prevRedLow) // and waveState==downTrend) 116 | //bFirstRedCandleFound := true 117 | // prevRedLow := close 118 | 119 | //if (greenCandle and close < prevGreenHigh) 120 | // prevGreenHigh := close 121 | 122 | -------------------------------------------------------------------------------- /Tidal Wave v2.txt: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="Tidal Wave", shorttitle="Tidal Wave v2.0", overlay=true, max_bars_back = 1000, max_lines_count = 500, max_labels_count = 500) 3 | 4 | // IMPORTANT: Credit to Aaron D for all ideas in this indicator 5 | // Go subscribe to him at https://www.youtube.com/@aarond98 6 | 7 | // Version 2.0: 8 | // - Added lines for gaps in price. Functions similar to Fair Value Gaps, but with lines 9 | // - Added alerts 10 | // - Added ability to modify line thickness and type 11 | 12 | //bShowBuySell = input.bool(true, "Show buy/sell signals") 13 | 14 | bbY = input.bool(false, "PLEASE USE 1 MINUTE CHART WITH THIS INDICATOR!") 15 | 16 | bTrackBar = input.bool(false, "Track bar gaps like FVG", group="Basic Settings") 17 | iBarExtend = input.int(50, "Number of bars to extend line", maxval=500, minval=10, group="Basic Settings") 18 | lWidth = input.int(3, "Line Width", group="Basic Settings") 19 | lStyle = input.string(title="Line Style", options=["Solid", "Dotted", "Dashed"], defval="Dotted", group="Basic Settings") 20 | 21 | sStyle = lStyle=="Solid" ? line.style_solid : lStyle=="Dashed" ? line.style_dashed : line.style_dotted 22 | bExtend = lWidth==500 ? extend.right : extend.none 23 | 24 | bShowII = input.bool(false, "Show ii pattern", group="Advanced") 25 | bShowIOI = input.bool(false, "Show iOi pattern", group="Advanced") 26 | trendMarker = input.bool(false, "Show UpTrend markers", group="Advanced") 27 | 28 | UseSession = input.bool(false, "Only show during NY session", group="Session") 29 | tradeTimes = input.session("0830-1500", "Trading Times", group="Session") 30 | 31 | InSession(sessionTimes) => 32 | not na(time(timeframe.period, sessionTimes)) 33 | bool iss = InSession(tradeTimes) 34 | if (not UseSession) 35 | iss := true 36 | 37 | isInside() => 38 | bodyStatus = (close >= open) ? 1 : -1 39 | isInsidePattern = high < high[1] and low > low[1] 40 | isInsidePattern ? true : false 41 | 42 | isOutside() => 43 | bodyStatus = (close >= open) ? 1 : -1 44 | isOutsidePattern = low < low[1] and high > high[1] 45 | isOutsidePattern ? true : false 46 | 47 | const int upTrend = 1 48 | const int downTrend = 2 49 | 50 | var line[] ll = array.new_line() 51 | var int waveState = na 52 | 53 | redCandle = close < open 54 | greenCandle = close > open 55 | noOverlapRed = false 56 | noOverlapGreen = false 57 | 58 | brightGreen = false 59 | brightRed = false 60 | 61 | if iss 62 | for [index, line] in ll 63 | if (high > line.get_y1(line) and low < line.get_y1(line)) 64 | line.delete(array.get(ll, index)) 65 | 66 | 67 | if (iss and greenCandle and open > close[1] and greenCandle[1]) 68 | noOverlapGreen := true 69 | waveState := upTrend 70 | 71 | if (iss and redCandle and open > close[1] and redCandle[1]) 72 | noOverlapRed := true 73 | waveState := downTrend 74 | 75 | if (iss and greenCandle) 76 | for i = 1 to 200 77 | if (brightRed[i]) // if bright red candle, stop 78 | break 79 | else if (waveState==upTrend and redCandle[i]) // if we're in a uptrend, and the candle is red, stop 80 | break 81 | else if (waveState==downTrend and open >= close[i] and greenCandle[i]) 82 | noOverlapGreen := true 83 | waveState := upTrend 84 | break 85 | 86 | if (iss and redCandle) 87 | for i = 1 to 200 88 | if (brightGreen[i]) // if bright green candle, stop 89 | break 90 | else if (waveState==downTrend and greenCandle[i]) // if we're in a downtrend, and the candle is green, stop 91 | break 92 | else if (waveState==upTrend and open <= close[i] and redCandle[i]) 93 | noOverlapRed := true 94 | waveState := downTrend 95 | break 96 | 97 | gapGreen = false 98 | gapRed = false 99 | bNewGap = false 100 | 101 | if (iss and redCandle and barstate.isconfirmed) 102 | if (redCandle[1] and open < close[1]) 103 | gapRed := true 104 | if bTrackBar 105 | array.push(ll, line.new(bar_index, open, bar_index + iBarExtend, open, color=color.new(color.red, 50), width=lWidth, style=sStyle, extend=bExtend)) 106 | bNewGap := true 107 | 108 | if (iss and greenCandle and barstate.isconfirmed) 109 | if (greenCandle[1] and open > close[1]) 110 | gapGreen := true 111 | if bTrackBar 112 | array.push(ll, line.new(bar_index, open, bar_index + iBarExtend, open, color=color.new(color.lime, 50), width=lWidth, style=sStyle, extend=bExtend)) 113 | bNewGap := true 114 | 115 | cCanColor = color.new(color.black, 100) 116 | if (iss and noOverlapGreen) or (iss and gapGreen) // and waveState == downTrend 117 | cCanColor := color.lime 118 | if (iss and noOverlapRed) or (iss and gapRed) // and waveState == upTrend 119 | cCanColor := color.red 120 | 121 | alertcondition(bNewGap, "Tidal Wave Candle Gap", "Tidal Wave Candle Gap") 122 | 123 | barcolor(cCanColor) 124 | 125 | if (iss and noOverlapGreen) 126 | brightGreen := true 127 | 128 | if (iss and noOverlapRed) 129 | brightRed := true 130 | 131 | plotchar(trendMarker and waveState==upTrend ? 1 : na, char="^", location = location.abovebar) 132 | 133 | InsideBar = isInside() 134 | OutsideBar = isOutside() 135 | plotchar(bShowII and InsideBar and InsideBar[1] ? 1 : na, char="⛄", location = location.abovebar, color=color.white, size=size.small) 136 | plotchar(bShowIOI and InsideBar and OutsideBar[1] and InsideBar[2] ? 1 : na, char="⌛", location = location.abovebar, color=color.white, size=size.tiny) 137 | -------------------------------------------------------------------------------- /Tidal Wave.pine: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="Tidal Wave", shorttitle="Tidal Wave v2.0", overlay=true, max_bars_back = 1000, max_lines_count = 500, max_labels_count = 500) 3 | 4 | // IMPORTANT: Credit to Aaron D for all ideas in this indicator 5 | // Go subscribe to him at https://www.youtube.com/@aarond98 6 | 7 | // Version 2.0: 8 | // - Added lines for gaps in price. Functions similar to Fair Value Gaps, but with lines 9 | // - Added alerts 10 | // - Added ability to modify line thickness and type 11 | 12 | //bShowBuySell = input.bool(true, "Show buy/sell signals") 13 | 14 | bbY = input.bool(false, "PLEASE USE 1 MINUTE CHART WITH THIS INDICATOR!") 15 | 16 | bTrackBar = input.bool(false, "Track bar gaps like FVG", group="Basic Settings") 17 | iBarExtend = input.int(50, "Number of bars to extend line", maxval=500, minval=10, group="Basic Settings") 18 | lWidth = input.int(3, "Line Width", group="Basic Settings") 19 | lStyle = input.string(title="Line Style", options=["Solid", "Dotted", "Dashed"], defval="Dotted", group="Basic Settings") 20 | 21 | sStyle = lStyle=="Solid" ? line.style_solid : lStyle=="Dashed" ? line.style_dashed : line.style_dotted 22 | bExtend = lWidth==500 ? extend.right : extend.none 23 | 24 | bShowII = input.bool(false, "Show ii pattern", group="Advanced") 25 | bShowIOI = input.bool(false, "Show iOi pattern", group="Advanced") 26 | trendMarker = input.bool(false, "Show UpTrend markers", group="Advanced") 27 | 28 | UseSession = input.bool(false, "Only show during NY session", group="Session") 29 | tradeTimes = input.session("0830-1500", "Trading Times", group="Session") 30 | 31 | InSession(sessionTimes) => 32 | not na(time(timeframe.period, sessionTimes)) 33 | bool iss = InSession(tradeTimes) 34 | if (not UseSession) 35 | iss := true 36 | 37 | isInside() => 38 | bodyStatus = (close >= open) ? 1 : -1 39 | isInsidePattern = high < high[1] and low > low[1] 40 | isInsidePattern ? true : false 41 | 42 | isOutside() => 43 | bodyStatus = (close >= open) ? 1 : -1 44 | isOutsidePattern = low < low[1] and high > high[1] 45 | isOutsidePattern ? true : false 46 | 47 | const int upTrend = 1 48 | const int downTrend = 2 49 | 50 | var line[] ll = array.new_line() 51 | var int waveState = na 52 | 53 | redCandle = close < open 54 | greenCandle = close > open 55 | noOverlapRed = false 56 | noOverlapGreen = false 57 | 58 | brightGreen = false 59 | brightRed = false 60 | 61 | if iss 62 | for [index, line] in ll 63 | if (high > line.get_y1(line) and low < line.get_y1(line)) 64 | line.delete(array.get(ll, index)) 65 | 66 | if (iss and greenCandle and open > close[1] and greenCandle[1]) 67 | noOverlapGreen := true 68 | waveState := upTrend 69 | 70 | if (iss and redCandle and open > close[1] and redCandle[1]) 71 | noOverlapRed := true 72 | waveState := downTrend 73 | 74 | if (iss and greenCandle) 75 | for i = 1 to 200 76 | if (brightRed[i]) // if bright red candle, stop 77 | break 78 | else if (waveState==upTrend and redCandle[i]) // if we're in a uptrend, and the candle is red, stop 79 | break 80 | else if (waveState==downTrend and open >= close[i] and greenCandle[i]) 81 | noOverlapGreen := true 82 | waveState := upTrend 83 | break 84 | 85 | if (iss and redCandle) 86 | for i = 1 to 200 87 | if (brightGreen[i]) // if bright green candle, stop 88 | break 89 | else if (waveState==downTrend and greenCandle[i]) // if we're in a downtrend, and the candle is green, stop 90 | break 91 | else if (waveState==upTrend and open <= close[i] and redCandle[i]) 92 | noOverlapRed := true 93 | waveState := downTrend 94 | break 95 | 96 | gapGreen = false 97 | gapRed = false 98 | bNewGap = false 99 | 100 | if (iss and redCandle and barstate.isconfirmed) 101 | if (redCandle[1] and open < close[1]) 102 | gapRed := true 103 | if bTrackBar 104 | array.push(ll, line.new(bar_index, open, bar_index + iBarExtend, open, color=color.new(color.red, 50), width=lWidth, style=sStyle, extend=bExtend)) 105 | bNewGap := true 106 | 107 | if (iss and greenCandle and barstate.isconfirmed) 108 | if (greenCandle[1] and open > close[1]) 109 | gapGreen := true 110 | if bTrackBar 111 | array.push(ll, line.new(bar_index, open, bar_index + iBarExtend, open, color=color.new(color.lime, 50), width=lWidth, style=sStyle, extend=bExtend)) 112 | bNewGap := true 113 | 114 | cCanColor = greenCandle ? color.new(color.green, 60) : color.new(color.red, 60) 115 | 116 | if (iss and noOverlapGreen) or (iss and gapGreen) // and waveState == downTrend 117 | cCanColor := color.rgb(0, 255, 132) 118 | if (iss and noOverlapRed) or (iss and gapRed) // and waveState == upTrend 119 | cCanColor := color.rgb(255, 0, 0) 120 | 121 | alertcondition(bNewGap, "Tidal Wave Candle Gap", "Tidal Wave Candle Gap") 122 | 123 | barcolor(cCanColor) 124 | 125 | if (iss and noOverlapGreen) 126 | brightGreen := true 127 | 128 | if (iss and noOverlapRed) 129 | brightRed := true 130 | 131 | plotchar(trendMarker and waveState==upTrend ? 1 : na, char="^", location = location.abovebar) 132 | 133 | InsideBar = isInside() 134 | OutsideBar = isOutside() 135 | plotchar(bShowII and InsideBar and InsideBar[1] ? 1 : na, char="⛄", location = location.abovebar, title="Snowman", color=color.white, size=size.small) 136 | plotchar(bShowIOI and InsideBar and OutsideBar[1] and InsideBar[2] ? 1 : na, char="⌛", title="Hourglass", location = location.abovebar, color=color.white, size=size.tiny) 137 | -------------------------------------------------------------------------------- /Tidal Wave.txt: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="Tidal Wave", shorttitle="Tidal Wave v1.1", overlay=true, max_bars_back=1000, max_labels_count=500, max_lines_count=500) 3 | 4 | bShowII = input.bool(false, "Show ii pattern") 5 | bShowIOI = input.bool(false, "Show iOi pattern") 6 | trendMarker = input.bool(false, "Show UpTrend markers") 7 | UseSession = input.bool(false, "Only show during NY session") 8 | tradeTimes = input.session("0830-1500", title="Trading Times") 9 | 10 | InSession(sessionTimes) => 11 | not na(time(timeframe.period, sessionTimes)) 12 | bool iss = InSession(tradeTimes) 13 | if (not UseSession) 14 | iss := true 15 | 16 | isInside() => 17 | bodyStatus = (close >= open) ? 1 : -1 18 | isInsidePattern = high < high[1] and low > low[1] 19 | isInsidePattern ? bodyStatus : 0 20 | 21 | isOutside() => 22 | bodyStatus = (close >= open) ? 1 : -1 23 | isOutsidePattern = low < low[1] and high > high[1] 24 | isOutsidePattern ? bodyStatus : 0 25 | 26 | const int upTrend = 1 27 | const int downTrend = 2 28 | 29 | var int waveState = na 30 | 31 | redCandle = close < open 32 | greenCandle = close > open 33 | noOverlapRed = false 34 | noOverlapGreen = false 35 | 36 | brightGreen = false 37 | brightRed = false 38 | 39 | if (iss and greenCandle and open > close[1] and greenCandle[1]) 40 | noOverlapGreen := true 41 | waveState := upTrend 42 | 43 | if (iss and redCandle and open > close[1] and redCandle[1]) 44 | noOverlapRed := true 45 | waveState := downTrend 46 | 47 | if (iss and greenCandle) 48 | for i = 1 to 200 49 | if (brightRed[i]) // if bright red candle, stop 50 | break 51 | else if (waveState==upTrend and redCandle[i]) // if we're in a uptrend, and the candle is red, stop 52 | break 53 | else if (waveState==downTrend and open > close[i] and greenCandle[i]) 54 | noOverlapGreen := true 55 | waveState := upTrend 56 | break 57 | 58 | if (iss and redCandle) 59 | for i = 1 to 200 60 | if (brightGreen[i]) // if bright green candle, stop 61 | break 62 | else if (waveState==downTrend and greenCandle[i]) // if we're in a downtrend, and the candle is green, stop 63 | break 64 | else if (waveState==upTrend and open < close[i] and redCandle[i]) 65 | noOverlapRed := true 66 | waveState := downTrend 67 | break 68 | 69 | gapGreen = false 70 | gapRed = false 71 | 72 | if (iss and redCandle) 73 | if (redCandle[1] and open < close[1]) 74 | gapRed := true 75 | 76 | if (iss and greenCandle) 77 | if (greenCandle[1] and open > close[1]) 78 | gapGreen := true 79 | 80 | barcolor(iss and gapRed ? color.rgb(236, 154, 30) : na, title="Intense Red") 81 | barcolor(iss and gapGreen ? color.rgb(86, 241, 255) : na, title="Intense Green") // color.rgb(134, 227, 255) 82 | barcolor(iss and noOverlapRed ? color.rgb(255, 0, 0) : iss and noOverlapGreen ? color.rgb(0, 255, 132) : na) 83 | 84 | if (iss and noOverlapGreen) 85 | brightGreen := true 86 | 87 | if (iss and noOverlapRed) 88 | brightRed := true 89 | 90 | //plotshape(bFirstGreenCandleFound and brightGreen ? 1 : na, style=shape.square, location = location.belowbar, color=color.yellow) 91 | //plotshape(bFirstRedCandleFound and brightRed ? 1 : na, style=shape.square, location = location.abovebar, color=color.yellow) 92 | 93 | plotchar(trendMarker and waveState==upTrend ? 1 : na, char="^", location = location.abovebar) 94 | 95 | InsideBar = isInside() 96 | OutsideBar = isOutside() 97 | plotchar(bShowII and InsideBar and InsideBar[1] ? 1 : na, char="⛄", location = location.abovebar, color=color.white, size=size.small) 98 | plotchar(bShowIOI and InsideBar and OutsideBar[1] and InsideBar[2] ? 1 : na, char="⌛", location = location.abovebar, color=color.white, size=size.tiny) 99 | 100 | //swing_high = ta.highest(20) 101 | //swing_low = ta.lowest(20) 102 | //high_when_swing_high = ta.valuewhen(swing_high > swing_high[1], high, 0) 103 | //low_when_swing_high = ta.valuewhen(swing_high > swing_high[1], low, 0) 104 | //_bar_index_swing_high = ta.valuewhen(swing_high > swing_high[1], bar_index, 0) 105 | //is_swing_high_found = close < low_when_swing_high ? 1 : 0 106 | //swing_high_bar_diff = if(is_swing_high_found) 107 | //-1 * (bar_index - _bar_index_swing_high) 108 | 109 | //line.new(bar_index+swing_high_bar_diff-1, high_when_swing_high, bar_index+swing_high_bar_diff+1, high_when_swing_high, color=colorGreen, style=line.style_arrow_both) 110 | // label.new(bar_index+swing_high_bar_diff, high_when_swing_high, text="Wave", color=color.blue, textcolor=color.yellow) 111 | 112 | // Store current candle high/low 113 | 114 | //if (redCandle and not bFirstRedCandleFound and waveState == upTrend) 115 | // prevRedLow := close 116 | // bFirstRedCandleFound := true 117 | 118 | // if (redCandle and close > prevRedLow) // and waveState==downTrend) 119 | //bFirstRedCandleFound := true 120 | // prevRedLow := close 121 | 122 | //if (greenCandle and close < prevGreenHigh) 123 | // prevGreenHigh := close 124 | 125 | -------------------------------------------------------------------------------- /Total Recall.txt: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator("Total Recall", overlay=true) 3 | 4 | var float upOpen = na 5 | var float upClose = na 6 | var float downOpen = na 7 | var float downClose = na 8 | 9 | bGreenSignal = false 10 | bRedSignal = false 11 | 12 | int lookHead = input.int(3, 'Look ahead candles', group='Basic Settings') 13 | bool bUseBB = input.bool(true, 'Use Bollinger Bands wicking', group='Basic Settings') 14 | bool bShowVector = input.bool(true, 'Show Volume Based Candles', group='Basic Settings') 15 | 16 | // Determine wick size (that's what SHE said) 17 | upWickPercentLarger = close > open and math.abs(high - close) > math.abs(low - open) // math.abs(open - close) 18 | downWickPercentLarger = close < open and math.abs(low - close) > math.abs(open - high) // math.abs(open - close) 19 | 20 | // Standard Bollinger Bands calculation 21 | wlengthBB = input.int(20, minval=1, group="Wicking Bollinger Bands") 22 | wsrcBB = input(close, title="Source", group="Wicking Bollinger Bands") 23 | wmultBB = input.float(2.5, minval=0.001, maxval=50, title="StdDev", group="Wicking Bollinger Bands") 24 | woffsetBB = input.int(0, "Offset", minval = -500, maxval = 500, group="Wicking Bollinger Bands") 25 | wbasisBB = ta.sma(wsrcBB, wlengthBB) 26 | wdevBB = wmultBB * ta.stdev(wsrcBB, wlengthBB) 27 | wupperBB = wbasisBB + wdevBB 28 | wlowerBB = wbasisBB - wdevBB 29 | 30 | // Is this candle wicking the edge of our Bollinger Bands? 31 | bbUp = low <= wlowerBB and close >= wlowerBB and close < open and bUseBB 32 | bbDown = high >= wupperBB and close < wupperBB and close > open and bUseBB 33 | 34 | 35 | // Originally from the Trader's Reality indicator - I isolated out vector candle code 36 | import TradersReality/Traders_Reality_Lib/2 as trLib 37 | 38 | pvsraVolume(overrideSymbolX, pvsraSymbolX, tickerIdX) => 39 | request.security(overrideSymbolX ? pvsraSymbolX : tickerIdX, '', [volume,high,low,close,open], barmerge.gaps_off, barmerge.lookahead_off) 40 | [pvsraVolume, pvsraHigh, pvsraLow, pvsraClose, pvsraOpen] = pvsraVolume(false, "", syminfo.tickerid) 41 | [pvsraColor, alertFlag, averageVolume, volumeSpread, highestVolumeSpread] = trLib.calcPvsra(pvsraVolume, pvsraHigh, pvsraLow, pvsraClose, pvsraOpen, color.red, color.lime, color.fuchsia, color.blue, color.new(color.black, 90), color.new(color.black, 90)) 42 | barcolor(bShowVector ? pvsraColor : na) 43 | 44 | bVectorGreen = pvsraColor == color.lime 45 | bVectorRed = pvsraColor == color.red 46 | 47 | // This section is from LuxAlgo - Market Structure (Fractal) 48 | length = 5 // default, min 3 49 | 50 | type fractal 51 | float value 52 | int loc 53 | bool iscrossed 54 | 55 | var p = int(length / 2) 56 | n = bar_index 57 | dh = math.sum(math.sign(high - high[1]), p) 58 | dl = math.sum(math.sign(low - low[1]), p) 59 | bullf = dh == -p and dh[p] == p and high[p] == ta.highest(length) 60 | bearf = dl == p and dl[p] == -p and low[p] == ta.lowest(length) 61 | bullf_count = ta.cum(bullf ? 1 : 0) 62 | bearf_count = ta.cum(bearf ? 1 : 0) 63 | 64 | 65 | // CHoCH upwards 66 | var upper = fractal.new() 67 | var line lower_lvl = na 68 | var label ms_lbl = na 69 | var bull_ms_count = 0 70 | var broken_sup = false 71 | var os = 0 72 | 73 | if bullf 74 | upper.value := high[p] 75 | upper.loc := n-p 76 | upper.iscrossed := false 77 | 78 | if ta.crossover(close, upper.value) and not upper.iscrossed 79 | upOpen := open 80 | upClose := close 81 | //line.new(upper.loc, upper.value, n, upper.value, color = color.lime) 82 | else if not broken_sup 83 | lower_lvl.set_x2(n) 84 | if close < lower_lvl.get_y2() 85 | broken_sup := true 86 | 87 | 88 | // CHoCH downwards 89 | var lower = fractal.new() 90 | var line upper_lvl = na 91 | var broken_res = false 92 | var bear_ms_count = 0 93 | 94 | if bearf 95 | lower.value := low[p] 96 | lower.loc := n-p 97 | lower.iscrossed := false 98 | 99 | if ta.crossunder(close, lower.value) and not lower.iscrossed 100 | downOpen := open 101 | downClose := close 102 | //line.new(lower.loc, lower.value, n, lower.value, color = color.red) 103 | else if not broken_res 104 | upper_lvl.set_x2(n) 105 | if close > upper_lvl.get_y2() 106 | broken_res := true 107 | 108 | bFinalColor = color.yellow 109 | if ((bbDown or bbUp) and bUseBB) 110 | bFinalColor := color.rgb(255, 0, 0) 111 | 112 | // Check if current candle is a proper wick or Bollinger Bands 113 | if (bVectorGreen and (close[0] == upClose[0] or close[1] == upClose[1] or close[2] == upClose[2] or close[3] == upClose[3])) 114 | bGreenSignal := true 115 | plotshape(bGreenSignal and barstate.isconfirmed ? 1 : na, title="Reversal Approaching", style=shape.cross, location=location.abovebar, color=bFinalColor, size=size.tiny) 116 | 117 | if (bVectorRed and (close[0] == downClose[0] or close[1] == downClose[1] or close[2] == downClose[2] or close[3] == downClose[3])) 118 | bRedSignal := true 119 | plotshape(bRedSignal and barstate.isconfirmed ? 1 : na, title="Reversal Approaching", style=shape.cross, location=location.belowbar, color=bFinalColor, size=size.tiny) 120 | -------------------------------------------------------------------------------- /TradePro 78 Win.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study(title = "TradePro 78 Strat", overlay = true, format=format.price, precision=2) 3 | 4 | // This indicator inspired by TradePro's video here: https://www.youtube.com/watch?v=cKuTSFwUpPE 5 | // Which reports a 78% win rate, so I wanted to convert into a single indicator and test it! 6 | // Written by TraderOracle 7 | 8 | // Bollinger Bands %B 9 | length = input(20, minval=1, group="Bollinger Bands") 10 | src = input(close, title="Source", group="Bollinger Bands") 11 | mult = input(2.0, minval=0.001, maxval=50, title="StdDev", group="Bollinger Bands") 12 | OSvalue = input(0.0, type=input.float, step=0.1, title="Oversold Value", group="Bollinger Bands") 13 | OBvalue = input(1.0, type=input.float, step=0.1, title="Overbought Value", group="Bollinger Bands") 14 | basis = sma(src, length) 15 | dev = mult * stdev(src, length) 16 | upper = basis + dev 17 | lower = basis - dev 18 | bbr = (src - lower)/(upper - lower) // this value indicates the bollinger band 19 | 20 | // Awesome Oscillator 21 | ao = sma(hl2,5) - sma(hl2,34) 22 | aoMax = input(2, title="Awesome Oscillator Max Threshold", group="Awesome Oscillator") 23 | aoMin = input(-2, title="Awesome Oscillator Min Threshold", group="Awesome Oscillator") 24 | 25 | // Average Directional Index 26 | adxlen = input(14, title="ADX Smoothing", group="ADX") 27 | adxThreshold = input(15, title="ADX Threshold", group="ADX") 28 | dilen = input(14, title="DI Length", group="ADX") 29 | dirmov(len) => 30 | up = change(high) 31 | down = -change(low) 32 | plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) 33 | minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) 34 | truerange = rma(tr, len) 35 | plus = fixnan(100 * rma(plusDM, len) / truerange) 36 | minus = fixnan(100 * rma(minusDM, len) / truerange) 37 | [plus, minus] 38 | adx(dilen, adxlen) => 39 | [plus, minus] = dirmov(dilen) 40 | sum = plus + minus 41 | adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) 42 | adxValue = adx(dilen, adxlen) 43 | 44 | //printTable(txt) => var table t = table.new(position.middle_right, 1, 1), table.cell(t, 0, 0, txt, bgcolor = color.yellow) 45 | //printTable("•TABLE•\n" + str.tostring(bar_index + 1) + " bars\nin the dataset") 46 | 47 | //plotchar(ta.rising(close, 5), "`plotchar()`", "🠅", location.belowbar, color.lime, size = size.small) 48 | //plotshape(ta.falling(close, 5), "`plotchar()`", location = location.abovebar, color = na, text = "•`plotshape()•`\n🠇", textcolor = color.fuchsia, size = size.huge) 49 | 50 | ema5 = ema(close, 5) 51 | ema21 = ema(close, 21) 52 | ema50 = ema(close, 50) 53 | ema200 = ema(close, 200) 54 | 55 | yesBuy = (ema5 > ema21 and ema50 > ema200 and adxValue > adxThreshold and bbr > OBvalue and ao > aoMax) 56 | yesSell = (ema5 < ema21 and ema50 < ema200 and adxValue > adxThreshold and bbr < OSvalue and ao < aoMin) 57 | 58 | showBuy = yesBuy and not yesBuy[1] and not yesBuy[2] and not yesBuy[3] and not yesBuy[4] and not yesBuy[5] 59 | showSell = yesSell and not yesSell[1] and not yesSell[2] and not yesSell[3] and not yesSell[4] and not yesSell[5] 60 | 61 | atr2 = sma(tr, 10) 62 | atr= atr2 63 | up=hl2-(1*atr) 64 | up1 = nz(up[1],up) 65 | up := close[1] > up1 ? max(up,up1) : up 66 | 67 | plotshape(showBuy ? up : na, title="Buy", text="Buy", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(37, 119, 79), textcolor=color.white) 68 | plotshape(showSell ? up : na, title="Sell", text="Sell", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.rgb(127, 37, 37), textcolor=color.white) 69 | 70 | // label.new(bar_index, close, tostring(yesSell)) // print value of close 71 | -------------------------------------------------------------------------------- /TradePro78 Strategy.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | strategy("TradePro78 Strategy", overlay=true) 3 | 4 | /////////////////////////////////////////////////// 5 | 6 | 7 | var isLong78 = false 8 | var isShort78 = false 9 | 10 | // Bollinger Bands %B 11 | length = input(20, minval=1, group="Bollinger Bands") 12 | src = input(close, title="Source", group="Bollinger Bands") 13 | mult = input(2.0, minval=0.001, maxval=50, title="StdDev", group="Bollinger Bands") 14 | OSvalue = input(0.0, type=input.float, step=0.1, title="Oversold Value", group="Bollinger Bands") 15 | OBvalue = input(1.0, type=input.float, step=0.1, title="Overbought Value", group="Bollinger Bands") 16 | basis = sma(src, length) 17 | dev = mult * stdev(src, length) 18 | upper = basis + dev 19 | lower = basis - dev 20 | bbr = (src - lower)/(upper - lower) // this value indicates the bollinger band 21 | 22 | // Awesome Oscillator 23 | ao = sma(hl2,5) - sma(hl2,34) 24 | aoMax = input(2, title="Awesome Oscillator Max Threshold", group="Awesome Oscillator") 25 | aoMin = input(-2, title="Awesome Oscillator Min Threshold", group="Awesome Oscillator") 26 | 27 | // Average Directional Index 28 | adxlen = input(14, title="ADX Smoothing", group="ADX") 29 | adxThreshold = input(0, title="ADX Threshold", group="ADX") 30 | dilen = input(14, title="DI Length", group="ADX") 31 | dirmov(len) => 32 | up = change(high) 33 | down = -change(low) 34 | plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) 35 | minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) 36 | truerange = rma(tr, len) 37 | plus = fixnan(100 * rma(plusDM, len) / truerange) 38 | minus = fixnan(100 * rma(minusDM, len) / truerange) 39 | [plus, minus] 40 | adx(dilen, adxlen) => 41 | [plus, minus] = dirmov(dilen) 42 | sum = plus + minus 43 | adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) 44 | adxValue = adx(dilen, adxlen) 45 | 46 | ema5 = ema(close, 5) 47 | ema21 = ema(close, 21) 48 | ema50 = ema(close, 50) 49 | ema200 = ema(close, 200) 50 | 51 | yesBuy = ema5 > ema21 and ema50 > ema200 and adxValue > adxThreshold and bbr > OBvalue and ao > aoMax and not isLong78 52 | yesSell = ema5 < ema21 and ema50 < ema200 and adxValue > adxThreshold and bbr < OSvalue and ao < aoMin and not isShort78 53 | 54 | showBuy78 = yesBuy and not yesBuy[1] //and not yesBuy[2] and not yesBuy[3] and not yesBuy[4] and not yesBuy[5] 55 | showSell78 = yesSell and not yesSell[1] //and not yesSell[2] and not yesSell[3] and not yesSell[4] and not yesSell[5] 56 | 57 | plotshape(showBuy78 ? hl2 : na, title="78", text="78", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.blue, textcolor=color.white) 58 | plotshape(showSell78 ? hl2 : na, title="78", text="78", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.blue, textcolor=color.white) 59 | 60 | if showBuy78 61 | isLong78 := true 62 | isShort78 := false 63 | 64 | if showSell78 65 | isLong78 := false 66 | isShort78 := true 67 | 68 | ///////////////////////////////////////////////////////////////// 69 | 70 | TimeWindow=time(timeframe.period,"1400-1900", "GMT") 71 | 72 | if (showBuy78 and TimeWindow) 73 | strategy.entry("Trade", strategy.long, comment="Long") 74 | if (showSell78 and TimeWindow) 75 | strategy.entry("Trade", strategy.short, comment="Short") 76 | 77 | trailSource = input(title="Trail Source", defval="Lows/Highs", options=["Lows/Highs", "Close", "Open"], confirm=true, group="Strategy") 78 | trailMethod = input(title="Trail Method", defval="ATR", options=["ATR", "Percent"], confirm=true, group="Strategy") 79 | trailPercent = input(title="Trail Percent", defval=10, minval=0.1, confirm=true, group="Strategy") 80 | swingLookback = input(title="Lookback", defval=7, confirm=true, group="Strategy") 81 | atrPeriod = input(title="ATR Period", defval=14, confirm=true, group="Strategy") 82 | atrMultiplier = input(title="ATR Multiplier", defval=1.0, confirm=true, group="Strategy") 83 | barTime = input(title="Bar Time", defval=timestamp("01 Jan 2021 13:30 +0000"), confirm=true, group="Strategy") 84 | 85 | var float trailPrice = na 86 | float next_trailPrice = na 87 | 88 | atrValue = atr(atrPeriod) * atrMultiplier 89 | float swingLow = lowest(low, swingLookback) 90 | float swingHigh = highest(high, swingLookback) 91 | 92 | 93 | if trailMethod == "ATR" 94 | if trailSource == "Close" 95 | next_trailPrice := strategy.position_size > 0 ? close - atrValue : close + atrValue 96 | else if trailSource == "Open" 97 | next_trailPrice := strategy.position_size > 0 ? open - atrValue : open + atrValue 98 | else 99 | next_trailPrice := strategy.position_size > 0 ? swingLow - atrValue : swingHigh + atrValue 100 | 101 | if trailMethod == "Percent" 102 | float percentMulti = strategy.position_size > 0 ? (100 - trailPercent) / 100 : (100 + trailPercent) / 100 103 | if trailSource == "Close" 104 | next_trailPrice := close * percentMulti 105 | else if trailSource == "Open" 106 | next_trailPrice := open * percentMulti 107 | else 108 | next_trailPrice := strategy.position_size > 0 ? swingLow * percentMulti : swingHigh * percentMulti 109 | 110 | if strategy.position_size != 0 and barstate.isconfirmed 111 | if (next_trailPrice > trailPrice or na(trailPrice)) and strategy.position_size > 0 112 | trailPrice := next_trailPrice 113 | if (next_trailPrice < trailPrice or na(trailPrice)) and strategy.position_size < 0 114 | trailPrice := next_trailPrice 115 | 116 | plot(strategy.position_size != 0 ? trailPrice : na, color=color.red, title="Trailing Stop") 117 | 118 | strategy.exit(id="Trail Exit", from_entry="Trade", limit=na, stop=trailPrice) 119 | 120 | if (strategy.position_size > 0 and close < trailPrice) or (strategy.position_size < 0 and close > trailPrice) 121 | strategy.close("Trade") 122 | 123 | -------------------------------------------------------------------------------- /TradePro78 v1.1.pine: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study(title = "TradePro 78 Strat", overlay = true, format=format.price, precision=2) 3 | 4 | // This indicator inspired by TradePro's video here: https://www.youtube.com/watch?v=cKuTSFwUpPE 5 | // Which reports a 78% win rate, so I wanted to convert into a single indicator and test it! 6 | // Written by TraderOracle 7 | 8 | var isLong78 = false 9 | var isShort78 = false 10 | 11 | // Bollinger Bands %B 12 | length = input(20, minval=1, group="Bollinger Bands") 13 | src = input(close, title="Source", group="Bollinger Bands") 14 | mult = input(2.0, minval=0.001, maxval=50, title="StdDev", group="Bollinger Bands") 15 | OSvalue = input(0.0, type=input.float, step=0.1, title="Oversold Value", group="Bollinger Bands") 16 | OBvalue = input(1.0, type=input.float, step=0.1, title="Overbought Value", group="Bollinger Bands") 17 | basis = sma(src, length) 18 | dev = mult * stdev(src, length) 19 | upper = basis + dev 20 | lower = basis - dev 21 | bbr = (src - lower)/(upper - lower) // this value indicates the bollinger band 22 | 23 | // Awesome Oscillator 24 | ao = sma(hl2,5) - sma(hl2,34) 25 | aoMax = input(2, title="Awesome Oscillator Max Threshold", group="Awesome Oscillator") 26 | aoMin = input(-2, title="Awesome Oscillator Min Threshold", group="Awesome Oscillator") 27 | 28 | // Average Directional Index 29 | adxlen = input(14, title="ADX Smoothing", group="ADX") 30 | adxThreshold = input(0, title="ADX Threshold", group="ADX") 31 | dilen = input(14, title="DI Length", group="ADX") 32 | dirmov(len) => 33 | up = change(high) 34 | down = -change(low) 35 | plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) 36 | minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) 37 | truerange = rma(tr, len) 38 | plus = fixnan(100 * rma(plusDM, len) / truerange) 39 | minus = fixnan(100 * rma(minusDM, len) / truerange) 40 | [plus, minus] 41 | adx(dilen, adxlen) => 42 | [plus, minus] = dirmov(dilen) 43 | sum = plus + minus 44 | adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) 45 | adxValue = adx(dilen, adxlen) 46 | 47 | ema5 = ema(close, 5) 48 | ema21 = ema(close, 21) 49 | ema50 = ema(close, 50) 50 | ema200 = ema(close, 200) 51 | 52 | yesBuy = ema5 > ema21 and ema50 > ema200 and adxValue > adxThreshold and bbr > OBvalue and ao > aoMax and not isLong78 53 | yesSell = ema5 < ema21 and ema50 < ema200 and adxValue > adxThreshold and bbr < OSvalue and ao < aoMin and not isShort78 54 | 55 | showBuy78 = yesBuy and not yesBuy[1] //and not yesBuy[2] and not yesBuy[3] and not yesBuy[4] and not yesBuy[5] 56 | showSell78 = yesSell and not yesSell[1] //and not yesSell[2] and not yesSell[3] and not yesSell[4] and not yesSell[5] 57 | 58 | plotshape(showBuy78 ? hl2 : na, title="78", text="78", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.blue, textcolor=color.white) 59 | plotshape(showSell78 ? hl2 : na, title="78", text="78", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.blue, textcolor=color.white) 60 | 61 | if showBuy78 62 | isLong78 := true 63 | isShort78 := false 64 | 65 | if showSell78 66 | isLong78 := false 67 | isShort78 := true 68 | 69 | -------------------------------------------------------------------------------- /TradePro78 v1.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study(title = "TradePro 78 Strat", overlay = true, format=format.price, precision=2) 3 | 4 | // This indicator inspired by TradePro's video here: https://www.youtube.com/watch?v=cKuTSFwUpPE 5 | // Which reports a 78% win rate, so I wanted to convert into a single indicator and test it! 6 | // Written by TraderOracle 7 | 8 | var isLong78 = false 9 | var isShort78 = false 10 | 11 | // Bollinger Bands %B 12 | length = input(20, minval=1, group="Bollinger Bands") 13 | src = input(close, title="Source", group="Bollinger Bands") 14 | mult = input(2.0, minval=0.001, maxval=50, title="StdDev", group="Bollinger Bands") 15 | OSvalue = input(0.0, type=input.float, step=0.1, title="Oversold Value", group="Bollinger Bands") 16 | OBvalue = input(1.0, type=input.float, step=0.1, title="Overbought Value", group="Bollinger Bands") 17 | basis = sma(src, length) 18 | dev = mult * stdev(src, length) 19 | upper = basis + dev 20 | lower = basis - dev 21 | bbr = (src - lower)/(upper - lower) // this value indicates the bollinger band 22 | 23 | // Awesome Oscillator 24 | ao = sma(hl2,5) - sma(hl2,34) 25 | aoMax = input(2, title="Awesome Oscillator Max Threshold", group="Awesome Oscillator") 26 | aoMin = input(-2, title="Awesome Oscillator Min Threshold", group="Awesome Oscillator") 27 | 28 | // Average Directional Index 29 | adxlen = input(14, title="ADX Smoothing", group="ADX") 30 | adxThreshold = input(0, title="ADX Threshold", group="ADX") 31 | dilen = input(14, title="DI Length", group="ADX") 32 | dirmov(len) => 33 | up = change(high) 34 | down = -change(low) 35 | plusDM = na(up) ? na : (up > down and up > 0 ? up : 0) 36 | minusDM = na(down) ? na : (down > up and down > 0 ? down : 0) 37 | truerange = rma(tr, len) 38 | plus = fixnan(100 * rma(plusDM, len) / truerange) 39 | minus = fixnan(100 * rma(minusDM, len) / truerange) 40 | [plus, minus] 41 | adx(dilen, adxlen) => 42 | [plus, minus] = dirmov(dilen) 43 | sum = plus + minus 44 | adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) 45 | adxValue = adx(dilen, adxlen) 46 | 47 | ema5 = ema(close, 5) 48 | ema21 = ema(close, 21) 49 | ema50 = ema(close, 50) 50 | ema200 = ema(close, 200) 51 | 52 | yesBuy = ema5 > ema21 and ema50 > ema200 and adxValue > adxThreshold and bbr > OBvalue and ao > aoMax and not isLong78 53 | yesSell = ema5 < ema21 and ema50 < ema200 and adxValue > adxThreshold and bbr < OSvalue and ao < aoMin and not isShort78 54 | 55 | showBuy78 = yesBuy and not yesBuy[1] //and not yesBuy[2] and not yesBuy[3] and not yesBuy[4] and not yesBuy[5] 56 | showSell78 = yesSell and not yesSell[1] //and not yesSell[2] and not yesSell[3] and not yesSell[4] and not yesSell[5] 57 | 58 | plotshape(showBuy78 ? hl2 : na, title="78", text="78", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.blue, textcolor=color.white) 59 | plotshape(showSell78 ? hl2 : na, title="78", text="78", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.blue, textcolor=color.white) 60 | 61 | if showBuy78 62 | isLong78 := true 63 | isShort78 := false 64 | 65 | if showSell78 66 | isLong78 := false 67 | isShort78 := true 68 | 69 | -------------------------------------------------------------------------------- /Trampoline Strategy.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | strategy("Trampoline Strategy", overlay=true) 3 | 4 | /////////////////////////////////////////////////// 5 | 6 | // CONFIG 7 | iBBThreshold = input(0.0015, minval=0.0, title="Bollinger Lower Threshold", tooltip="0.003 for daily, 0.0015 for 30 min candles", group="General Settings") 8 | RSIThreshold = input(25, minval=1, title="RSI Lower Threshold", tooltip="Normally 25", group="General Settings") 9 | RSIDown = input(72, minval=1, title="RSI Upper Threshold", tooltip="Normally 75", group="General Settings") 10 | 11 | rsiLengthInput = input(14, minval=1, title="RSI Length", group="RSI Settings") 12 | rsiSourceInput = input(close, "Source", group="RSI Settings") 13 | lengthBB = input(20, minval=1, group="Bollinger Bands") 14 | srcBB = input(close, title="Source", group="Bollinger Bands") 15 | multBB = input(2.0, minval=0.001, maxval=50, title="StdDev", group="Bollinger Bands") 16 | offsetBB = input(0, "Offset", minval = -500, maxval = 500, group="Bollinger Bands") 17 | 18 | isRed = close < open 19 | isGreen = close > open 20 | 21 | // BOLLINGER BANDS 22 | basisBB = sma(srcBB, lengthBB) 23 | devBB = multBB * stdev(srcBB, lengthBB) 24 | upperBB = basisBB + devBB 25 | lowerBB = basisBB - devBB 26 | downBB = low < lowerBB or high < lowerBB 27 | upBB = low > upperBB or high > upperBB 28 | bbw = (upperBB - lowerBB) / basisBB 29 | 30 | // RSI 31 | up = rma(max(change(rsiSourceInput), 0), rsiLengthInput) 32 | down = rma(-min(change(rsiSourceInput), 0), rsiLengthInput) 33 | rsiM = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 34 | 35 | back1 = isRed[1] and rsiM[1] <= RSIThreshold and close[1] < lowerBB[1] and bbw[1] > iBBThreshold 36 | back2 = isRed[2] and rsiM[2] <= RSIThreshold and close[2] < lowerBB[2] and bbw[2] > iBBThreshold 37 | back3 = isRed[3] and rsiM[3] <= RSIThreshold and close[3] < lowerBB[3] and bbw[3] > iBBThreshold 38 | back4 = isRed[4] and rsiM[4] <= RSIThreshold and close[4] < lowerBB[4] and bbw[4] > iBBThreshold 39 | back5 = isRed[5] and rsiM[5] <= RSIThreshold and close[5] < lowerBB[5] and bbw[5] > iBBThreshold 40 | 41 | for1 = isGreen[1] and rsiM[1] >= RSIDown and close[1] > upperBB[1] and bbw[1] > iBBThreshold 42 | for2 = isGreen[2] and rsiM[2] >= RSIDown and close[2] > upperBB[2] and bbw[2] > iBBThreshold 43 | for3 = isGreen[3] and rsiM[3] >= RSIDown and close[3] > upperBB[3] and bbw[3] > iBBThreshold 44 | for4 = isGreen[4] and rsiM[4] >= RSIDown and close[4] > upperBB[4] and bbw[4] > iBBThreshold 45 | for5 = isGreen[5] and rsiM[5] >= RSIDown and close[5] > upperBB[5] and bbw[5] > iBBThreshold 46 | 47 | weGoUp = isGreen and (back1 or back2 or back3 or back4 or back5) and (high > high[1]) 48 | upThrust = weGoUp and not weGoUp[1] and not weGoUp[2] and not weGoUp[3] and not weGoUp[4] 49 | weGoDown = isRed and (for1 or for2 or for3 or for4 or for5) and (low < low[1]) 50 | downThrust = weGoDown and not weGoDown[1] and not weGoDown[2] and not weGoDown[3] and not weGoDown[4] 51 | 52 | ///////////////////////////////////////////////////////////////// 53 | 54 | TimeWindow=time(timeframe.period,"1400-1900", "GMT") 55 | 56 | if (upThrust and TimeWindow) 57 | strategy.entry("Trade", strategy.long, comment="Long") 58 | if (downThrust and TimeWindow) 59 | strategy.entry("Trade", strategy.short, comment="Short") 60 | 61 | trailSource = input(title="Trail Source", defval="Lows/Highs", options=["Lows/Highs", "Close", "Open"], confirm=true, group="Strategy") 62 | trailMethod = input(title="Trail Method", defval="ATR", options=["ATR", "Percent"], confirm=true, group="Strategy") 63 | trailPercent = input(title="Trail Percent", defval=10, minval=0.1, confirm=true, group="Strategy") 64 | swingLookback = input(title="Lookback", defval=7, confirm=true, group="Strategy") 65 | atrPeriod = input(title="ATR Period", defval=14, confirm=true, group="Strategy") 66 | atrMultiplier = input(title="ATR Multiplier", defval=1.0, confirm=true, group="Strategy") 67 | barTime = input(title="Bar Time", defval=timestamp("01 Jan 2021 13:30 +0000"), confirm=true, group="Strategy") 68 | 69 | var float trailPrice = na 70 | float next_trailPrice = na 71 | 72 | atrValue = atr(atrPeriod) * atrMultiplier 73 | float swingLow = lowest(low, swingLookback) 74 | float swingHigh = highest(high, swingLookback) 75 | 76 | 77 | if trailMethod == "ATR" 78 | if trailSource == "Close" 79 | next_trailPrice := strategy.position_size > 0 ? close - atrValue : close + atrValue 80 | else if trailSource == "Open" 81 | next_trailPrice := strategy.position_size > 0 ? open - atrValue : open + atrValue 82 | else 83 | next_trailPrice := strategy.position_size > 0 ? swingLow - atrValue : swingHigh + atrValue 84 | 85 | if trailMethod == "Percent" 86 | float percentMulti = strategy.position_size > 0 ? (100 - trailPercent) / 100 : (100 + trailPercent) / 100 87 | if trailSource == "Close" 88 | next_trailPrice := close * percentMulti 89 | else if trailSource == "Open" 90 | next_trailPrice := open * percentMulti 91 | else 92 | next_trailPrice := strategy.position_size > 0 ? swingLow * percentMulti : swingHigh * percentMulti 93 | 94 | if strategy.position_size != 0 and barstate.isconfirmed 95 | if (next_trailPrice > trailPrice or na(trailPrice)) and strategy.position_size > 0 96 | trailPrice := next_trailPrice 97 | if (next_trailPrice < trailPrice or na(trailPrice)) and strategy.position_size < 0 98 | trailPrice := next_trailPrice 99 | 100 | plot(strategy.position_size != 0 ? trailPrice : na, color=color.red, title="Trailing Stop") 101 | 102 | strategy.exit(id="Trail Exit", from_entry="Trade", limit=na, stop=trailPrice) 103 | 104 | if (strategy.position_size > 0 and close < trailPrice) or (strategy.position_size < 0 and close > trailPrice) 105 | strategy.close("Trade") 106 | 107 | -------------------------------------------------------------------------------- /Trampoline.txt: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study(title="Trampoline", overlay=true) 3 | 4 | // Idea from "Serious Backtester" - https://www.youtube.com/watch?v=2hX7qTamOAQ 5 | // Defaults are optimized for 30 min candles 6 | 7 | // CONFIG 8 | iBBThreshold = input(0.0015, minval=0.0, title="Bollinger Lower Threshold", tooltip="0.003 for daily, 0.0015 for 30 min candles", group="General Settings") 9 | RSIThreshold = input(25, minval=1, title="RSI Lower Threshold", tooltip="Normally 25", group="General Settings") 10 | RSIDown = input(72, minval=1, title="RSI Upper Threshold", tooltip="Normally 75", group="General Settings") 11 | 12 | rsiLengthInput = input(14, minval=1, title="RSI Length", group="RSI Settings") 13 | rsiSourceInput = input(close, "Source", group="RSI Settings") 14 | lengthBB = input(20, minval=1, group="Bollinger Bands") 15 | srcBB = input(close, title="Source", group="Bollinger Bands") 16 | multBB = input(2.0, minval=0.001, maxval=50, title="StdDev", group="Bollinger Bands") 17 | offsetBB = input(0, "Offset", minval = -500, maxval = 500, group="Bollinger Bands") 18 | 19 | isRed = close < open 20 | isGreen = close > open 21 | 22 | // BOLLINGER BANDS 23 | basisBB = sma(srcBB, lengthBB) 24 | devBB = multBB * stdev(srcBB, lengthBB) 25 | upperBB = basisBB + devBB 26 | lowerBB = basisBB - devBB 27 | downBB = low < lowerBB or high < lowerBB 28 | upBB = low > upperBB or high > upperBB 29 | bbw = (upperBB - lowerBB) / basisBB 30 | 31 | // RSI 32 | up = rma(max(change(rsiSourceInput), 0), rsiLengthInput) 33 | down = rma(-min(change(rsiSourceInput), 0), rsiLengthInput) 34 | rsiM = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 35 | 36 | back1 = isRed[1] and rsiM[1] <= RSIThreshold and close[1] < lowerBB[1] and bbw[1] > iBBThreshold 37 | back2 = isRed[2] and rsiM[2] <= RSIThreshold and close[2] < lowerBB[2] and bbw[2] > iBBThreshold 38 | back3 = isRed[3] and rsiM[3] <= RSIThreshold and close[3] < lowerBB[3] and bbw[3] > iBBThreshold 39 | back4 = isRed[4] and rsiM[4] <= RSIThreshold and close[4] < lowerBB[4] and bbw[4] > iBBThreshold 40 | back5 = isRed[5] and rsiM[5] <= RSIThreshold and close[5] < lowerBB[5] and bbw[5] > iBBThreshold 41 | 42 | for1 = isGreen[1] and rsiM[1] >= RSIDown and close[1] > upperBB[1] and bbw[1] > iBBThreshold 43 | for2 = isGreen[2] and rsiM[2] >= RSIDown and close[2] > upperBB[2] and bbw[2] > iBBThreshold 44 | for3 = isGreen[3] and rsiM[3] >= RSIDown and close[3] > upperBB[3] and bbw[3] > iBBThreshold 45 | for4 = isGreen[4] and rsiM[4] >= RSIDown and close[4] > upperBB[4] and bbw[4] > iBBThreshold 46 | for5 = isGreen[5] and rsiM[5] >= RSIDown and close[5] > upperBB[5] and bbw[5] > iBBThreshold 47 | 48 | weGoUp = isGreen and (back1 or back2 or back3 or back4 or back5) and (high > high[1]) 49 | upThrust = weGoUp and not weGoUp[1] and not weGoUp[2] and not weGoUp[3] and not weGoUp[4] 50 | weGoDown = isRed and (for1 or for2 or for3 or for4 or for5) and (low < low[1]) 51 | downThrust = weGoDown and not weGoDown[1] and not weGoDown[2] and not weGoDown[3] and not weGoDown[4] 52 | 53 | // PLOT THE THINGS 54 | plotshape(upThrust ? hl2 : na, title="Buy", text="Buy", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(46, 173, 84), textcolor=color.white) 55 | plotshape(downThrust ? hl2 : na, title="Sell", text="Sell", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.rgb(173, 46, 69), textcolor=color.white) 56 | 57 | atrUp = high + atr(14) * 1.2 58 | atrDown = low - atr(14) * 1.6 59 | plotshape(upThrust ? atrUp : na, title='ATR ceiling', color=color.lime, style=shape.xcross, size=size.tiny, location=location.absolute) 60 | plotshape(upThrust ? atrDown : na, title='ATR floor', color=color.red, style=shape.xcross, size=size.tiny, location=location.absolute) 61 | 62 | atrUp2 = high + atr(14) * 1.6 63 | atrDown2 = low - atr(14) * 1.2 64 | plotshape(downThrust ? atrDown2 : na, title='ATR ceiling', color=color.lime, style=shape.xcross, size=size.tiny, location=location.absolute) 65 | plotshape(downThrust ? atrUp2 : na, title='ATR floor', color=color.red, style=shape.xcross, size=size.tiny, location=location.absolute) 66 | 67 | 68 | // ALERTS 69 | alertcondition(upThrust, title='Trampoline BUY', message='Trampoline BUY') 70 | alertcondition(downThrust, title='Trampoline SELL', message='Trampoline SELL') 71 | 72 | -------------------------------------------------------------------------------- /Vector Candles.txt: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title = 'Vector Candles', shorttitle='Vector Candles', overlay=true, max_bars_back=300,max_boxes_count=500, max_lines_count=500, max_labels_count=500) 3 | import TradersReality/Traders_Reality_Lib/2 as trLib 4 | 5 | color redVectorColor = input.color(title='Vector: Red', group='PVSRA Colors', defval=color.red, inline='vectors') 6 | color greenVectorColor = input.color(title='Green', group='PVSRA Colors', defval=color.lime, inline='vectors') 7 | color violetVectorColor = input.color(title='Violet', group='PVSRA Colors', defval=color.fuchsia, inline='vectors') 8 | color blueVectorColor = input.color(title='Blue', group='PVSRA Colors', defval=color.blue, inline='vectors', tooltip='Bull bars are green and bear bars are red when the bar is with volume >= 200% of the average volume of the 10 previous bars, or bars where the product of candle spread x candle volume is >= the highest for the 10 previous bars.\n Bull bars are blue and bear are violet when the bar is with with volume >= 150% of the average volume of the 10 previous bars.') 9 | color regularCandleUpColor = input.color(title='Regular: Up Candle', group='PVSRA Colors', defval=#999999, inline='nonVectors') 10 | color regularCandleDownColor = input.color(title='Down Candle', group='PVSRA Colors', defval=#4d4d4d, inline='nonVectors', tooltip='Bull bars are light gray and bear are dark gray when none of the red/green/blue/violet vector conditions are met.') 11 | 12 | bool overrideSym = input.bool(group='PVSRA Override', title='Override chart symbol?', defval=false, inline='pvsra') 13 | string pvsraSym = input.string(group='PVSRA Override', title='', defval='INDEX:BTCUSD', tooltip='You can use INDEX:BTCUSD or you can combine multiple feeds, for example BINANCE:BTCUSDT+COINBASE:BTCUSD. Note that adding too many will slow things down.', inline='pvsra') 14 | bool colorOverride = input.bool(true, 'Override color?' , group='Vector Candle Zones', inline="vcz1") 15 | 16 | pvsraVolume(overrideSymbolX, pvsraSymbolX, tickerIdX) => 17 | request.security(overrideSymbolX ? pvsraSymbolX : tickerIdX, '', [volume,high,low,close,open], barmerge.gaps_off, barmerge.lookahead_off) 18 | 19 | [pvsraVolume, pvsraHigh, pvsraLow, pvsraClose, pvsraOpen] = pvsraVolume(overrideSym, pvsraSym, syminfo.tickerid) 20 | 21 | [pvsraColor, alertFlag, averageVolume, volumeSpread, highestVolumeSpread] = trLib.calcPvsra(pvsraVolume, pvsraHigh, pvsraLow, pvsraClose, pvsraOpen, redVectorColor, greenVectorColor, violetVectorColor, blueVectorColor, regularCandleDownColor, regularCandleUpColor) 22 | barcolor(pvsraColor) 23 | 24 | alertcondition(alertFlag, title='Alert on Any Vector Candle', message='{{ticker}} Vector Candle on the {{interval}}') 25 | 26 | alertcondition(pvsraColor == greenVectorColor, title='Green Vector Candle', message='{{ticker}} Green Vector Candle on the {{interval}} Note: alert triggers in real time before the candle is closed unless you choose "once per bar close" option - ie the alert might trigger at some point and the pa after that could change the vector color completely. Use with caution.') 27 | alertcondition(pvsraColor == redVectorColor, title='Red Vector Candle', message='{{ticker}} Red Vector Candle on the {{interval}} Note: alert triggers in real time before the candle is closed unless you choose "once per bar close" option- ie the alert might trigger at some point and the pa after that could change the vector color completely. Use with caution.') 28 | alertcondition(pvsraColor == blueVectorColor, title='Blue Vector Candle', message='{{ticker}} Blue Vector Candle on the {{interval}} Note: alert triggers in real time before the candle is closed unless you choose "once per bar close" option- ie the alert might trigger at some point and the pa after that could change the vector color completely. Use with caution.') 29 | alertcondition(pvsraColor == violetVectorColor, title='Purple Vector Candle', message='{{ticker}} Purple Vector Candle on the {{interval}} Note: alert triggers in real time before the candle is closed unless you choose "once per bar close" option- ie the alert might trigger at some point and the pa after that could change the vector color completely. Use with caution.') 30 | 31 | redGreen = pvsraColor == greenVectorColor and pvsraColor[1] == redVectorColor 32 | greenRed = pvsraColor == redVectorColor and pvsraColor[1] == greenVectorColor 33 | redBlue = pvsraColor == blueVectorColor and pvsraColor[1] == redVectorColor 34 | blueRed = pvsraColor == redVectorColor and pvsraColor[1] == blueVectorColor 35 | greenPurpule = pvsraColor == violetVectorColor and pvsraColor[1] == greenVectorColor 36 | purpleGreen = pvsraColor == greenVectorColor and pvsraColor[1] == violetVectorColor 37 | bluePurpule = pvsraColor == violetVectorColor and pvsraColor[1] == blueVectorColor 38 | purpleBlue = pvsraColor == blueVectorColor and pvsraColor[1] == violetVectorColor 39 | alertcondition(redGreen, title='Red/Green Vector Candle Pattern', message='{{ticker}} Red/Green Vector Candle Pattern on the {{interval}}') 40 | alertcondition(greenRed, title='Green/Red Vector Candle Pattern', message='{{ticker}} Green/Red Vector Candle Pattern on the {{interval}}') 41 | alertcondition(redBlue, title='Red/Blue Vector Candle Pattern', message='{{ticker}} Red/Blue Vector Candle Pattern on the {{interval}}') 42 | alertcondition(blueRed, title='Blue/Red Vector Candle Pattern', message='{{ticker}} Blue/Red Vector Candle Pattern on the {{interval}}') 43 | alertcondition(greenPurpule, title='Green/Purple Vector Candle Pattern', message='{{ticker}} Green/Purple Vector Candle Pattern on the {{interval}}') 44 | alertcondition(purpleGreen, title='Purple/Green Vector Candle Pattern', message='{{ticker}} Purple/Green Vector Candle Pattern on the {{interval}}') 45 | alertcondition(bluePurpule, title='Blue/Purple Vector Candle Pattern', message='{{ticker}} Blue/Purple Vector Candle Pattern on the {{interval}}') 46 | alertcondition(purpleBlue, title='Purple/Blue Vector Candle Pattern', message='{{ticker}} Purple/Blue Vector Candle Pattern on the {{interval}}') 47 | -------------------------------------------------------------------------------- /Vegas.pine: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study(title="Vegas", overlay = true) 3 | 4 | // Inputs 5 | a = input(2, title = "Key Vaule. 'This changes the sensitivity'") 6 | c = input(6, title = "ATR Period") 7 | h = input(false, title = "Signals from Heikin Ashi Candles") 8 | 9 | // HULL SUITE 10 | src1 = input(close, title="Source") 11 | modeSwitch = input("Hma", title="Hull Variation", options=["Hma", "Thma", "Ehma"]) 12 | length = input(55, title="Length(180-200 for floating S/R , 55 for swing entry)") 13 | lengthMult = input(1.0, title="Length multiplier (Used to view higher timeframes with straight band)") 14 | 15 | useHtf = input(false, title="Show Hull MA from X timeframe? (good for scalping)") 16 | htf = input("240", title="Higher timeframe", type=input.resolution) 17 | 18 | candleCol = input(false,title="Color candles based on Hull's Trend?") 19 | visualSwitch = input(true, title="Show as a Band?") 20 | thicknesSwitch = input(1, title="Line Thickness") 21 | transpSwitch = input(40, title="Band Transparency",step=5) 22 | 23 | HMA(_src, _length) => wma(2 * wma(_src, _length / 2) - wma(_src, _length), round(sqrt(_length))) 24 | EHMA(_src, _length) => ema(2 * ema(_src, _length / 2) - ema(_src, _length), round(sqrt(_length))) 25 | THMA(_src, _length) => wma(wma(_src,_length / 3) * 3 - wma(_src, _length / 2) - wma(_src, _length), _length) 26 | 27 | Mode(modeSwitch, src, len) => 28 | modeSwitch == "Hma" ? HMA(src, len) : 29 | modeSwitch == "Ehma" ? EHMA(src, len) : 30 | modeSwitch == "Thma" ? THMA(src, len/2) : na 31 | 32 | _hull = Mode(modeSwitch, src1, int(length * lengthMult)) 33 | HULL = useHtf ? security(syminfo.ticker, htf, _hull) : _hull 34 | MHULL = HULL[0] 35 | SHULL = HULL[2] 36 | hullColor = (HULL > HULL[2] ? #00ff00 : #ff0000) 37 | 38 | // Schaff Trend Cycle 39 | EEEEEE = input(80, 'Length', group='Schaff Trend Cycle') 40 | BBBB = input(27, 'FastLength', group='Schaff Trend Cycle') 41 | BBBBB = input(50, 'SlowLength', group='Schaff Trend Cycle') 42 | 43 | AAAA(BBB, BBBB, BBBBB) => 44 | fastMA = ema(BBB, BBBB) 45 | slowMA = ema(BBB, BBBBB) 46 | AAAA = fastMA - slowMA 47 | AAAA 48 | 49 | AAAAA(EEEEEE, BBBB, BBBBB) => 50 | AAA = input(0.5) 51 | var CCCCC = 0.0 52 | var DDD = 0.0 53 | var DDDDDD = 0.0 54 | var EEEEE = 0.0 55 | BBBBBB = AAAA(close, BBBB, BBBBB) 56 | CCC = lowest(BBBBBB, EEEEEE) 57 | CCCC = highest(BBBBBB, EEEEEE) - CCC 58 | CCCCC := CCCC > 0 ? (BBBBBB - CCC) / CCCC * 100 : nz(CCCCC[1]) 59 | DDD := na(DDD[1]) ? CCCCC : DDD[1] + AAA * (CCCCC - DDD[1]) 60 | DDDD = lowest(DDD, EEEEEE) 61 | DDDDD = highest(DDD, EEEEEE) - DDDD 62 | DDDDDD := DDDDD > 0 ? (DDD - DDDD) / DDDDD * 100 : nz(DDDDDD[1]) 63 | EEEEE := na(EEEEE[1]) ? DDDDDD : EEEEE[1] + AAA * (DDDDDD - EEEEE[1]) 64 | EEEEE 65 | 66 | mAAAAA = AAAAA(EEEEEE, BBBB, BBBBB) 67 | stcColor = mAAAAA > mAAAAA[1] ? color.new(#288a75, 0) : color.new(color.red, 0) 68 | 69 | stcGreen = mAAAAA > mAAAAA[1] and mAAAAA < 0 70 | stcRed = mAAAAA < mAAAAA[1] and mAAAAA > 0 71 | 72 | xATR = atr(c) 73 | nLoss = a * xATR 74 | 75 | src = h ? security(heikinashi(syminfo.tickerid), timeframe.period, close, lookahead = false) : close 76 | 77 | xATRTrailingStop = 0.0 78 | xATRTrailingStop := iff(src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src - nLoss), 79 | iff(src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), src + nLoss), 80 | iff(src > nz(xATRTrailingStop[1], 0), src - nLoss, src + nLoss))) 81 | 82 | pos = 0 83 | pos := iff(src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0), 1, 84 | iff(src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0))) 85 | 86 | xcolor = pos == -1 ? color.red: pos == 1 ? color.green : color.blue 87 | 88 | ema = ema(src,1) 89 | above = crossover(ema, xATRTrailingStop) 90 | below = crossover(xATRTrailingStop, ema) 91 | 92 | buy = src > xATRTrailingStop and above and stcGreen and hullColor == #00ff00 93 | sell = src < xATRTrailingStop and below and stcRed and hullColor == #ff0000 94 | 95 | barbuy = src > xATRTrailingStop 96 | barsell = src < xATRTrailingStop 97 | 98 | plotshape(buy, title = "Buy", text = 'Buy', style = shape.labelup, location = location.belowbar, color= color.green, textcolor = color.white, transp = 0, size = size.tiny) 99 | plotshape(sell, title = "Sell", text = 'Sell', style = shape.labeldown, location = location.abovebar, color= color.red, textcolor = color.white, transp = 0, size = size.tiny) 100 | 101 | -------------------------------------------------------------------------------- /VolImb.pine: -------------------------------------------------------------------------------- 1 | //@version=6 2 | indicator(title="VolImb Dots", shorttitle="VolImb Dots", overlay=true, max_bars_back = 1000, max_lines_count = 500, max_labels_count = 500) 3 | 4 | redCandle = close < open 5 | greenCandle = close > open 6 | 7 | if (redCandle and barstate.isconfirmed) 8 | if (redCandle[1] and open < close[1]) 9 | plotshape(1, title="E", text="E", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white) 10 | 11 | if (greenCandle and barstate.isconfirmed) 12 | if (greenCandle[1] and open > close[1]) 13 | plotshape(1, title="E", text="E", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white) 14 | 15 | alertcondition(bNewGap, "Volume Imbalance Drop", "Volume Imbalance Drop") 16 | -------------------------------------------------------------------------------- /Volume Imbalances.pine: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="Volume Imbalances", shorttitle="Volume Imbalances", overlay=true, max_bars_back = 1000, max_lines_count = 500, max_labels_count = 500) 3 | // vim: syntax=pine 4 | 5 | bTrackBar = true 6 | iBarExtend = input.int(50, "Number of bars to extend line", maxval=500, minval=10, group="Basic Settings") 7 | lWidth = input.int(3, "Line Width", group="Basic Settings") 8 | lStyle = input.string(title="Line Style", options=["Solid", "Dotted", "Dashed"], defval="Dotted", group="Basic Settings") 9 | 10 | sStyle = lStyle=="Solid" ? line.style_solid : lStyle=="Dashed" ? line.style_dashed : line.style_dotted 11 | bExtend = lWidth==500 ? extend.right : extend.none 12 | 13 | var line[] ll = array.new_line() 14 | iss = true 15 | 16 | redCandle = close < open 17 | greenCandle = close > open 18 | 19 | if iss 20 | for [index, line] in ll 21 | if (high > line.get_y1(line) and low < line.get_y1(line)) 22 | line.delete(array.get(ll, index)) 23 | 24 | if (iss and redCandle and barstate.isconfirmed) 25 | if (redCandle[1] and open < close[1]) 26 | gapRed := true 27 | if bTrackBar 28 | array.push(ll, line.new(bar_index, open, bar_index + iBarExtend, open, color=color.new(color.red, 50), width=lWidth, style=sStyle, extend=bExtend)) 29 | bNewGap := true 30 | 31 | if (iss and greenCandle and barstate.isconfirmed) 32 | if (greenCandle[1] and open > close[1]) 33 | gapGreen := true 34 | if bTrackBar 35 | array.push(ll, line.new(bar_index, open, bar_index + iBarExtend, open, color=color.new(color.lime, 50), width=lWidth, style=sStyle, extend=bExtend)) 36 | bNewGap := true 37 | 38 | alertcondition(bNewGap, "Volume Imbalance", "Volume Imbalance") 39 | 40 | if (iss and noOverlapGreen) 41 | brightGreen := true 42 | 43 | if (iss and noOverlapRed) 44 | brightRed := true 45 | 46 | -------------------------------------------------------------------------------- /temp.pine: -------------------------------------------------------------------------------- 1 | //@version=5 2 | indicator(title="Storm Cloud v1", shorttitle="Storm Cloud", overlay=true) 3 | 4 | conversionPeriods = input.int(9, minval=1, title="Conversion Line Length") 5 | basePeriods = input.int(26, minval=1, title="Base Line Length") 6 | laggingSpan2Periods = input.int(52, minval=1, title="Leading Span B Length") 7 | displacement = input.int(26, minval=1, title="Lagging Span") 8 | bShowCloud = input.bool(false, title="Show Cloud") 9 | 10 | donchian(len) => math.avg(ta.lowest(len), ta.highest(len)) 11 | 12 | conversionLine = donchian(conversionPeriods) 13 | baseLine = donchian(basePeriods) 14 | leadLine1 = math.avg(conversionLine, baseLine) 15 | leadLine2 = donchian(laggingSpan2Periods) 16 | 17 | bGreenCloud = leadLine1 > leadLine2 18 | bRedCloud = not bGreenCloud 19 | 20 | p1 = plot(bShowCloud ? leadLine1 : na, offset = displacement - 1, color=color.new(color.black, 100), title="Leading Span A") 21 | p2 = plot(bShowCloud ? leadLine2 : na, offset = displacement - 1, color=color.new(color.black, 100), title="Leading Span B") 22 | fill(p1, p2, color = leadLine1 > leadLine2 ? color.rgb(67, 160, 71, 70) : color.rgb(244, 67, 54, 70)) 23 | 24 | upwards = bGreenCloud and close > leadLine2 and (close > leadLine1 or close < leadLine2) and (close < leadLine1 or close > leadLine2) 25 | downwards = bRedCloud and close < leadLine1 and (close < leadLine1 or close > leadLine2) and (close > leadLine1 or close < leadLine2) 26 | 27 | showUp = upwards and not upwards[1] and not upwards[2] and not upwards[3] and not upwards[4] and not upwards[5] and not upwards[6] and not upwards[7] 28 | showDown = downwards and not downwards[1] and not downwards[2] and not downwards[3] and not downwards[4] and not downwards[5] and not downwards[6] and not downwards[7] 29 | 30 | plotshape(showUp? hl2 : na, title="Cloud", text="Cloud", location=location.belowbar, style=shape.labelup, size=size.tiny, color=color.rgb(10, 118, 14), textcolor=color.white) 31 | plotshape(showDown ? hl2 : na, title="Cloud", text="Cloud", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.rgb(125, 6, 6), textcolor=color.white) 32 | --------------------------------------------------------------------------------