I've been able to modify it a bit however I want to be able to plot 'red' and 'green' dots and/or labels when the Fast and Slow curves intersect each other.
If fast green curve goes above slow red curve then display green/long signal as a dot or label. If fast green curve goes below slow red red curve then display red/short signal as dot or label.
I've attempted to incorporate the QQE Crosses, Conditions and Plotting written by another user QQE signals by colinmck.
However when I combine the code, I get an error that script can't be compiled:
Code: Select all
Script could not be translated from: |B|QQExlong := nz(QQExlong[1]
Script 'QQE by glaz_ba copy' has been saved
Code: Select all
study("QQE ba copy")
src=close
Fast=input(2.6180)
Slow=input(4.2360)
RSI=input(13)
SF=input(5,title='Slow Factor')
WiMA(src, length) =>
MA_s=(src + nz(MA_s[1] * (length-1)))/length
MA_s
RSIndex= ema(rsi(close,RSI), SF)
//{Smoothed ATR of Smoothed RSI}
TH= iff(RSIndex[1] > RSIndex, RSIndex[1], RSIndex)
TL= iff(RSIndex[1] < RSIndex, RSIndex[1], RSIndex)
TR= TH-TL
AtrRsi= WiMA(TR, 14)
SmoothedAtrRsi= WiMA(AtrRsi, 14)
//{Fast and Slow ATR Trailing Levels}
// Fast
DeltaFastAtrRsi= SmoothedAtrRsi*Fast
newshortband_f= RSIndex + DeltaFastAtrRsi
newlongband_f= RSIndex - DeltaFastAtrRsi
longband_f=RSIndex[1] > longband_f[1] and RSIndex > longband_f[1] ? max(longband_f[1],newlongband_f):newlongband_f
shortband_f=RSIndex[1] < shortband_f[1] and RSIndex < shortband_f[1] ? min(shortband_f[1], newshortband_f):newshortband_f
trend_f=cross(RSIndex, shortband_f[1])?1:cross(longband_f[1], RSIndex)?-1:nz(trend_f[1],1)
FastAtrRsiTL = trend_f==1? longband_f: shortband_f
// Slow
DeltaSlowAtrRsi= SmoothedAtrRsi*Slow
newshortband_s= RSIndex + DeltaSlowAtrRsi
newlongband_s= RSIndex - DeltaSlowAtrRsi
longband_s=RSIndex[1] > longband_s[1] and RSIndex > longband_s[1] ? max(longband_s[1],newlongband_s):newlongband_s
shortband_s=RSIndex[1] < shortband_s[1] and RSIndex < shortband_s[1] ? min(shortband_s[1], newshortband_s):newshortband_s
trend_s=cross(RSIndex, shortband_s[1])?1:cross(longband_s[1], RSIndex)?-1:nz(trend_s[1],1)
SlowAtrRsiTL= trend_s==1? longband_s: shortband_s
// Find all the QQE Crosses
QQExlong = 0
QQExlong := nz(QQExlong[1])
QQExshort = 1
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(qqeLong, title="QQE long", text="L", textcolor=white, style=shape.triangleup, location=location.belowbar, color=green, transp=0, size=size.tiny)
plotshape(qqeShort, title="QQE short", text="S", textcolor=white, style=shape.triangledown, location=location.abovebar, color=red, transp=0, size=size.tiny)
//
plot(RSIndex,title="RSIndex",color=#7E57C2)
plot(FastAtrRsiTL,title="FastAtrRSI",color=green)
plot(SlowAtrRsiTL,title="SlowAtrRSI",color=red)
band1 = hline(70, "Upper Band", color=#D3D3D3)
bandm = hline(50, "Middle Band", color=#787B86)
band0 = hline(30, "Lower Band", color=#D3D3D3)
fill(band1, band0, color=#F5F5F5, title="Background")