本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © OskarGallard
//@version=4
study("Matrix Series and Vix Fix with VWAP CCI and QQE Signals", shorttitle="Matrix", precision=1)
//____________________________________________________________
// Based on "Matrix Series" - Author: @glaz
// https://es.tradingview.com/script/2X2cVLhb-Matrix-Series/
//____________________________________________________________
nn = input(5, "Smoother")
//--Sup/Res Detail
SupResPeriod = input(50)
SupResPercentage = input(100)
PricePeriod = input(16)
ob = input(200, "Overbought")
os = input(-200, "Oversold")
OBOS = input(false, "Show OB/OS")
dynamic = input(true, "Dynamic zones")
ys1 = (high + low + close * 2) / 4
rk3 = ema(ys1, nn)
rk4 = stdev(ys1, nn)
rk5 = (ys1 - rk3) * 200 / rk4
rk6 = ema(rk5, nn)
up = ema(rk6, nn)
down = ema(up, nn)
Oo = iff(up < down, up, down)
Hh = Oo
Ll = iff(up < down, down, up)
Cc = Ll
coral = #FF8080
lavender = #8080FF
amber = color.new(#FFCC00, 50)
vcolor = Oo > Cc ? coral : up > down ? lavender : coral
plotcandle(Oo, Hh, Ll, Cc, title = "Matrix Candle", color = vcolor)
//-------S/R Zones------
Lookback = SupResPeriod
PerCent = SupResPercentage
Pds = PricePeriod
Value1 = cci(close, Pds)
Value2 = highest(Value1, Lookback)
Value3 = lowest(Value1, Lookback)
Value4 = Value2 - Value3
Value5 = Value4 * (PerCent / 100)
ResistanceLine = Value3 + Value5
SupportLine = Value2 - Value5
plot(dynamic ? ResistanceLine : na, title = "Resistance Line", color = coral, transp=0)
plot(dynamic ? SupportLine : na, title = "Support Line", color = lavender, transp=0)
//--Overbought/Oversold/Warning Detail
h01 = highest(up, 1) + 20
h02 = highest(down, 1) + 20
l01 = lowest(down, 1) - 20
l02 = lowest(up, 1) - 20
UPshape = up > ob and up > down ? h01 : up > ob and up < down ? h02 : na
DOWNshape = down < os and up > down ? l01 : down < os and up < down ? l02 : na
plot(UPshape, title = "UP Shape", style = plot.style_circles, color = amber, linewidth = 4)
plot(DOWNshape, title = "DOWN Shape", style = plot.style_circles, color = amber, linewidth = 4)
x1 = OBOS ? ob : na
x2 = OBOS ? os : na
hline(x1)
hline(x2)
//____________________________________________________________________________________________
//"Williams Vix Fix" - Author: @ChrisMoody
// https://es.tradingview.com/script/pJpXG5JH-CM-Williams-Vix-Fix-V3-Ultimate-Filtered-Alerts/
//____________________________________________________________________________________________
shows_Vix_Fix = input(true, title="===== Show Vix Fix =====")
pd = input(22, title="LookBack Period Standard Deviation High")
bbl = input(20, title="Bolinger Band Length")
mult = input(2.0, title="Bollinger Band Standard Devaition Up", minval = 1, maxval = 5)
lb = input(50, title="Look Back Period Percentile High")
ph = input(.85, title="Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%")
swvfm = input(1.0, title="Multiplier (Suggested values 0.5 to 2)", minval = 0.5, maxval = 2)
//Williams Vix Fix Formula
wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100
sDev = mult * stdev(wvf, bbl)
midLine = sma(wvf, bbl)
upperBand = midLine + sDev
rangeHigh = (highest(wvf, lb)) * ph
color_VF = wvf >= upperBand or wvf >= rangeHigh ? color.lime : color.gray
swvfm_precent = swvfm * (ResistanceLine - SupportLine) / (2.2 * rangeHigh)
plot(shows_Vix_Fix ? wvf *-1*swvfm_precent : na, title="Williams Vix Fix", style = plot.style_columns, linewidth = 4, transp = 55, color = color_VF)
//_____________________________________________________________
// Based on "QQE signals" - Author: @colinmck
// https://es.tradingview.com/script/7R6ZxyZu-QQE-signals/
//_____________________________________________________________
shows_QQE = input(false, title="===== Show QQE Signals =====")
RSI_Period = input(14, title='RSI Length')
SF = input(5, title='RSI Smoothing')
QQE = input(4.238, title='Fast QQE Factor')
ThreshHold = input(10, title="Thresh-hold")
Wilders_Period = RSI_Period * 2 - 1
Rsi = rsi(close, RSI_Period)
RsiMa = ema(Rsi, SF)
AtrRsi = abs(RsiMa[1] - RsiMa)
MaAtrRsi = ema(AtrRsi, Wilders_Period)
dar = ema(MaAtrRsi, Wilders_Period) * QQE
longband = 0.0
shortband = 0.0
trend = 0
DeltaFastAtrRsi = dar
RSIndex = RsiMa
newshortband = RSIndex + DeltaFastAtrRsi
newlongband = RSIndex - DeltaFastAtrRsi
longband := RSIndex[1] > longband[1] and RSIndex > longband[1] ? max(longband[1], newlongband) : newlongband
shortband := RSIndex[1] < shortband[1] and RSIndex < shortband[1] ? min(shortband[1], newshortband) : newshortband
cross_1 = cross(longband[1], RSIndex)
trend := cross(RSIndex, shortband[1]) ? 1 : cross_1 ? -1 : nz(trend[1], 1)
FastAtrRsiTL = trend == 1 ? longband : shortband
// Find all the QQE Crosses
QQExlong = 0
QQExlong := nz(QQExlong[1])
QQExshort = 0
QQExshort := nz(QQExshort[1])
QQExlong := FastAtrRsiTL < RSIndex ? QQExlong + 1 : 0
QQExshort := FastAtrRsiTL > RSIndex ? QQExshort + 1 : 0
//Conditions
qqeLong = QQExlong == 1 ? FastAtrRsiTL[1] - 50 : na
qqeShort = QQExshort == 1 ? FastAtrRsiTL[1] - 50 : na
// Plotting
plotshape(shows_QQE and qqeLong, title = "QQE Long", color = color.new(#80FF00, 50), style = shape.labelup, location = location.bottom, transp = 25, size = size.tiny, text="QQE", textcolor=color.white)
plotshape(shows_QQE and qqeShort, title = "QQE Short", color = color.new(#FF4000, 50), style = shape.labeldown, location = location.top, transp = 25, size = size.tiny, text="QQE", textcolor=color.white)
//___________________________________________________________________
// VWAP CCI Signals
//___________________________________________________________________
shows_VCCI = input(false, title="===== Show VWAP CCI Signals =====")
// Inputs
nro = input(14, title="Length", type=input.integer, minval = 1)
// Calculate vwap cci
cci = (vwap - sma(vwap, nro)) / (0.015 * dev(vwap, nro))
//Define long and short entry signal
long = crossover(cci, -200)
short = crossunder(cci, 200)
plotshape(shows_VCCI and long, title = "VWAP CCI Long", color = color.new(#80FF00, 50), style = shape.labelup, location = location.bottom, transp = 25, size = size.tiny, text="VCCI", textcolor=color.white)
plotshape(shows_VCCI and short, title = "VWAP CCI Short", color = color.new(#FF4000, 50), style = shape.labeldown, location = location.top, transp = 25, size = size.tiny, text="VCCI", textcolor=color.white)