├── ADV RSI ├── BB Strategy ├── Buy Sell 5 min ├── DMI └── ADX++ ├── Double 7s Strategy ├── Gujrati Trader ├── Jaguar ├── README.md ├── Shanky RSI ├── Untitled-1.png └── Zee trend /ADV RSI: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study(title="ADV RSI", shorttitle="ADV RSI", format=format.price, precision=0, resolution="") 3 | src = input(close, "Source", type = input.source) 4 | len = input(14, minval=1, title="Length") 5 | up = rma(max(change(src), 0), len) 6 | down = rma(-min(change(src), 0), len) 7 | rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 8 | p1 = plot(rsi, "RSI", color=#ffffff, linewidth=2) 9 | bandm = hline(50, "Middle Band", color=color.new(#C0C0C0, 50)) 10 | // MA on RSI 11 | maLen = input(21, minval=1, title="EMA On RSI") 12 | ma = ema(rsi, maLen) 13 | p2 = plot(ma, color= rsi >= ma ? #00ff00:#ff0000, title="EMA On RSI", linewidth=1, transp=20) 14 | fill(p1, p2, color = rsi > ma ? #80ff00 : #ff0000) 15 | // INPUT 16 | res1 = input(title="Resolution 1", type=input.resolution, defval="5") 17 | res2 = input(title="Resolution 2", type=input.resolution, defval="15") 18 | allowRepainting = input(true, "Allow Repainting?") 19 | // CALC 20 | rsi1 = allowRepainting ? security(syminfo.tickerid, res1, rsi) : security(syminfo.tickerid, res1, rsi[1], barmerge.lookahead_on) 21 | rsi2 = allowRepainting ? security(syminfo.tickerid, res2, rsi) : security(syminfo.tickerid, res2, rsi[1], barmerge.lookahead_on) 22 | // PLOT 23 | rsi1Color = rsi1 >= 50 ? #88ff88 : #ff8888 24 | rsi2Color = rsi2 >= 50 ? #88ff88 : #ff8888 25 | 26 | 27 | h100 = hline(100) 28 | h70 = hline(70) 29 | h61 = hline(61) 30 | h60 = hline(60) 31 | h40 = hline(40) 32 | h39 = hline(39) 33 | h30 = hline(30) 34 | h0 = hline(0) 35 | fill(h100,h70, #ffc400, transp=98) 36 | fill(h61,h60, #80ff00, transp=20) 37 | fill(h40,h39, #ff0000, transp=33) 38 | fill(h30,h0, #00c3ff, transp=98) 39 | -------------------------------------------------------------------------------- /BB Strategy: -------------------------------------------------------------------------------- 1 | //@version=4 2 | strategy(title="BB Strategy", overlay=true) 3 | 4 | // Strategy Rules: 5 | // 1. Enter trade when price crosses above the lower band 6 | // 2. Exit trade when price touches the upper band 7 | // 8 | 9 | // Chart Properties 10 | testStartYear = input(2010, "Backtest Start Year") 11 | testStartMonth = input(01, "Backtest Start Month") 12 | testStartDay = input(1, "Backtest Start Day") 13 | testPeriodStart = timestamp(testStartYear, testStartMonth, testStartDay, 0, 0) 14 | 15 | testStopYear = input(2030, "Backtest Stop Year") 16 | testStopMonth = input(12, "Backtest Stop Month") 17 | testStopDay = input(30, "Backtest Stop Day") 18 | testPeriodStop = timestamp(testStopYear, testStopMonth, testStopDay, 0, 0) 19 | 20 | // A switch to control background coloring of the test period 21 | testPeriodBackground = input(title="Color Background?", type=input.bool, defval=true) 22 | testPeriodBackgroundColor = testPeriodBackground and time >= testPeriodStart and time <= testPeriodStop ? #6c6f6c : na 23 | color.new(testPeriodBackgroundColor, transp=97) 24 | 25 | // User provided values 26 | smaLength = input(title="SMA Length", type=input.integer, defval=20) // Middle band period length (moving average) 27 | stdLength = input(title="StdDev Length", type=input.integer, defval=20) // Range to apply bands to 28 | ubOffset = input(title="Upper Band Offset", type=input.float, defval=2.0, step=0.5) // Number of standard deviations above MA 29 | lbOffset = input(title="Lower Band Offset", type=input.float, defval=2.0, step=0.5) // Number of standard deviation below MA 30 | 31 | testPeriod() => 32 | time >= testPeriodStart and time <= testPeriodStop ? true : false 33 | 34 | smaValue = sma(close, smaLength) // Middle band 35 | stdDev = stdev(close, stdLength) 36 | upperBand = smaValue + stdDev * ubOffset // Top band 37 | lowerBand = smaValue - stdDev * lbOffset // Bottom band 38 | 39 | // Plot bands to chart 40 | plot(series=smaValue, title="SMA", color=color.blue) 41 | plot(series=upperBand, title="UB", color=color.green, linewidth=2) 42 | plot(series=lowerBand, title="LB", color=color.blue, linewidth=2) 43 | 44 | longCondition = (crossover(close, lowerBand)) 45 | closeLongCondition = (close >= upperBand) 46 | 47 | if (longCondition and testPeriod()) 48 | strategy.entry(id="CALL", long=true, qty=100) 49 | 50 | strategy.close(id="CALL", when=closeLongCondition) 51 | -------------------------------------------------------------------------------- /Buy Sell 5 min: -------------------------------------------------------------------------------- 1 | //@version=3 2 | study(title="SmartView Buy and Sell 5 min", overlay=true) 3 | src = input(defval=close, title="Source") 4 | per = input(defval=100, minval=1, title="Sampling Period") 5 | mult = input(defval=3.0, minval=0.1, title="Range Multiplier") 6 | smoothrng(x, t, m)=> 7 | wper = (t*2) - 1 8 | avrng = ema(abs(x - x[1]), t) 9 | smoothrng = ema(avrng, wper)*m 10 | smoothrng 11 | smrng = smoothrng(src, per, mult) 12 | rngfilt(x, r)=> 13 | rngfilt = x 14 | rngfilt := x > nz(rngfilt[1]) ? ((x - r) < nz(rngfilt[1]) ? nz(rngfilt[1]) : (x - r)) : ((x + r) > nz(rngfilt[1]) ? nz(rngfilt[1]) : (x + r)) 15 | rngfilt 16 | filt = rngfilt(src, smrng) 17 | upward = 0.0 18 | upward := filt > filt[1] ? nz(upward[1]) + 1 : filt < filt[1] ? 0 : nz(upward[1]) 19 | downward = 0.0 20 | downward := filt < filt[1] ? nz(downward[1]) + 1 : filt > filt[1] ? 0 : nz(downward[1]) 21 | hband = filt + smrng 22 | lband = filt - smrng 23 | filtcolor = upward > 0 ? lime : downward > 0 ? red : orange 24 | barcolor = (src > filt) and (src > src[1]) and (upward > 0) ? lime : (src > filt) and (src < src[1]) and (upward > 0) ? green : 25 | (src < filt) and (src < src[1]) and (downward > 0) ? red : (src < filt) and (src > src[1]) and (downward > 0) ? maroon : orange 26 | filtplot = plot(filt, color=filtcolor, linewidth=3, title="Range Filter") 27 | hbandplot = plot(hband, color=aqua, transp=100, title="High Target") 28 | lbandplot = plot(lband, color=fuchsia, transp=100, title="Low Target") 29 | fill(hbandplot, filtplot, color=aqua, title="High Target Range") 30 | fill(lbandplot, filtplot, color=fuchsia, title="Low Target Range") 31 | barcolor(barcolor) 32 | longCond = na 33 | shortCond = na 34 | longCond := ((src > filt) and (src > src[1]) and (upward > 0)) or ((src > filt) and (src < src[1]) and (upward > 0)) 35 | shortCond := ((src < filt) and (src < src[1]) and (downward > 0)) or ((src < filt) and (src > src[1]) and (downward > 0)) 36 | CondIni = 0 37 | CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1] 38 | longCondition = longCond and CondIni[1] == -1 39 | shortCondition = shortCond and CondIni[1] == 1 40 | plotshape(longCondition, title = "Buy Signal", text ="Buy Ker Lo", textcolor = white, style=shape.labelup, size = size.normal, location=location.belowbar, color = green, transp = 0) 41 | plotshape(shortCondition, title = "Sell Signal", text ="Sell Ker Do", textcolor = white, style=shape.labeldown, size = size.normal, location=location.abovebar, color = red, transp = 0) 42 | alertcondition(longCondition, title="Buy Alert", message = "BUY") 43 | alertcondition(longCondition, title="Buy Alert", message = "BUY") 44 | alertcondition(longCondition, title="Buy Alert", message = "BUY") 45 | alertcondition(shortCondition, title="Sell Alert", message = "SELL") 46 | -------------------------------------------------------------------------------- /DMI/ADX++: -------------------------------------------------------------------------------- 1 | //@version=3 2 | //Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0) 3 | //This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 4 | //To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. 5 | // 6 | //If you find this work useful please consider making a donation, thank you. 7 | // 8 | //Bitcoin: 3F636VrPCdnbfrdP5kS4C6fHWVBffXNKCu 9 | //Litecoin: 33932ckE7i3oAQZxxSgLcvmbn8RAgTc2tk 10 | //ETH: 0x53A43EF9E56908A9c868FBf2f1b9DE7B3486FDAF 11 | //contact: bucket@mailbox.org 12 | //created by Yield 13 | 14 | study(title="DMI/ADX++ [Yield]", shorttitle="DMI/ADX++ [OTS]", precision=0) 15 | keyLevel = input(25, title="key level for ADX") 16 | lvlhist = input(10, title="Hist Key level") 17 | adxlen = input(26, title="ADX Smoothing") 18 | dilen = input(13, title="DI Length") 19 | showhist = input(true, type=bool, title="Show histogram?") 20 | paintbg = input(true, title="Paint background for DIs>KL?") 21 | trp = input(80, step=5, minval=0, maxval=100, title="Transparency") 22 | 23 | t = tickerid(syminfo.prefix, ticker) 24 | src = security(t, period, close) 25 | reallow = security(t, period, low) 26 | realhigh = security(t, period, high) 27 | 28 | dirmov(len) => 29 | up = change(realhigh) 30 | down = -change(reallow) 31 | truerange = rma(tr, len) 32 | plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange) 33 | minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange) 34 | [plus, minus] 35 | 36 | adx(dilen, adxlen) => 37 | [plus, minus] = dirmov(dilen) 38 | sum = plus + minus 39 | adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen) 40 | [adx, plus, minus] 41 | 42 | [sig, up, down] = adx(dilen, adxlen) 43 | 44 | basecolor = #F5F5F5 45 | highblue = #00BFFF 46 | color1 = #DCB9F7 47 | color2 = #7CE9F9 48 | color3 = #77FC3F 49 | color4 = #FF4400 50 | color5 = #860EC9 51 | color6 = #00FF00 52 | crimson = #DC143C 53 | forestgreen = #228B22 54 | dodgerblue = #1E90FF 55 | moccasin = #FFE4B5 56 | grey = #808080 57 | 58 | bullish = up >= down 59 | bearish = down > up 60 | 61 | histmain = bullish ? up - down : down - up 62 | greentone = bullish and up < 20 ? grey : bullish and histmain > histmain[1] ? lime : bullish ? forestgreen : na 63 | redtone = bearish and down < 20 ? grey : bearish and histmain > histmain[1] ? crimson : bearish ? maroon : na 64 | histmaincolor = bullish ? greentone : bearish ? redtone : na 65 | histkey = bullish and up > keyLevel ? histmain + (up - keyLevel) : bearish and down > keyLevel ? histmain + (down - keyLevel) : 0 66 | histkeycolor = bullish and histkey > 0 ? moccasin : bearish and histkey > 0 ? color5 : na 67 | 68 | bgup = bullish and histkey > 0 69 | bgdn = bearish and histkey > 0 70 | 71 | adxcolor = sig > keyLevel and bgup ? dodgerblue : sig > keyLevel and bgdn ? orange : grey 72 | 73 | bgcolor(bgup and paintbg ? lime : bgdn and paintbg ? orange : na, transp=trp, editable=false) 74 | hline(45, 'Overheat', linestyle=dotted, linewidth=1, color=white, editable=false) 75 | //hline(keyLevel, 'keyLevel', linestyle=dashed, linewidth=1, color=white, editable=false) 76 | plot(showhist ? na : keyLevel, 'keyLevel', style=dashed, linewidth=1, color=white, editable=false) 77 | plot(showhist ? lvlhist : na, 'Level Hist', style=dashed, linewidth=1, color=white, editable=false) 78 | //hline(10, '10', linestyle=dotted, linewidth=1, color=white, editable=false) 79 | hline(0, 'Zero', linestyle=solid, linewidth=1, color=white, editable=false) 80 | dmip=plot(showhist ? na : up, color=forestgreen, title="+DI", style=line, linewidth=2, transp=0) 81 | dmim=plot(showhist ? na : down, color=crimson, title="-DI", style=line, linewidth=2, transp=0) 82 | colorf = bullish ? forestgreen : crimson 83 | 84 | plot(showhist ? histkey : na, color = histkeycolor, transp=0, linewidth=4, title="DI/KL", editable=false, style=histogram) 85 | plot(showhist ? histmain : na, color = histmaincolor, transp=0, linewidth=4, title="+DI/-DI", editable=false, style=histogram) 86 | plot(sig, color=adxcolor, title="ADX1", style=line, linewidth=3, transp=0) 87 | //keyline=plot(keyLevel, 'keyLevel', style=dashed, linewidth=1, color=white, editable=false) 88 | -------------------------------------------------------------------------------- /Double 7s Strategy: -------------------------------------------------------------------------------- 1 | // This source code is subject to the terms of the Mozilla Public License 2.0 2 | // https://mozilla.org/MPL/2.0/ 3 | 4 | //@version=4 5 | strategy("Double 7s", overlay=true) 6 | 7 | // The strategy range (dates) 8 | testStartYear = input(1990, "Backtest Start Year") 9 | testStartMonth = input(01, "Backtest Start Month") 10 | testStartDay = input(1, "Backtest Start Day") 11 | testPeriodStart = timestamp(testStartYear, testStartMonth, testStartDay, 0, 0) 12 | 13 | testStopYear = input(2022, "Backtest Stop Year") 14 | testStopMonth = input(12, "Backtest Stop Month") 15 | testStopDay = input(30, "Backtest Stop Day") 16 | testPeriodStop = timestamp(testStopYear, testStopMonth, testStopDay, 0, 0) 17 | 18 | // A switch to control background coloring of the test period 19 | testPeriodBackground = input(title="Color Background?", type=input.bool, defval=true) 20 | testPeriodBackgroundColor = testPeriodBackground and time >= testPeriodStart and time <= testPeriodStop ? #6c6f6c : na 21 | bgcolor(testPeriodBackgroundColor, transp=97) 22 | 23 | // The Doubles value 24 | // Usually Double 7's but can be Double 5's, 6's, 8's, 9's, and 10's 25 | doublesVal = input(title="Doubles Value", type=input.integer, defval=7, minval=5, maxval=10) 26 | 27 | // Determine if current bar is within range 28 | // @returns boolean true or false 29 | testPeriod() => 30 | time >= testPeriodStart and time <= testPeriodStop ? true : false 31 | 32 | longSMA = sma(close, 200) // 200-day moving average 33 | highest_close = highest(close, doublesVal) // price of highest close 34 | lowest_close = lowest(close, doublesVal) // price of lowest close 35 | 36 | longCondition = close > longSMA // Phase One Entry Condition 37 | 38 | if longCondition and testPeriod() 39 | strategy.entry("CALL", strategy.long, 100, when=close == lowest_close) 40 | strategy.close("CALL", when=close == highest_close) 41 | -------------------------------------------------------------------------------- /Gujrati Trader: -------------------------------------------------------------------------------- 1 | study("Gujrati Trader", overlay = true) 2 | Up=hl2-(3*atr(3)) 3 | Dn=hl2+(3*atr(3)) 4 | TrendUp=close[1]>TrendUp[1]? max(Up,TrendUp[1]) : Up 5 | TrendDown=close[1] TrendDown[1] ? 1: close< TrendUp[1]? -1: nz(Trend[1],1) 7 | Tsl = Trend==1? TrendUp: TrendDown 8 | linecolor = Trend == 1 ? green : red 9 | plotarrow(Trend == 1 and Trend[1] == -1 ? Trend : na, title="Up Entry Arrow", colorup=lime, maxheight=60, minheight=50, transp=0) 10 | plotarrow(Trend == -1 and Trend[1] == 1 ? Trend : na, title="Down Entry Arrow", colordown=red, maxheight=60, minheight=50, transp=0) 11 | -------------------------------------------------------------------------------- /Jaguar: -------------------------------------------------------------------------------- 1 | //@version=3 2 | study(title="Jaguar", overlay=true) 3 | src=close 4 | smoothrng(x, t, m)=> 5 | wper = (t*2) - 1 6 | avrng = ema(abs(x - x[1]), t) 7 | smoothrng = ema(avrng, wper)*m 8 | smoothrng 9 | smrng = smoothrng(src, 100, 2.5) 10 | rngfilt(x, r)=> 11 | rngfilt = x 12 | rngfilt := x > nz(rngfilt[1]) ? ((x - r) < nz(rngfilt[1]) ? nz(rngfilt[1]) : (x - r)) : ((x + r) > nz(rngfilt[1]) ? nz(rngfilt[1]) : (x + r)) 13 | rngfilt 14 | filt = rngfilt(src, smrng) 15 | upward = 0.0 16 | upward := filt > filt[1] ? nz(upward[1]) + 1 : filt < filt[1] ? 0 : nz(upward[1]) 17 | downward = 0.0 18 | downward := filt < filt[1] ? nz(downward[1]) + 1 : filt > filt[1] ? 0 : nz(downward[1]) 19 | hband = filt + smrng 20 | lband = filt - smrng 21 | filtcolor = upward > 0 ? lime : downward > 0 ? red : orange 22 | barcolor = (src > filt) and (src > src[1]) and (upward > 0) ? lime : (src > filt) and (src < src[1]) and (upward > 0) ? gray : 23 | (src < filt) and (src < src[1]) and (downward > 0) ? red : (src < filt) and (src > src[1]) and (downward > 0) ? gray : gray 24 | barcolor(barcolor) 25 | longCond = na 26 | shortCond = na 27 | longCond := ((src > filt) and (src > src[1]) and (upward > 0)) or ((src > filt) and (src < src[1]) and (upward > 0)) 28 | shortCond := ((src < filt) and (src < src[1]) and (downward > 0)) or ((src < filt) and (src > src[1]) and (downward > 0)) 29 | CondIni = 0 30 | CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1] 31 | longCondition = longCond and CondIni[1] == -1 32 | shortCondition = shortCond and CondIni[1] == 1 33 | plotshape(longCondition, title = "Buy Signal", text ="BUY", textcolor = white, style=shape.labelup, size = size.normal, location=location.belowbar, color = green, transp = 0) 34 | plotshape(shortCondition, title = "Sell Signal", text ="SELL", textcolor = white, style=shape.labeldown, size = size.normal, location=location.abovebar, color = red, transp = 0) 35 | alertcondition(longCondition, title="Buy Alert", message = "BUY") 36 | alertcondition(longCondition, title="Buy Alert", message = "BUY") 37 | alertcondition(longCondition, title="Buy Alert", message = "BUY") 38 | alertcondition(shortCondition, title="Sell Alert", message = "SELL") 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CCV 2 | It is preferable to use Heiken Ashi candles with some indicators 3 | -------------------------------------------------------------------------------- /Shanky RSI: -------------------------------------------------------------------------------- 1 | //@version=4 2 | // 3 | study("Shanky RSI") 4 | RSI_Period = input(6, title='RSI Length') 5 | SF = input(5, title='RSI Smoothing') 6 | Q = input(3, title=' Q ') 7 | ThreshHold = input(3, title="TH") 8 | // 9 | 10 | src = input(close, title="RSI Source") 11 | // 12 | 13 | // 14 | Wilders_Period = RSI_Period * 2 - 1 15 | 16 | 17 | Rsi = rsi(src, RSI_Period) 18 | RsiMa = ema(Rsi, SF) 19 | AtrRsi = abs(RsiMa[1] - RsiMa) 20 | MaAtrRsi = ema(AtrRsi, Wilders_Period) 21 | dar = ema(MaAtrRsi, Wilders_Period) * Q 22 | 23 | longband = 0.0 24 | shortband = 0.0 25 | trend = 0 26 | 27 | DeltaFastAtrRsi = dar 28 | RSIndex = RsiMa 29 | newshortband = RSIndex + DeltaFastAtrRsi 30 | newlongband = RSIndex - DeltaFastAtrRsi 31 | longband := RSIndex[1] > longband[1] and RSIndex > longband[1] ? 32 | max(longband[1], newlongband) : newlongband 33 | shortband := RSIndex[1] < shortband[1] and RSIndex < shortband[1] ? 34 | min(shortband[1], newshortband) : newshortband 35 | cross_1 = cross(longband[1], RSIndex) 36 | trend := cross(RSIndex, shortband[1]) ? 1 : cross_1 ? -1 : nz(trend[1], 1) 37 | FastAtrRsiTL = trend == 1 ? longband : shortband 38 | //////////////////// 39 | 40 | 41 | length = input(50, minval=1, title="BL") 42 | mult = input(0.35, minval=0.001, maxval=5, step=0.1, title="BB M") 43 | basis = sma(FastAtrRsiTL - 50, length) 44 | dev = mult * stdev(FastAtrRsiTL - 50, length) 45 | upper = basis + dev 46 | lower = basis - dev 47 | color_bar = RsiMa - 50 > upper ? #00c3ff : RsiMa - 50 < lower ? #ff0062 : color.gray 48 | 49 | 50 | // 51 | // Zero cross 52 | Qzlong = 0 53 | Qzlong := nz(Qzlong[1]) 54 | Qzshort = 0 55 | Qzshort := nz(Qzshort[1]) 56 | Qzlong := RSIndex >= 50 ? Qzlong + 1 : 0 57 | Qzshort := RSIndex < 50 ? Qzshort + 1 : 0 58 | // 59 | 60 | Zero = hline(0, color=#FFFFFF, linestyle=hline.style_dotted, linewidth=1) 61 | 62 | //////////////////////////////////////////////////////////////// 63 | 64 | RSI_Period2 = input(6, title='RSI Length') 65 | SF2 = input(5, title='RSI Smoothing') 66 | Q2 = input(1.61, title=' Q2 ') 67 | ThreshHold2 = input(3, title="TH") 68 | 69 | src2 = input(close, title="RSI Source") 70 | // 71 | 72 | // 73 | Wilders_Period2 = RSI_Period2 * 2 - 1 74 | 75 | 76 | Rsi2 = rsi(src2, RSI_Period2) 77 | RsiMa2 = ema(Rsi2, SF2) 78 | AtrRsi2 = abs(RsiMa2[1] - RsiMa2) 79 | MaAtrRsi2 = ema(AtrRsi2, Wilders_Period2) 80 | dar2 = ema(MaAtrRsi2, Wilders_Period2) * Q2 81 | longband2 = 0.0 82 | shortband2 = 0.0 83 | trend2 = 0 84 | 85 | DeltaFastAtrRsi2 = dar2 86 | RSIndex2 = RsiMa2 87 | newshortband2 = RSIndex2 + DeltaFastAtrRsi2 88 | newlongband2 = RSIndex2 - DeltaFastAtrRsi2 89 | longband2 := RSIndex2[1] > longband2[1] and RSIndex2 > longband2[1] ? 90 | max(longband2[1], newlongband2) : newlongband2 91 | shortband2 := RSIndex2[1] < shortband2[1] and RSIndex2 < shortband2[1] ? 92 | min(shortband2[1], newshortband2) : newshortband2 93 | cross_2 = cross(longband2[1], RSIndex2) 94 | trend2 := cross(RSIndex2, shortband2[1]) ? 1 : cross_2 ? -1 : nz(trend2[1], 1) 95 | FastAtrRsi2TL = trend2 == 1 ? longband2 : shortband2 96 | 97 | 98 | // 99 | // Zero cross 100 | Q2zlong = 0 101 | Q2zlong := nz(Q2zlong[1]) 102 | Q2zshort = 0 103 | Q2zshort := nz(Q2zshort[1]) 104 | Q2zlong := RSIndex2 >= 50 ? Q2zlong + 1 : 0 105 | Q2zshort := RSIndex2 < 50 ? Q2zshort + 1 : 0 106 | // 107 | 108 | hcolor2 = RsiMa2 - 50 > ThreshHold2 ? #B2B5BE : 109 | RsiMa2 - 50 < 0 - ThreshHold2 ? #B2B5BE : na 110 | plot(FastAtrRsi2TL - 50, title='Q Line', color=#FFFFFF, transp=0, linewidth=2) 111 | plot(RsiMa2 - 50, color=hcolor2, transp=50, title='Histo2', style=plot.style_columns) 112 | 113 | Greenbar1 = RsiMa2 - 50 > ThreshHold2 114 | Greenbar2 = RsiMa - 50 > upper 115 | 116 | Redbar1 = RsiMa2 - 50 < 0 - ThreshHold2 117 | Redbar2 = RsiMa - 50 < lower 118 | plot(Greenbar1 and Greenbar2 == 1 ? RsiMa2 - 50 : na, title="Q Up", style=plot.style_columns, color=#FFFF00, transp=0) 119 | plot(Redbar1 and Redbar2 == 1 ? RsiMa2 - 50 : na, title="Q Down", style=plot.style_columns, color=#FF7F00, transp=0) 120 | -------------------------------------------------------------------------------- /Untitled-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBNET77/Tv/195a631236e1b17ff90732ab85dcc4d9cb09f1e7/Untitled-1.png -------------------------------------------------------------------------------- /Zee trend: -------------------------------------------------------------------------------- 1 | //@version=4 2 | study("Zee Trend", overlay=true) 3 | 4 | amplitude = input(title="Amplitude", defval=3) 5 | channelDeviation = input(title="Channel Deviation", defval=2) 6 | showArrows = input(title="Show Arrows", defval=true) 7 | showChannels = input(title="Show Channels", defval=false) 8 | 9 | var int trend = 0 10 | var int nextTrend = 0 11 | var float maxLowPrice = nz(low[1], low) 12 | var float minHighPrice = nz(high[1], high) 13 | 14 | var float up = 0.0 15 | var float down = 0.0 16 | float atrHigh = 0.0 17 | float atrLow = 0.0 18 | float arrowUp = na 19 | float arrowDown = na 20 | 21 | atr2 = atr(100) / 2 22 | dev = channelDeviation * atr2 23 | 24 | highPrice = high[abs(highestbars(amplitude))] 25 | lowPrice = low[abs(lowestbars(amplitude))] 26 | highma = sma(high, amplitude) 27 | lowma = sma(low, amplitude) 28 | 29 | if nextTrend == 1 30 | maxLowPrice := max(lowPrice, maxLowPrice) 31 | 32 | if highma < maxLowPrice and close < nz(low[1], low) 33 | trend := 1 34 | nextTrend := 0 35 | minHighPrice := highPrice 36 | else 37 | minHighPrice := min(highPrice, minHighPrice) 38 | 39 | if lowma > minHighPrice and close > nz(high[1], high) 40 | trend := 0 41 | nextTrend := 1 42 | maxLowPrice := lowPrice 43 | 44 | if trend == 0 45 | if not na(trend[1]) and trend[1] != 0 46 | up := na(down[1]) ? down : down[1] 47 | arrowUp := up - atr2 48 | else 49 | up := na(up[1]) ? maxLowPrice : max(maxLowPrice, up[1]) 50 | atrHigh := up + dev 51 | atrLow := up - dev 52 | else 53 | if not na(trend[1]) and trend[1] != 1 54 | down := na(up[1]) ? up : up[1] 55 | arrowDown := down + atr2 56 | else 57 | down := na(down[1]) ? minHighPrice : min(minHighPrice, down[1]) 58 | atrHigh := down + dev 59 | atrLow := down - dev 60 | 61 | ht = trend == 0 ? up : down 62 | 63 | var color buyColor = color.blue 64 | var color sellColor = color.red 65 | 66 | htColor = trend == 0 ? buyColor : sellColor 67 | htPlot = plot(ht, title="HalfTrend", linewidth=2, color=htColor) 68 | 69 | atrHighPlot = plot(showChannels ? atrHigh : na, title="ATR High", style=plot.style_circles, color=sellColor) 70 | atrLowPlot = plot(showChannels ? atrLow : na, title="ATR Low", style=plot.style_circles, color=buyColor) 71 | 72 | fill(htPlot, atrHighPlot, title="ATR High Ribbon", color=sellColor) 73 | fill(htPlot, atrLowPlot, title="ATR Low Ribbon", color=buyColor) 74 | 75 | buySignal = not na(arrowUp) and (trend == 0 and trend[1] == 1) 76 | sellSignal = not na(arrowDown) and (trend == 1 and trend[1] == 0) 77 | 78 | plotshape(showArrows and buySignal ? atrLow : na, title="Arrow Up", style=shape.labelup, location=location.absolute, size=size.tiny, color=color.lime, textcolor=color.white, text="Buy") 79 | plotshape(showArrows and sellSignal ? atrHigh : na, title="Arrow Down", style=shape.labeldown, location=location.absolute, size=size.tiny, color=sellColor, textcolor=color.white, text="Sell") 80 | 81 | alertcondition(buySignal, title="Alert: HalfTrend Buy", message="HalfTrend Buy") 82 | alertcondition(sellSignal, title="Alert: HalfTrend Sell", message="HalfTrend Sell") 83 | --------------------------------------------------------------------------------