Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © KivancOzbilgic
- //@version=5
- indicator('Quantitative Qualitative Estimation', shorttitle='QQE', precision=4, timeframe='')
- src = input(close)
- length = input.int(14, 'RSI Length', minval=1)
- SSF = input.int(5, 'SF RSI SMoothing Factor', minval=1)
- showsignals = input(title='Show Crossing Signals?', defval=true)
- highlighting = input(title='Highlighter On/Off ?', defval=true)
- RSII = ta.ema(ta.rsi(src, length), SSF)
- TR = math.abs(RSII - RSII[1])
- wwalpha = 1 / length
- WWMA = 0.0
- WWMA := wwalpha * TR + (1 - wwalpha) * nz(WWMA[1])
- ATRRSI = 0.0
- ATRRSI := wwalpha * WWMA + (1 - wwalpha) * nz(ATRRSI[1])
- QQEF = ta.ema(ta.rsi(src, length), SSF)
- QUP = QQEF + ATRRSI * 4.236
- QDN = QQEF - ATRRSI * 4.236
- QQES = 0.0
- QQES := QUP < nz(QQES[1]) ? QUP : QQEF > nz(QQES[1]) and QQEF[1] < nz(QQES[1]) ? QDN : QDN > nz(QQES[1]) ? QDN : QQEF < nz(QQES[1]) and QQEF[1] > nz(QQES[1]) ? QUP : nz(QQES[1])
- QQF = plot(QQEF, 'FAST', color.new(color.maroon, 0), 2)
- QQS = plot(QQES, 'SLOW', color=color.new(color.blue, 0), linewidth=1)
- plot(50, color=color.new(color.gray, 0), style=plot.style_circles)
- longFillColor = highlighting ? QQEF > QQES ? color.green : na : na
- shortFillColor = highlighting ? QQEF < QQES ? color.red : na : na
- fill(QQF, QQS, title='UpTrend Highligter', color=longFillColor, transp=90)
- fill(QQF, QQS, title='DownTrend Highligter', color=shortFillColor, transp=90)
- buySignalr = ta.crossover(QQEF, QQES)
- plotshape(buySignalr and showsignals ? QQES * 0.995 : na, title='Buy', text='Buy', location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(color.green, 0), textcolor=color.new(color.white, 0))
- sellSignallr = ta.crossunder(QQEF, QQES)
- plotshape(sellSignallr and showsignals ? QQES * 1.005 : na, title='Sell', text='Sell', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.red, 0), textcolor=color.new(color.white, 0))
- alertcondition(ta.cross(QQEF, QQES), title='Cross Alert', message='QQE Crossing Signal!')
- alertcondition(ta.crossover(QQEF, QQES), title='Crossover Alarm', message='QQE BUY SIGNAL!')
- alertcondition(ta.crossunder(QQEF, QQES), title='Crossunder Alarm', message='QQE SELL SIGNAL!')
- alertcondition(ta.crossover(QQEF, 50), title='Cross 50 Up Alert', message='QQE FAST Crossing 50 UP!')
- alertcondition(ta.crossunder(QQEF, 50), title='Cross 50 Down Alert', message='QQE FAST Crossing 50 DOWN!')
- //end of this part
- //kather_S
- //@version=5
- //indicator(title='Girl Next Door 3RSI', overlay=false)
- //--RSI 1
- len = input.int(6, minval=1, title='Length')
- //src = input(close, 'Source')
- up = ta.rma(math.max(ta.change(src), 0), len)
- down = ta.rma(-math.min(ta.change(src), 0), len)
- rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)
- plot(rsi, 'rsi', color=color.new(color.green, 0))
- //--RSI 2
- len_2 = input.int(14, minval=1, title='Length 2')
- src_2 = src
- up_2 = ta.rma(math.max(ta.change(src_2), 0), len_2)
- down_2 = ta.rma(-math.min(ta.change(src_2), 0), len_2)
- rsi_2 = down_2 == 0 ? 100 : up_2 == 0 ? 0 : 100 - 100 / (1 + up_2 / down_2)
- plot(rsi_2, 'rsi_2', color=color.new(color.yellow, 0))
- //--RSI 3
- len_3 = input.int(24, minval=1, title='Length 3')
- src_3 = src
- up_3 = ta.rma(math.max(ta.change(src_3), 0), len_3)
- down_3 = ta.rma(-math.min(ta.change(src_3), 0), len_3)
- rsi_3 = down_3 == 0 ? 100 : up_3 == 0 ? 0 : 100 - 100 / (1 + up_3 / down_3)
- plot(rsi_3, 'rsi_3', color=color.new(color.red, 0))
- //--Bands
- SkyHigh = hline(80, 'Bands 2 Make Em Dance', color=color.green)
- NormH = hline(70, 'Make It Rain', color=color.yellow)
- Midway = hline(50, 'Chill Mode', color=color.gray)
- NormL = hline(30, 'Get That Dip', color=color.yellow)
- DownUnder = hline(20, 'Fill That Bag', color=color.green)
- fill(NormH, NormL, color=color.new(color.gray, 90), title='Background')
- //end of this part
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // https://www.investopedia.com/
- // There are a number of very clever people I have taken bits of code and ideas, thanks to you all :)
- // © raul3429
- //@version=5
- //indicator(title='MACD+RSI+Flag v3.3 by RM', shorttitle='MACD+RSI+Flg v3.3 by RM', timeframe='', overlay=false)
- // This indicator has line and the band changing color during oversold -green- /overbought -red- with Flags for first candle after direction change shown
- // shown as triangles also text is available with the flag. The MACD 12 and MACD 26 are shown with line values and their histogram differences. The crossings marked as diamonds.
- // RSI has been scaled down by the "scaleRSI" parameter to enable plotting alongside MACD.
- // User may need to adjust this scaleRSI as required to shown RSI & MACD in the proper combination.
- // RSI: The relative strength index (RSI) is a momentum indicator measures recent price changes to evaluate overbought or oversold conditions.
- // MACD: Moving average convergence divergence (MACD) is a trend-following momentum indicator that shows the relationship between
- // two moving averages of a security’s price. The MACD is = 12EMA - 26EMA, The histogram represent this difference.
- // Added divergence indicator for Price-RSI slope
- // Revised plots' scaleRSI input
- // Disclaimer: This is not a Financial advisory tool. For education purposes only. Use at your own risk.
- //Source
- //src = input(title='Source', defval=close)
- // MACD inputs
- fast_length = input(title='MACD Fast Length', defval=12)
- slow_length = input(title='MACD Slow Length', defval=26)
- signal_length = input.int(title='Signal Smoothing', minval=1, maxval=50, defval=9)
- sma_source = input.string(title='Oscillator MA Type', defval='EMA', options=['SMA', 'EMA'])
- sma_signal = input.string(title='Signal Line MA Type', defval='EMA', options=['SMA', 'EMA'])
- // RSI inputs
- lenm = input.int(14, minval=1, title='RSI Length')
- osRSI = input.int(title='OverSold RSI', defval=30, minval=1, maxval=100)
- obRSI = input.int(title='OverBought RSI', defval=70, minval=1, maxval=100)
- scaleRSI = input.int(title='RSI Plot Scale Factor [%]', defval=10, minval=1, maxval=100) / 100
- flagRSI = input(title='Flag and Text os/ob RSI', defval=true)
- txtRSI = input(title='Show Text os/ob RSI', defval=false)
- // Plot color inputs
- col_macd = #2962FF
- col_signal = #FF6D00
- col_grow_above = #26A69A
- col_fall_above = #B2DFDB
- col_grow_below = #FFCDD2
- col_fall_below = #FF5252
- //col_macd = input(#2962FF, "MACD Line ", input.color, group="Color Settings", inline="MACD")
- //col_signal = input(#FF6D00, "Signal Line ", input.color, group="Color Settings", inline="Signal")
- //col_grow_above = input(#26A69A, "Above Grow", input.color, group="Histogram", inline="Above")
- //col_fall_above = input(#B2DFDB, "Fall", input.color, group="Histogram", inline="Above")
- //col_grow_below = input(#FFCDD2, "Below Grow", input.color, group="Histogram", inline="Below")
- //col_fall_below = input(#FF5252, "Fall", input.color, group="Histogram", inline="Below")
- // colors
- c_white = #ffffff //White
- c_green = #006400 //Green
- c_green100 = #006400FF //Green 100%
- c_green90 = #00640090 //Green 90%
- c_greenLight = #388e3c //Green Light
- c_red = #8B0000 //Red
- c_red100 = #8B0000FF //Red 100%
- c_red90 = #8B000090 //Red 90%
- c_redLight = #b71c1c //Red Light
- c_orange = #f57f17 //Orange
- c_orange90 = #f57f1790 //Orange90%
- // MACD
- fast_ma = sma_source == 'SMA' ? ta.sma(src, fast_length) : ta.ema(src, fast_length)
- slow_ma = sma_source == 'SMA' ? ta.sma(src, slow_length) : ta.ema(src, slow_length)
- macd = fast_ma - slow_ma
- signal = sma_signal == 'SMA' ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length)
- hist = macd - signal
- plot(hist, title='Histogram', style=plot.style_columns, color=hist >= 0 ? hist[1] < hist ? col_grow_above : col_fall_above : hist[1] < hist ? col_grow_below : col_fall_below)
- plot(macd, title='MACD', color=col_macd)
- plot(signal, title='Signal', color=col_signal)
- plotshape(ta.crossover(signal, macd), title='McD CrossOver', style=shape.diamond, location=location.top, color=c_orange90, size=size.tiny)
- plotshape(ta.crossunder(signal, macd), title='McD CrossUnder', style=shape.diamond, location=location.bottom, color=c_orange90, size=size.tiny)
- //RSI
- uprsi = ta.rma(math.max(ta.change(src), 0), lenm)
- downrsi = ta.rma(-math.min(ta.change(src), 0), lenm)
- rsixx = downrsi == 0 ? 100 : uprsi == 0 ? 0 : 100 - 100 / (1 + uprsi / downrsi)
- f_rsiCond = rsixx >= obRSI ? 1 : rsixx <= osRSI ? -1 : 0
- f_rsiCol = f_rsiCond == -1 ? c_red : f_rsiCond == 1 ? c_green : c_white
- p2 = plot(rsi * scaleRSI, 'RSI Scaled', color=f_rsiCol, linewidth=1)
- pm = plot(50 * scaleRSI, 'RSI Mid', color=f_rsiCol, linewidth=1)
- fill(p2, pm, color=color.new(f_rsiCol, 85), title='Background', transp=90)
- // Trade signals per RSI
- pine_rsi_prev(x, y) =>
- u = math.max(x[1] - x[2], 0)
- d = math.max(x[2] - x[1], 0)
- rs = ta.rma(u, y) / ta.rma(d, y)
- res = 100 - 100 / (1 + rs)
- res
- isRedCandle = close < open
- isGreenCandle = close > open
- prevCandleIsRed = close[1] < open[1]
- prevCandleIsGreen = open[1] < close[1]
- isRsiUnder_osRSI = pine_rsi_prev(close, 14) < 30
- isRsiOver_obRSI = pine_rsi_prev(close, 14) > 70
- enterCallTrade = isGreenCandle and prevCandleIsRed and isRsiUnder_osRSI and flagRSI
- enterPutTrade = isRedCandle and prevCandleIsGreen and isRsiOver_obRSI and flagRSI
- plotshape(enterCallTrade, title='Buy Flag', text=' ', textcolor=c_white, color=c_green90, style=shape.triangleup, size=size.tiny, location=location.bottom, editable=false)
- plotshape(enterPutTrade, title='Sell Flag', text=' ', textcolor=c_white, color=c_red90, style=shape.triangledown, size=size.tiny, location=location.top, editable=false)
- plotshape(enterCallTrade and txtRSI, title='Buy Text', text='OS Call', textcolor=c_white, color=c_green90, style=shape.triangleup, size=size.tiny, location=location.bottom, editable=false)
- plotshape(enterPutTrade and txtRSI, title='Sell Text', text='OB Put', textcolor=c_white, color=c_red90, style=shape.triangledown, size=size.tiny, location=location.top, editable=false)
- // Divergence Indicator
- //study(title="Divergence Indicator", format=format.price, resolution="")
- lbR = input(title='Pivot Lookback Right', defval=5)
- lbL = input(title='Pivot Lookback Left', defval=5)
- rangeUpper = input(title='Max of Lookback Range', defval=60)
- rangeLower = input(title='Min of Lookback Range', defval=5)
- plotBull = input(title='Plot Bullish', defval=true)
- plotHiddenBull = input(title='Plot Hidden Bullish', defval=false)
- plotBear = input(title='Plot Bearish', defval=true)
- plotHiddenBear = input(title='Plot Hidden Bearish', defval=false)
- bearColor = c_red
- bullColor = c_green
- hiddenBullColor = color.new(c_green, 80)
- hiddenBearColor = color.new(c_red, 80)
- textColor = c_white
- noneColor = color.new(c_white, 100)
- osc = ta.rsi(src, lenm)
- plot(osc * scaleRSI, title='RSI Do not show', linewidth=2, color=color.new(#2962FF, 0), display=display.none)
- plFound = na(ta.pivotlow(osc, lbL, lbR)) ? false : true
- phFound = na(ta.pivothigh(osc, lbL, lbR)) ? false : true
- _inRange(cond) =>
- bars = ta.barssince(cond == true)
- rangeLower <= bars and bars <= rangeUpper
- //------------------------------------------------------------------------------
- // Regular Bullish
- // Osc: Higher Low
- oscHL = osc[lbR] > ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])
- // Price: Lower Low
- priceLL = low[lbR] < ta.valuewhen(plFound, low[lbR], 1)
- bullCond = plotBull and priceLL and oscHL and plFound
- plot(plFound ? osc[lbR] * scaleRSI : na, offset=-lbR, title='Regular Bullish', linewidth=2, color=bullCond ? bullColor : noneColor)
- plotshape(bullCond ? osc[lbR] * scaleRSI : na, offset=-lbR, title='Regular Bullish Label', text=' Bull ', style=shape.labelup, location=location.absolute, color=bullColor, textcolor=textColor)
- //------------------------------------------------------------------------------
- // Hidden Bullish
- // Osc: Lower Low
- oscLL = osc[lbR] < ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])
- // Price: Higher Low
- priceHL = low[lbR] > ta.valuewhen(plFound, low[lbR], 1)
- hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound
- plot(plFound ? osc[lbR] * scaleRSI : na, offset=-lbR, title='Hidden Bullish', linewidth=2, color=hiddenBullCond ? hiddenBullColor : noneColor)
- plotshape(hiddenBullCond ? osc[lbR] * scaleRSI : na, offset=-lbR, title='Hidden Bullish Label', text=' H Bull ', style=shape.labelup, location=location.absolute, color=bullColor, textcolor=textColor)
- //------------------------------------------------------------------------------
- // Regular Bearish
- // Osc: Lower High
- oscLH = osc[lbR] < ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])
- // Price: Higher High
- priceHH = high[lbR] > ta.valuewhen(phFound, high[lbR], 1)
- bearCond = plotBear and priceHH and oscLH and phFound
- plot(phFound ? osc[lbR] * scaleRSI : na, offset=-lbR, title='Regular Bearish', linewidth=2, color=bearCond ? bearColor : noneColor)
- plotshape(bearCond ? osc[lbR] * scaleRSI : na, offset=-lbR, title='Regular Bearish Label', text=' Bear ', style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=textColor)
- //------------------------------------------------------------------------------
- // Hidden Bearish
- // Osc: Higher High
- oscHH = osc[lbR] > ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])
- // Price: Lower High
- priceLH = high[lbR] < ta.valuewhen(phFound, high[lbR], 1)
- hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound
- plot(phFound ? osc[lbR] * scaleRSI : na, offset=-lbR, title='Hidden Bearish', linewidth=2, color=hiddenBearCond ? hiddenBearColor : noneColor)
- plotshape(hiddenBearCond ? osc[lbR] * scaleRSI : na, offset=-lbR, title='Hidden Bearish Label', text=' H Bear ', style=shape.labeldown, location=location.absolute, color=bearColor, textcolor=textColor)
Advertisement
Add Comment
Please, Sign In to add comment