Professional Documents
Culture Documents
// This source code is subject to the terms of the Mozilla Public License 2.0 at
https://mozilla.org/MPL/2.0/
// © colinmck
src = close
Wilders_Period = RSI_Period * 2 - 1
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
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
// Plotting
//@version=4
// srflip2011
source = close
TITLE = input(false, title="Turn on Alerts & Enable Background Color options are
based on EMA1 & EMA2 Crossovers, (This button does nothing)")
turnon2 = input(true, title="Turn on Alerts?")
turnon = input(true, title="Turn on Ema 1 & 2?")
backgroundcolor = input(false, title="Enable Background Color?")
//Ema 1 & 2
len1 = input(10, minval=1, title="EMA1")
len2 = input(21, minval=1, title="EMA2")
ema1 = ema(source, len1)
ema2 = ema(source,len2)
//Ema 3
turnon3 = input(false, title="Turn on EMA3?")
len3 = input(5, minval=1, title="EMA3")
ema3 = ema(source, len3)
plot(turnon3 ? ema3 : na, "Ema 3", style=plot.style_line, linewidth=2,
color=color.blue)
//Ema 4
turnon4 = input(false, title="Turn on EMA4")
len4 = input(8, minval=1, title="EMA4")
ema4 = ema(source, len4)
plot(turnon4 ? ema4 : na, "Ema 4", style=plot.style_line, linewidth=2,
color=color.orange)
//Ema 5
turnon5 = input(false, title="Turn on EMA5?")
len5 = input(34, minval=1, title="EMA5")
ema5 = ema(source, len5)
plot(turnon5 ? ema5 : na, "Ema 5", style=plot.style_line, linewidth=2,
color=color.yellow)
//Ema 6
turnon6 = input(false, title="Turn on EMA6?")
len6 = input(55, minval=1, title="EMA6")
ema6 = ema(source, len6)
plot(turnon6 ? ema6 : na, "Ema 6", style=plot.style_line, linewidth=2,
color=color.purple)
//Ema 7
turnon7 = input(false, title="Turn on EMA7?")
len7 = input(89, minval=1, title="EMA7")
ema7 = ema(source, len7)
plot(turnon7 ? ema7 : na, "Ema 7", style=plot.style_line, linewidth=2,
color=color.fuchsia)
//Ema 8
turnon8 = input(false, title="Turn on EMA8?")
len8 = input(144, minval=1, title="EMA8")
ema8 = ema(source, len8)
plot(turnon8 ? ema8 : na, "Ema 8", style=plot.style_line, linewidth=2,
color=color.teal)
// Ema 9
turnon9 = input(false, title="Turn on EMA9?")
len9 = input(200, minval=1, title="EMA9")
ema9 = ema(source, len9)
plot(turnon9 ? ema9 : na, "Ema 9", style=plot.style_line, linewidth=2,
color=color.aqua)
// Ema Cross
mylong = crossover(ema1, ema2)
myshort = crossunder(ema1, ema2)
// Calculations
last_long = float(na)
last_short = float(na)
last_long := mylong ? time : nz(last_long[1])
last_short := myshort ? time : nz(last_short[1])
condlongx = in_long
condlong = crossover(condlongx, 1.9)
condlongclose = crossunder(condlongx, 1.9)
condshortx = in_short
condshort = crossover(condshortx, 1.9)
condshortclose = crossover(condshortx, 1.9)
// Color Fill
fcolor = first > sec ? #0aff68 : first < sec ? #ff0a5a : #cccccc
// Ema Output
F1 = plot(turnon ? first : na, color=fcolor ,linewidth=2)
S2 = plot(turnon ? sec : na, color=fcolor, linewidth=2)
fill(F1, S2, title="Channel Fill", color=fcolor, transp=60)
// Plots
plotshape(turnon2 ? condlong : na, title="Breakout", color=#112f16,
location=location.belowbar, style=shape.labelup, text="Breakout",
textcolor=color.white, transp=0, size=size.small, offset=1)
plotshape(turnon2 ? condshort : na, title="Breakdown", color=#9d0d0d,
style=shape.labeldown, text="Breakdown", textcolor=color.white, transp=0,
size=size.small, offset=1)
// Background Color
bgcolor(backgroundcolor ? fcolor : na, transp=67)