0% found this document useful (0 votes)
37 views25 pages

Future Algos

The document is a Pine Script code for a trading indicator called 'future ALGOs [fuAlgo]', which includes various user-configurable settings for buy/sell signals, trend ribbons, reversal signals, and dashboards. It features functions for calculating order blocks, smoothing ranges, and detecting bullish/bearish conditions based on price movements and volume. The script aims to assist traders in making informed decisions by visualizing market trends and signals.

Uploaded by

fcgh383
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views25 pages

Future Algos

The document is a Pine Script code for a trading indicator called 'future ALGOs [fuAlgo]', which includes various user-configurable settings for buy/sell signals, trend ribbons, reversal signals, and dashboards. It features functions for calculating order blocks, smoothing ranges, and detecting bullish/bearish conditions based on price movements and volume. The script aims to assist traders in making informed decisions by visualizing market trends and signals.

Uploaded by

fcgh383
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 25

//@version=5

indicator("future ALGOs [fuAlgo]", overlay=true, max_labels_count=500)

// Get user settings


showBuySell = input(true, "Show Buy & Sell", group="BUY & SELL SIGNALS")
sensitivity = input.float(3, "Sensitivity (1-6)", 1, 6, group="BUY & SELL
SIGNALS")
percentStop = input.float(1, "Stop Loss % (0 to Disable)", 0, group="BUY &
SELL SIGNALS")
offsetSignal = input.float(5, "Signals Offset", 0, group="BUY & SELL SIGNALS")
showRibbon = input(true, "Show Trend Ribbon", group="TREND RIBBON")
smooth1 = input.int(5, "Smoothing 1", 1, group="TREND RIBBON")
smooth2 = input.int(8, "Smoothing 2", 1, group="TREND RIBBON")
showReversal = input(true, "Show Reversals", group="REVERSAL SIGNALS")
showPdHlc = input(false, "Show P.D H/L/C", group="PREVIOUS DAY HIGH LOW
CLOSE")
lineColor = input.color(color.yellow, "Line Colors", group="PREVIOUS DAY
HIGH LOW CLOSE")
lineWidth = input.int(1, "Width Lines", group="PREVIOUS DAY HIGH LOW
CLOSE")
lineStyle = input.string("Solid", "Line Style", ["Solid", "Dashed",
"Dotted"])
labelSize = input.string("normal", "Label Text Size", ["small", "normal",
"large"])
labelColor = input.color(color.yellow, "Label Text Colors")
showEmas = input(false, "Show EMAs", group="EMA")
srcEma1 = input(close, "Source EMA 1")
lenEma1 = input.int(7, "Length EMA 1", 1)
srcEma2 = input(close, "Source EMA 2")
lenEma2 = input.int(21, "Length EMA 2", 1)
srcEma3 = input(close, "Source EMA 3")
lenEma3 = input.int(144, "Length EMA 3", 1)
showSwing = input(false, "Show Swing Points", group="SWING POINTS")
prdSwing = input.int(10, "Swing Point Period", 2, group="SWING POINTS")
colorPos = input(color.new(color.green, 50), "Positive Swing Color")
colorNeg = input(color.new(color.red, 50), "Negative Swing Color")
showDashboard = input(true, "Show Dashboard", group="TREND DASHBOARD")
locationDashboard = input.string("Middle Right", "Table Location", ["Top Right",
"Middle Right", "Bottom Right", "Top Center", "Middle Center", "Bottom Center",
"Top Left", "Middle Left", "Bottom Left"], group="TREND DASHBOARD")
tableTextColor = input(color.white, "Table Text Color", group="TREND DASHBOARD")
tableBgColor = input(#2A2A2A, "Table Background Color", group="TREND
DASHBOARD")
sizeDashboard = input.string("Normal", "Table Size", ["Large", "Normal",
"Small", "Tiny"], group="TREND DASHBOARD")
showRevBands = input.bool(true, "Show Reversal Bands", group="REVERSAL BANDS")
lenRevBands = input.int(30, "Length", group="REVERSAL BANDS")
//Settings
//-----------------------------------------------------------------------------{
length = input.int(5, 'Volume Pivot Length'
, minval = 1)

bull_ext_last = input.int(3, 'Bullish OB '


, minval = 1
, inline = 'bull')

bg_bull_css = input.color(color.new(#169400, 80), ''


, inline = 'bull')
bull_css = input.color(#169400, ''
, inline = 'bull')

bull_avg_css = input.color(color.new(#9598a1, 37), ''


, inline = 'bull')

bear_ext_last = input.int(3, 'Bearish OB'


, minval = 1
, inline = 'bear')

bg_bear_css = input.color(color.new(#ff1100, 80), ''


, inline = 'bear')

bear_css = input.color(#ff1100, ''


, inline = 'bear')

bear_avg_css = input.color(color.new(#9598a1, 37), ''


, inline = 'bear')

line_style = input.string('???', 'Average Line Style'


, options = ['???', '----', '����'])

line_width = input.int(1, 'Average Line Width'


, minval = 1)

mitigation = input.string('Wick', 'Mitigation Methods'


, options = ['Wick', 'Close'])

//-----------------------------------------------------------------------------}
//Functions
//-----------------------------------------------------------------------------{
//Line Style function
get_line_style(style) =>
out = switch style
'???' => line.style_solid
'----' => line.style_dashed
'����' => line.style_dotted

//Function to get order block coordinates


get_coordinates(condition, top, btm, ob_val)=>
var ob_top = array.new_float(0)
var ob_btm = array.new_float(0)
var ob_avg = array.new_float(0)
var ob_left = array.new_int(0)

float ob = na

//Append coordinates to arrays


if condition
avg = math.avg(top, btm)

array.unshift(ob_top, top)
array.unshift(ob_btm, btm)
array.unshift(ob_avg, avg)
array.unshift(ob_left, time[length])

ob := ob_val

[ob_top, ob_btm, ob_avg, ob_left, ob]


//Function to remove mitigated order blocks from coordinate arrays
remove_mitigated(ob_top, ob_btm, ob_left, ob_avg, target, bull)=>
mitigated = false
target_array = bull ? ob_btm : ob_top

for element in target_array


idx = array.indexof(target_array, element)

if (bull ? target < element : target > element)


mitigated := true

array.remove(ob_top, idx)
array.remove(ob_btm, idx)
array.remove(ob_avg, idx)
array.remove(ob_left, idx)

mitigated

//Function to set order blocks


set_order_blocks(ob_top, ob_btm, ob_left, ob_avg, ext_last, bg_css, border_css,
lvl_css)=>
var ob_box = array.new_box(0)
var ob_lvl = array.new_line(0)

//Fill arrays with boxes/lines


if barstate.isfirst
for i = 0 to ext_last-1
array.unshift(ob_box, box.new(na,na,na,na
, xloc = xloc.bar_time
, extend= extend.right
, bgcolor = bg_css
, border_color = color.new(border_css, 70)))

array.unshift(ob_lvl, line.new(na,na,na,na
, xloc = xloc.bar_time
, extend = extend.right
, color = lvl_css
, style = get_line_style(line_style)
, width = line_width))

//Set order blocks


if barstate.islast
if array.size(ob_top) > 0
for i = 0 to math.min(ext_last-1, array.size(ob_top)-1)
get_box = array.get(ob_box, i)
get_lvl = array.get(ob_lvl, i)

box.set_lefttop(get_box, array.get(ob_left, i), array.get(ob_top,


i))
box.set_rightbottom(get_box, array.get(ob_left, i),
array.get(ob_btm, i))

line.set_xy1(get_lvl, array.get(ob_left, i), array.get(ob_avg, i))


line.set_xy2(get_lvl, array.get(ob_left, i)+1, array.get(ob_avg,
i))

//-----------------------------------------------------------------------------}
//Global elements
//-----------------------------------------------------------------------------{
var os = 0
var target_bull = 0.
var target_bear = 0.

n = bar_index
upper = ta.highest(length)
lower = ta.lowest(length)

if mitigation == 'Close'
target_bull := ta.lowest(close, length)
target_bear := ta.highest(close, length)
else
target_bull := lower
target_bear := upper

os := high[length] > upper ? 0 : low[length] < lower ? 1 : os[1]

phv = ta.pivothigh(volume, length, length)

//-----------------------------------------------------------------------------}
//Get bullish/bearish order blocks coordinates
//-----------------------------------------------------------------------------{
[bull_top
, bull_btm
, bull_avg
, bull_left
, bull_ob] = get_coordinates(phv and os == 1, hl2[length], low[length],
low[length])

[bear_top
, bear_btm
, bear_avg
, bear_left
, bear_ob] = get_coordinates(phv and os == 0, high[length], hl2[length],
high[length])

//-----------------------------------------------------------------------------}
//Remove mitigated order blocks
//-----------------------------------------------------------------------------{
mitigated_bull = remove_mitigated(bull_top
, bull_btm
, bull_left
, bull_avg
, target_bull
, true)

mitigated_bear = remove_mitigated(bear_top
, bear_btm
, bear_left
, bear_avg
, target_bear
, false)

//-----------------------------------------------------------------------------}
//Display order blocks
//-----------------------------------------------------------------------------{
//Set bullish order blocks
set_order_blocks(bull_top
, bull_btm
, bull_left
, bull_avg
, bull_ext_last
, bg_bull_css
, bull_css
, bull_avg_css)

//Set bearish order blocks


set_order_blocks(bear_top
, bear_btm
, bear_left
, bear_avg
, bear_ext_last
, bg_bear_css
, bear_css
, bear_avg_css)

//Show detected order blocks


plot(bull_ob, 'Bull OB', bull_css, 2, plot.style_linebr
, offset = -length
, display = display.none)

plot(bear_ob, 'Bear OB', bear_css, 2, plot.style_linebr


, offset = -length
, display = display.none)
// Functions
smoothrng(x, t, m) =>
wper = t * 2 - 1
avrng = ta.ema(math.abs(x - x[1]), t)
smoothrng = ta.ema(avrng, wper) * m
rngfilt(x, r) =>
rngfilt = x
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
percWidth(len, perc) => (ta.highest(len) - ta.lowest(len)) * perc / 100
securityNoRep(sym, res, src) => request.security(sym, res, src, barmerge.gaps_off,
barmerge.lookahead_on)
swingPoints(prd) =>
pivHi = ta.pivothigh(prd, prd)
pivLo = ta.pivotlow (prd, prd)
last_pivHi = ta.valuewhen(pivHi, pivHi, 1)
last_pivLo = ta.valuewhen(pivLo, pivLo, 1)
hh = pivHi and pivHi > last_pivHi ? pivHi : na
lh = pivHi and pivHi < last_pivHi ? pivHi : na
hl = pivLo and pivLo > last_pivLo ? pivLo : na
ll = pivLo and pivLo < last_pivLo ? pivLo : na
[hh, lh, hl, ll]
f_chartTfInMinutes() =>
float _resInMinutes = timeframe.multiplier * (
timeframe.isseconds ? 1 :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 60. * 24 :
timeframe.isweekly ? 60. * 24 * 7 :
timeframe.ismonthly ? 60. * 24 * 30.4375 : na)
f_kc(src, len, sensitivity) =>
basis = ta.sma(src, len)
span = ta.atr(len)
[basis + span * sensitivity, basis - span * sensitivity]
wavetrend(src, chlLen, avgLen) =>
esa = ta.ema(src, chlLen)
d = ta.ema(math.abs(src - esa), chlLen)
ci = (src - esa) / (0.015 * d)
wt1 = ta.ema(ci, avgLen)
wt2 = ta.sma(wt1, 3)
[wt1, wt2]
f_top_fractal(src) => src[4] < src[2] and src[3] < src[2] and src[2] > src[1] and
src[2] > src[0]
f_bot_fractal(src) => src[4] > src[2] and src[3] > src[2] and src[2] < src[1] and
src[2] < src[0]
f_fractalize (src) => f_top_fractal(src) ? 1 : f_bot_fractal(src) ? -1 : 0
f_findDivs(src, topLimit, botLimit) =>
fractalTop = f_fractalize(src) > 0 and src[2] >= topLimit ? src[2] : na
fractalBot = f_fractalize(src) < 0 and src[2] <= botLimit ? src[2] : na
highPrev = ta.valuewhen(fractalTop, src[2], 0)[2]
highPrice = ta.valuewhen(fractalTop, high[2], 0)[2]
lowPrev = ta.valuewhen(fractalBot, src[2], 0)[2]
lowPrice = ta.valuewhen(fractalBot, low[2], 0)[2]
bearSignal = fractalTop and high[2] > highPrice and src[2] < highPrev
bullSignal = fractalBot and low[2] < lowPrice and src[2] > lowPrev
[bearSignal, bullSignal]
// Get components
source = close
smrng1 = smoothrng(source, 27, 1.5)
smrng2 = smoothrng(source, 55, sensitivity)
smrng = (smrng1 + smrng2) / 2
filt = rngfilt(source, smrng)
up = 0.0, up := filt > filt[1] ? nz(up[1]) + 1 : filt < filt[1] ? 0 :
nz(up[1])
dn = 0.0, dn := filt < filt[1] ? nz(dn[1]) + 1 : filt > filt[1] ? 0 :
nz(dn[1])
bullCond = bool(na), bullCond := source > filt and source > source[1] and up > 0
or source > filt and source < source[1] and up > 0
bearCond = bool(na), bearCond := source < filt and source < source[1] and dn > 0
or source < filt and source > source[1] and dn > 0
lastCond = 0, lastCond := bullCond ? 1 : bearCond ? -1 : lastCond[1]
bull = bullCond and lastCond[1] == -1
bear = bearCond and lastCond[1] == 1
countBull = ta.barssince(bull)
countBear = ta.barssince(bear)
trigger = nz(countBull, bar_index) < nz(countBear, bar_index) ? 1 : 0
ribbon1 = ta.sma(close, smooth1)
ribbon2 = ta.sma(close, smooth2)
rsi = ta.rsi(close, 21)
rsiOb = rsi > 70 and rsi > ta.ema(rsi, 10)
rsiOs = rsi < 30 and rsi < ta.ema(rsi, 10)
dHigh = securityNoRep(syminfo.tickerid, "D", high [1])
dLow = securityNoRep(syminfo.tickerid, "D", low [1])
dClose = securityNoRep(syminfo.tickerid, "D", close[1])
ema1 = ta.ema(srcEma1, lenEma1)
ema2 = ta.ema(srcEma2, lenEma2)
ema3 = ta.ema(srcEma3, lenEma3)
[hh, lh, hl, ll] = swingPoints(prdSwing)
ema = ta.ema(close, 144)
emaBull = close > ema
equal_tf(res) => str.tonumber(res) == f_chartTfInMinutes() and not
timeframe.isseconds
higher_tf(res) => str.tonumber(res) > f_chartTfInMinutes() or timeframe.isseconds
too_small_tf(res) => (timeframe.isweekly and res=="1") or (timeframe.ismonthly and
str.tonumber(res) < 10)
securityNoRep1(sym, res, src) =>
bool bull_ = na
bull_ := equal_tf(res) ? src : bull_
bull_ := higher_tf(res) ? request.security(sym, res, src, barmerge.gaps_off,
barmerge.lookahead_on) : bull_
bull_array = request.security_lower_tf(syminfo.tickerid, higher_tf(res) ?
str.tostring(f_chartTfInMinutes()) + (timeframe.isseconds ? "S" : "") :
too_small_tf(res) ? (timeframe.isweekly ? "3" : "10") : res, src)
if array.size(bull_array) > 1 and not equal_tf(res) and not higher_tf(res)
bull_ := array.pop(bull_array)
array.clear(bull_array)
bull_
TF1Bull = securityNoRep1(syminfo.tickerid, "1" , emaBull)
TF3Bull = securityNoRep1(syminfo.tickerid, "3" , emaBull)
TF5Bull = securityNoRep1(syminfo.tickerid, "5" , emaBull)
TF15Bull = securityNoRep1(syminfo.tickerid, "15" , emaBull)
TF30Bull = securityNoRep1(syminfo.tickerid, "30" , emaBull)
TF60Bull = securityNoRep1(syminfo.tickerid, "60" , emaBull)
TF120Bull = securityNoRep1(syminfo.tickerid, "120" , emaBull)
TF240Bull = securityNoRep1(syminfo.tickerid, "240" , emaBull)
TF480Bull = securityNoRep1(syminfo.tickerid, "480" , emaBull)
TFDBull = securityNoRep1(syminfo.tickerid, "1440", emaBull)
[upperKC1, lowerKC1] = f_kc(close, lenRevBands, 3)
[upperKC2, lowerKC2] = f_kc(close, lenRevBands, 4)
[upperKC3, lowerKC3] = f_kc(close, lenRevBands, 5)
[upperKC4, lowerKC4] = f_kc(close, lenRevBands, 6)
[wt1, wt2] = wavetrend(hlc3, 9, 12)
[wtDivBear1, wtDivBull1] = f_findDivs(wt2, 15, -40)
[wtDivBear2, wtDivBull2] = f_findDivs(wt2, 45, -65)
wtDivBull = wtDivBull1 or wtDivBull2
wtDivBear = wtDivBear1 or wtDivBear2
// Colors
cyan = #00DBFF, cyan30 = color.new(cyan, 70)
pink = #E91E63, pink30 = color.new(pink, 70)
red = #FF5252, red30 = color.new(red , 70)
// Plot
off = percWidth(300, offsetSignal)
plotshape(showBuySell and bull ? low - off : na, "Buy Label" , shape.labelup ,
location.absolute, cyan, 0, "Buy" , color.white, size=size.normal)
plotshape(showBuySell and bear ? high + off : na, "Sell Label", shape.labeldown,
location.absolute, pink, 0, "Sell", color.white, size=size.normal)
plotshape(ta.crossover(wt1, wt2) and wt2 <= -53, "Mild Buy" , shape.xcross,
location.belowbar, cyan, size=size.tiny)
plotshape(ta.crossunder(wt1, wt2) and wt2 >= 53, "Mild Sell", shape.xcross,
location.abovebar, pink, size=size.tiny)
plotshape(wtDivBull, "Divergence Buy ", shape.triangleup , location.belowbar,
cyan, size=size.tiny)
plotshape(wtDivBear, "Divergence Sell", shape.triangledown, location.abovebar,
pink, size=size.tiny)
barcolor(up > dn ? cyan : pink)
plotshape(showReversal and rsiOs, "Reversal Buy" , shape.diamond,
location.belowbar, cyan30, size=size.tiny)
plotshape(showReversal and rsiOb, "Reversal Sell", shape.diamond,
location.abovebar, pink30, size=size.tiny)
lStyle = lineStyle == "Solid" ? line.style_solid : lineStyle == "Dotted" ?
line.style_dotted : line.style_dashed
lSize = labelSize == "small" ? size.small : labelSize == "normal" ?
size.normal : size.large
dHighLine = showPdHlc ? line.new(bar_index, dHigh, bar_index + 1, dHigh ,
xloc.bar_index, extend.both, lineColor, lStyle, lineWidth) : na,
line.delete(dHighLine[1])
dLowLine = showPdHlc ? line.new(bar_index, dLow , bar_index + 1, dLow ,
xloc.bar_index, extend.both, lineColor, lStyle, lineWidth) : na,
line.delete(dLowLine[1])
dCloseLine = showPdHlc ? line.new(bar_index, dClose, bar_index + 1, dClose,
xloc.bar_index, extend.both, lineColor, lStyle, lineWidth) : na,
line.delete(dCloseLine[1])
dHighLabel = showPdHlc ? label.new(bar_index + 100, dHigh , "P.D.H",
xloc.bar_index, yloc.price, #000000, label.style_none, labelColor, lSize) : na,
label.delete(dHighLabel[1])
dLowLabel = showPdHlc ? label.new(bar_index + 100, dLow , "P.D.L",
xloc.bar_index, yloc.price, #000000, label.style_none, labelColor, lSize) : na,
label.delete(dLowLabel[1])
dCloseLabel = showPdHlc ? label.new(bar_index + 100, dClose, "P.D.C",
xloc.bar_index, yloc.price, #000000, label.style_none, labelColor, lSize) : na,
label.delete(dCloseLabel[1])
plot(showEmas ? ema1 : na, "EMA 1", color.green , 2)
plot(showEmas ? ema2 : na, "EMA 2", color.purple, 2)
plot(showEmas ? ema3 : na, "EMA 3", color.yellow, 2)
plotshape(showSwing ? hh : na, "", shape.triangledown, location.abovebar,
color.new(color.green, 50), -prdSwing, "HH", colorPos, false)
plotshape(showSwing ? hl : na, "", shape.triangleup , location.belowbar,
color.new(color.green, 50), -prdSwing, "HL", colorPos, false)
plotshape(showSwing ? lh : na, "", shape.triangledown, location.abovebar,
color.new(color.red , 50), -prdSwing, "LH", colorNeg, false)
plotshape(showSwing ? ll : na, "", shape.triangleup , location.belowbar,
color.new(color.red , 50), -prdSwing, "LL", colorNeg, false)
srcStop = close
atrBand = srcStop * (percentStop / 100)
atrStop = trigger ? srcStop - atrBand : srcStop + atrBand
lastTrade(src) => ta.valuewhen(bull or bear, src, 0)
entry_y = lastTrade(srcStop)
stop_y = lastTrade(atrStop)
tp1_y = (entry_y - lastTrade(atrStop)) * 1 + entry_y
tp2_y = (entry_y - lastTrade(atrStop)) * 2 + entry_y
tp3_y = (entry_y - lastTrade(atrStop)) * 3 + entry_y
labelTpSl(y, txt, color) =>
label labelTpSl = percentStop != 0 ? label.new(bar_index + 1, y, txt,
xloc.bar_index, yloc.price, color, label.style_label_left, color.white,
size.normal) : na
label.delete(labelTpSl[1])
labelTpSl(entry_y, "Entry: " + str.tostring(math.round_to_mintick(entry_y)),
color.gray)
labelTpSl(stop_y , "Stop Loss: " + str.tostring(math.round_to_mintick(stop_y)),
color.red)
labelTpSl(tp1_y, "Take Profit 1: " + str.tostring(math.round_to_mintick(tp1_y)),
color.green)
labelTpSl(tp2_y, "Take Profit 2: " + str.tostring(math.round_to_mintick(tp2_y)),
color.green)
labelTpSl(tp3_y, "Take Profit 3: " + str.tostring(math.round_to_mintick(tp3_y)),
color.green)
lineTpSl(y, color) =>
line lineTpSl = percentStop != 0 ? line.new(bar_index - (trigger ? countBull :
countBear) + 4, y, bar_index + 1, y, xloc.bar_index, extend.none, color,
line.style_solid) : na
line.delete(lineTpSl[1])
lineTpSl(entry_y, color.gray)
lineTpSl(stop_y, color.red)
lineTpSl(tp1_y, color.green)
lineTpSl(tp2_y, color.green)
lineTpSl(tp3_y, color.green)
max = 160 //Maximum Length
min = 10 //Minimum Length

// Input setting page start


dash_loc = input.session("Bottom Right","Dashboard Posision" ,["Top
Right","Bottom Right","Top Left","Bottom Left", "Middle Right","Bottom Center"],
group='Style Settings')
text_size = input.session('Small',"Dashboard
Size" ,options=["Tiny","Small","Normal","Large"] ,group='Style Settings')
cell_up = input.color(color.green,'Up Cell Color' ,group='Style Settings')
cell_dn = input.color(color.red,'Down Cell Color' ,group='Style Settings')
cell_Neut = input.color(color.gray,'Nochange Cell Color' ,group='Style
Settings')
row_col = color.blue
col_col = color.white
txt_col = color.white
cell_transp = input.int(60,'Cell
Transparency' ,minval=0 ,maxval=100 ,group='Style Settings')

Header_col = color.rgb(35, 94, 255)


//MACDV color
cell_MACDV1 = input.color(color.teal,'Continue/Reversal ', group='MACD
COLOR')
cell_MACDV2 = input.color(color.green,'Buy G0 ', group='MACD COLOR')
cell_MACDV3 = input.color(color.red,'Buy Retest ', group='MACD COLOR')
cell_MACDV4 = input.color(color.rgb(194, 179, 47),'Sideway ', group='MACD
COLOR')
cell_MACDV5 = input.color(color.green,'Short go', group='MACD COLOR')
cell_MACDV6 = input.color(color.red,'Short Retest ' , group='MACD COLOR')
cell_MACDV7 = input.color(color.rgb(204, 8, 24),'Wait Continue/Reversal ',
group='MACD COLOR')
//Momentum color
cell_phase1 = input.color(color.green,'Phase1:Accumulation', group='Momentum')
cell_phase2 = input.color(color.teal,'Phase2:Runing' , group='Momentum')
cell_phase3 = input.color(color.red,'Phase3:Re-Accumulation' ,
group='Momentum')
cell_phase4 = input.color(color.red,'Phase4:Distribution' , group='Momentum')
cell_phase5 = input.color(color.orange,'Phase5:Bearish' , group='Momentum')
cell_phase6 = input.color(color.green,'Phase6:Rev/Continue' ,
group='Momentum')
// ---- Table Settings End ----}//

// ---- Indicators Show/Hide Settings Start ----//

showCls = input.bool(defval=true, title="Show Price Close", group="Colum


On/Off")
showMA01 = input.bool(defval=true, title="Show MA01", group="Colum
On/Off")
showMA02 = input.bool(defval=true, title="Show MA02", group="Colum
On/Off")
showMACross = input.bool(defval=true, title="Show Trend", group="Colum
On/Off")
showRSI = input.bool(defval=true, title="Show RSI ", group="Colum
On/Off")
showMACDV = input.bool(defval=true, title="Show MACDV", group="Colum
On/Off")
showSignalV = input.bool(defval=true, title="Show SignalV", group="Colum
On/Off")
showMACDV_Status = input.bool(defval=true, title="Show Condition", group="Colum
On/Off")
showmomentum = input.bool(defval=true, title="Show Momentum", group="Colum
On/Off")

//---- MACD-V code start ----//


MACD_fast_length = input(title="MACD-V Fast", defval=14, group="MACD-V
Settings")
MACD_slow_length = input(title="MACD-V Slow", defval=26, group="MACD-V
Settings")
MACD_signal_length = input.int(title="MACD-V Signal ", minval = 1, maxval = 50,
defval = 9, group="MACD-V Settings")
MACD_atr_length = input(title="ATR", defval=26, group="MACD-V Settings")

// ---- Indicators Show/Hide Settings end ----}//

// ==================
// ==== Settings ====
// ==================

//------Seting Color Calender Economi------

color1 = color.red
color2 = color.orange
color3 = color.yellow
color4 = color.lime
color5 = color.aqua
color6 = color.fuchsia
color7 = color.silver

show_fomc_meetings = input.bool(defval = false, title = "?? FOMC", inline = "FOMC",


group="?? Settings", tooltip="The FOMC meets eight times a year to determine the
course of monetary policy. The FOMC's decisions are announced in a press release at
2:15 p.m. ET on the day of the meeting. The press release is followed by a press
conference at 2:30 p.m. ET. The FOMC's decisions are based on a review of economic
and financial developments and its assessment of the likely effects of these
developments on the economic outlook.")
c_fomcMeeting = input.color(color.new(color1, 50), title = "Color", group="??
Settings", inline = "FOMC")

show_fomc_minutes = input.bool(defval = false, title = "?? FOMC Minutes", inline =


"FOMCMinutes", group="?? Settings", tooltip="The FOMC minutes are released three
weeks after each FOMC meeting. The minutes provide a detailed account of the FOMC's
discussion of economic and financial developments and its assessment of the likely
effects of these developments on the economic outlook.")
c_fomcMinutes = input.color(color.new(color2, 50), title = "Color", group="??
Settings", inline = "FOMCMinutes")

show_ppi = input.bool(defval = false, title = "?? Producer Price Index (PPI)",


inline = "PPI", group="?? Settings", tooltip="The Producer Price Index (PPI)
measures changes in the price level of goods and services sold by domestic
producers. The PPI is a weighted average of prices of a basket of goods and
services, such as transportation, food, and medical care. The PPI is a leading
indicator of CPI.")
c_ppi = input.color(color.new(color3, 50), title = "Color", group="?? Settings",
inline = "PPI")

show_cpi = input.bool(defval = false, title = "?? Consumer Price Index (CPI)",


inline = "CPI", group="?? Settings", tooltip="The Consumer Price Index (CPI)
measures changes in the price level of goods and services purchased by households.
The CPI is a weighted average of prices of a basket of consumer goods and services,
such as transportation, food, and medical care. The CPI-U is the most widely used
measure of inflation. The CPI-U is based on a sample of about 87,000 households and
measures the change in the cost of a fixed market basket of goods and services
purchased by urban consumers.")
c_cpi = input.color(color.new(color4, 50), title = "Color", group="?? Settings",
inline = "CPI")

show_csi = input.bool(defval = false, title = "?? Consumer Sentiment Index (CSI)",


inline = "CSI", group="?? Settings", tooltip="The University of Michigan's Consumer
Sentiment Index (CSI) is a measure of consumer attitudes about the economy. The CSI
is based on a monthly survey of 500 U.S. households. The index is based on
consumers' assessment of present and future economic conditions. The CSI is a
leading indicator of consumer spending, which accounts for about two-thirds of U.S.
economic activity.")
c_csi = input.color(color.new(color5, 50), title = "Color", group="?? Settings",
inline = "CSI")

show_cci = input.bool(defval = false, title = "?? Consumer Confidence Index (CCI)",


inline = "CCI", group="?? Settings", tooltip="The Conference Board's Consumer
Confidence Index (CCI) is a measure of consumer attitudes about the economy. The
CCI is based on a monthly survey of 5,000 U.S. households. The index is based on
consumers' assessment of present and future economic conditions. The CCI is a
leading indicator of consumer spending, which accounts for about two-thirds of U.S.
economic activity.")
c_cci = input.color(color.new(color6, 50), title = "Color", group="?? Settings",
inline = "CCI")

show_nfp = input.bool(defval = false, title = "?? Non-Farm Payroll (NFP)", inline =


"NFP", group="?? Settings", tooltip="The Non-Farm Payroll (NFP) is a measure of the
change in the number of employed persons, excluding farm workers and government
employees. The NFP is a leading indicator of consumer spending, which accounts for
about two-thirds of U.S. economic activity.")
c_nfp = input.color(color.new(color7, 50), title = "Color", group="?? Settings",
inline = "NFP")

show_legend = input.bool(true, "Show Legend", group="?? Settings", inline =


"Legend", tooltip="Show the color legend for the economic calendar events.")

// =======================
// ==== Dates & Times ====
// =======================

getUnixTime(_eventArr, _index) =>


switch
timeframe.isdaily => array.get(_eventArr, _index) -
timeframe.multiplier*86400000 // -n day(s)
timeframe.isweekly => array.get(_eventArr, _index) -
timeframe.multiplier*604800000 // -n week(s)
timeframe.ismonthly => array.get(_eventArr, _index) -
timeframe.multiplier*2592000000 // -n month(s)
timeframe.isminutes and timeframe.multiplier > 59 => array.get(_eventArr,
_index) - timeframe.multiplier*60000 // -n minute(s)
=> array.get(_eventArr, _index)

if barstate.islastconfirmedhistory

// ================
// ==== Legend ====
// ================
var tbl = table.new(position.top_right, columns=8, rows=8, frame_color=#151715,
frame_width=1, border_width=2, border_color=color.new(color.black, 100))
units = timeframe.isminutes ? "m" : ""
table.cell(tbl, 1, 0, syminfo.ticker + ' => ' + str.tostring(timeframe.period)+
units, text_halign=text.align_center, text_color=color.gray, text_size=size.small)
table.cell(tbl, 2, 0, 'FOMC Meeting', text_halign=text.align_center,
bgcolor=color.black, text_color=color1, text_size=size.small)
table.cell(tbl, 3, 0, 'FOMC Minutes', text_halign=text.align_center,
bgcolor=color.black, text_color=color2, text_size=size.small)
table.cell(tbl, 4, 0, 'Producer Price Index (PPI)',
text_halign=text.align_center, bgcolor=color.black, text_color=color3,
text_size=size.small)
table.cell(tbl, 1, 1, 'Consumer Price Index (CPI)',
text_halign=text.align_center, bgcolor=color.black, text_color=color4,
text_size=size.small)
table.cell(tbl, 2, 1, 'Consumer Sentiment Index (CSI)',
text_halign=text.align_center, bgcolor=color.black, text_color=color5,
text_size=size.small)
table.cell(tbl, 3, 1, 'Consumer Confidence Index (CCI)',
text_halign=text.align_center, bgcolor=color.black, text_color=color6,
text_size=size.small)
table.cell(tbl, 4, 1, 'Non-Farm Payrolls (NFP)', text_halign=text.align_center,
bgcolor=color.black, text_color=color7, text_size=size.small)

// =======================
// ==== CE And ===========
// =======================

// ---- Timeframe Row Show/Hide Settings Start ----//


showTF1 = input.bool(defval=true, title="Show TF MN",
inline='indicator1',group="Rows Settings")

f_MACDV(_close) =>

//---- Indicators code Start ----//


CLS= _close[1]

//---- RSI code start ----//


rsiPeriod = 14
RSI = ta.rsi(_close, rsiPeriod)

//---- RSI code end ----//

//---- EMA 1 code start----//


length_MA1 = input.int(title="MA1",defval=50, minval=1)
MA1 = ta.ema(_close, length_MA1)
//plot(MA01, color=color.red, title="MA1")
//---- EMA 1 code end ----//

//---- EMA 2 code start---//


length_MA2 = input.int(title="MA2",defval=200, minval=1)
MA2 = ta.ema(_close, length_MA2)
//plot(MA02, color=color.blue, title="MA2")
//---- EMA 2 code end ----//

// Input seeting page end


// Calculating
fast_ma = ta.ema(_close, MACD_fast_length)
slow_ma = ta.ema(_close, MACD_slow_length)
atr = ta.atr(MACD_atr_length)
MACDV = (((fast_ma - slow_ma)/atr)*100)//[( 12 bar EMA - 26 bar EMA) /
ATR(26) ] * 100
SignalV = ta.ema(MACDV, MACD_signal_length)
//---- MACD-V code end ----//

//---- Indicators code end ----//

//-----Condition start
stringmacdv =(MACDV>150) ? "Wait Continue/Reversal" :(MACDV>50 and
MACDV<150 and MACDV>SignalV ) ? "Buy G0" :(MACDV>50 and MACDV<150 and MACDV<SignalV
) ? "Buy Retest":(MACDV<50) and (MACDV>-50) ? "Sideway" :(MACDV<-50 and MACDV>-150
and MACDV>SignalV ) ? "Short go":(MACDV<-50 and MACDV>-150 and MACDV<SignalV ) ?
"Short Retest":(MACDV<150) ? "Wait Continue/Reversal" :na
//momentum
stringmomentum =(CLS>MA1 and CLS>MA2 and MA1<MA2) ? "Accumulation:Stop Sell -
Setup Buy" :(CLS>MA1 and CLS>MA2 and MA1>MA2) ? "Runing Up: Buy Runing":(CLS<MA1
and CLS>MA2 and MA1>MA2) ? "Re-Acumulasi: Continue Up":(CLS<MA1 and CLS<MA2 and
MA1>MA2) ? "Distribution: Stop Buy-Setup Short":(CLS<MA1 and CLS<MA2 and MA1<MA2) ?
"Re-Distribusi: Continue Down":(CLS>MA1 and CLS<MA2 and MA1<MA2) ? "Accumulation-
Distribusi: Don't Trade Wait Break":na

//-----Condition end

// Return values
[CLS, MA1, MA2, RSI, MACDV, SignalV, stringmacdv, stringmomentum]

// ] -------- Alerts ----------------- [

//---- Table Position & Size code start {----//


var table_position = dash_loc == 'Bottom Right' ? position.bottom_right :
dash_loc == 'Bottom Left' ? position.bottom_left :
dash_loc == 'Middle Right' ? position.middle_right :
dash_loc == 'Bottom Center' ? position.bottom_center :
dash_loc == 'Top Left' ? position.top_right : position.bottom_right

var table_text_size = text_size == 'Normal' ? size.normal :


text_size == 'Tiny' ? size.tiny :
text_size == 'Small' ? size.small :
text_size == 'Normal' ? size.normal : size.large

var t = table.new(table_position,15,math.abs(max-min)+2,
frame_color =color.new(#f1ff2a, 0),
frame_width =1,
border_color =color.new(#f1ff2a,0),
border_width =1)
//---- Table Position & Size code end ----//

// get values for table

[CLS_chart, MA1_chart, MA2_chart, RSI_chart, MACDV_chart, SignalV_chart,


stringmacdv_chart, stringmomentum_chart] = f_MACDV(close)
[CLS_5_min, MA1_5_min, MA2_5_min, RSI_5_min, MACDV_5_min, SignalV_5_min,
stringmacdv_5_min, stringmomentum_5_min] = request.security(syminfo.tickerid, "5",
f_MACDV(close), lookahead=barmerge.lookahead_on)
[CLS_15_min, MA1_15_min, MA2_15_min, RSI_15_min, MACDV_15_min, SignalV_15_min,
stringmacdv_15_min, stringmomentum_15_min] = request.security(syminfo.tickerid,
"15", f_MACDV(close), lookahead=barmerge.lookahead_on)
[CLS_1_hour, MA1_1_hour, MA2_1_hour, RSI_1_hour, MACDV_1_hour, SignalV_1_hour,
stringmacdv_1_hour, stringmomentum_1_hour] = request.security(syminfo.tickerid,
"60", f_MACDV(close), lookahead=barmerge.lookahead_on)
[CLS_4_hour, MA1_4_hour, MA2_4_hour, RSI_4_hour, MACDV_4_hour, SignalV_4_hour,
stringmacdv_4_hour, stringmomentum_4_hour] = request.security(syminfo.tickerid,
"240", f_MACDV(close), lookahead=barmerge.lookahead_on)
[CLS_1_day, MA1_1_day, MA2_1_day, RSI_1_day, MACDV_1_day, SignalV_1_day,
stringmacdv_1_day, stringmomentum_1_day] = request.security(syminfo.tickerid, "D",
f_MACDV(close), lookahead=barmerge.lookahead_on)

//---- Table Column & Rows code start ----//


if (barstate.islast)
//---- Table Main Column Headers code start ----//

table.cell(t,1,1,'TimeFrem',text_color=col_col,text_size=table_text_size,bgcolor=He
ader_col)
if showCls

table.cell(t,2,1,'L.Close',text_color=col_col,text_size=table_text_size,bgcolor=Hea
der_col)
if showMA01

table.cell(t,3,1,'MA01',text_color=col_col,text_size=table_text_size,bgcolor=Header
_col)
if showMA02

table.cell(t,4,1,'MA02',text_color=col_col,text_size=table_text_size,bgcolor=Header
_col)
if showMACross

table.cell(t,5,1,'Trend',text_color=col_col,text_size=table_text_size,bgcolor=Heade
r_col)
if showRSI

table.cell(t,6,1,'RSI',text_color=col_col,text_size=table_text_size,bgcolor=Header_
col)
if showMACDV

table.cell(t,7,1,'MACDV',text_color=col_col,text_size=table_text_size,bgcolor=Heade
r_col)
if showSignalV

table.cell(t,8,1,'SignalV',text_color=col_col,text_size=table_text_size,bgcolor=Hea
der_col)
if showMACDV_Status

table.cell(t,9,1,'Condition',text_color=col_col,text_size=table_text_size,bgcolor=H
eader_col)
if showmomentum
table.cell(t,10,1,'Phase
Market',text_color=col_col,text_size=table_text_size,bgcolor=Header_col)

//---- Table Main Column Headers code end ----//

//---- Display data code start ----//

//---------------------- Chart period ----------------------------------

table.cell(t,1,2, "Chart",text_color=color.white,text_size=table_text_size,
bgcolor=color.rgb(0, 68, 255))
if showCls
table.cell(t,2,2, str.tostring(CLS_chart,
'#.###'),text_color=color.new(CLS_chart >CLS_chart[2] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(CLS_chart >CLS_chart[2] ?
cell_up : cell_dn ,cell_transp))
if showMA01
table.cell(t,3,2, str.tostring(MA1_chart,
'#.###'),text_color=color.new(MA1_chart >MA1_chart[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA1_chart >MA1_chart[1] ?
cell_up : cell_dn ,cell_transp))
if showMA02
table.cell(t,4,2, str.tostring(MA2_chart,
'#.###'),text_color=color.new(MA2_chart >MA2_chart[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA2_chart >MA2_chart[1] ?
cell_up : cell_dn ,cell_transp))
if showMACross
table.cell(t,5,2, MA1_chart > MA2_chart ? "Bullish" :
"Bearish",text_color=color.new(MA1_chart > MA2_chart ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA1_chart > MA2_chart ?
cell_up : cell_dn ,cell_transp))
if showRSI
table.cell(t,6,2, str.tostring(RSI_chart,
'#.###'),text_color=color.new(RSI_chart > 50 ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(RSI_chart > 50 ? cell_up :
cell_dn ,cell_transp))
if showMACDV
table.cell(t,7,2,str.tostring(MACDV_chart,
'#.###'),text_color=color.new(MACDV_chart > MACDV_chart[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MACDV_chart >
MACDV_chart[1] ? cell_up : cell_dn ,cell_transp))
if showSignalV
table.cell(t,8,2,str.tostring(SignalV_chart,
'#.###'),text_color=color.new(SignalV_chart > SignalV_chart[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(SignalV_chart>
SignalV_chart[1] ? cell_up : cell_dn ,cell_transp))
if showMACDV_Status
table.cell(t,9,2,stringmacdv_chart,text_color=color.rgb(0, 0,
0),text_size=table_text_size, bgcolor=color.new(MACDV_chart>50 ?
cell_up :MACDV_chart<-50 ? cell_dn:cell_MACDV4 ,cell_transp))
if showmomentum
table.cell(t,10,2,stringmomentum_chart,text_color=color.rgb(2, 2,
2),text_size=table_text_size, bgcolor=color.new(CLS_chart>MA1_chart and
CLS_chart>MA2_chart and MA1_chart<MA2_chart ? cell_phase1 : (CLS_chart>MA1_chart
and CLS_chart>MA2_chart and MA1_chart>MA2_chart) ? cell_phase2 :
(CLS_chart<MA1_chart and CLS_chart>MA2_chart and MA1_chart>MA2_chart) ?
cell_phase3 :(CLS_chart<MA1_chart and CLS_chart<MA2_chart and
MA1_chart>MA2_chart) ? cell_phase4:(CLS_chart<MA1_chart and CLS_chart<MA2_chart and
MA1_chart<MA2_chart) ? cell_phase5:(CLS_chart>MA1_chart and CLS_chart<MA2_chart and
MA1_chart<MA2_chart) ? cell_phase6:col_col,cell_transp))

// alert("\nRSI =(" + str.tostring(CLS_chart, '#.###') + ")\n Momentum = (" +


str.tostring(stringmomentum_chart) + ")\n Trend =("+ str.tostring(MA1_chart >
MA2_chart ? "Bullish" : "Bearish")+").", alert.freq_once_per_bar_close)

//---------------------- 5 minute chart ----------------------------------

table.cell(t,1,3, "5 minute",text_color=color.white,text_size=table_text_size,


bgcolor=color.rgb(0, 68, 255))
if showCls
table.cell(t,2,3, str.tostring(CLS_5_min,
'#.###'),text_color=color.new(CLS_5_min >CLS_5_min[2] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(CLS_5_min >CLS_5_min[2] ?
cell_up : cell_dn ,cell_transp))
if showMA01
table.cell(t,3,3, str.tostring(MA1_5_min,
'#.###'),text_color=color.new(MA1_5_min >MA1_5_min[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA1_5_min >MA1_5_min[1] ?
cell_up : cell_dn ,cell_transp))
if showMA02
table.cell(t,4,3, str.tostring(MA2_5_min,
'#.###'),text_color=color.new(MA2_5_min >MA2_5_min[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA2_5_min >MA2_5_min[1] ?
cell_up : cell_dn ,cell_transp))
if showMACross
table.cell(t,5,3, MA1_5_min > MA2_5_min ? "Bullish" :
"Bearish",text_color=color.new(MA1_5_min > MA2_5_min ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA1_5_min > MA2_5_min ?
cell_up : cell_dn ,cell_transp))
if showRSI
table.cell(t,6,3, str.tostring(RSI_5_min,
'#.###'),text_color=color.new(RSI_5_min > 50 ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(RSI_5_min > 50 ? cell_up :
cell_dn ,cell_transp))
if showMACDV
table.cell(t,7,3,str.tostring(MACDV_5_min,
'#.###'),text_color=color.new(MACDV_5_min > MACDV_5_min[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MACDV_5_min >
MACDV_5_min[1] ? cell_up : cell_dn ,cell_transp))
if showSignalV
table.cell(t,8,3,str.tostring(SignalV_5_min,
'#.###'),text_color=color.new(SignalV_5_min > SignalV_5_min[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(SignalV_5_min>
SignalV_5_min[1] ? cell_up : cell_dn ,cell_transp))
if showMACDV_Status
table.cell(t,9,3,stringmacdv_5_min,text_color=color.rgb(5, 5,
5),text_size=table_text_size, bgcolor=color.new(MACDV_5_min>50 ?
cell_up :MACDV_5_min<-50 ? cell_dn:cell_MACDV4 ,cell_transp))
if showmomentum
table.cell(t,10,3,stringmomentum_5_min,text_color=color.rgb(5, 5,
5),text_size=table_text_size, bgcolor=color.new(CLS_5_min>MA1_5_min and
CLS_5_min>MA2_5_min and MA1_5_min<MA2_5_min ? cell_phase1 : (CLS_5_min>MA1_5_min
and CLS_5_min>MA2_5_min and MA1_5_min>MA2_5_min) ? cell_phase2 :
(CLS_5_min<MA1_5_min and CLS_5_min>MA2_5_min and MA1_5_min>MA2_5_min) ?
cell_phase3 :(CLS_5_min<MA1_5_min and CLS_5_min<MA2_5_min and
MA1_5_min>MA2_5_min) ? cell_phase4:(CLS_5_min<MA1_5_min and CLS_5_min<MA2_5_min and
MA1_5_min<MA2_5_min) ? cell_phase5:(CLS_5_min>MA1_5_min and CLS_5_min<MA2_5_min and
MA1_5_min<MA2_5_min) ? cell_phase6:col_col,cell_transp))

//---------------------- 15 minute chart ----------------------------------

table.cell(t,1,4, "15 minute",text_color=color.rgb(245, 243,


243),text_size=table_text_size, bgcolor=color.rgb(0, 68, 255))
if showCls
table.cell(t,2,4, str.tostring(CLS_15_min,
'#.###'),text_color=color.new(CLS_15_min >CLS_15_min[2] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(CLS_15_min
>CLS_15_min[2] ? cell_up : cell_dn ,cell_transp))
if showMA01
table.cell(t,3,4, str.tostring(MA1_15_min,
'#.###'),text_color=color.new(MA1_15_min >MA1_15_min[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA1_15_min >MA1_15_min[1]
? cell_up : cell_dn ,cell_transp))
if showMA02
table.cell(t,4,4, str.tostring(MA2_15_min,
'#.###'),text_color=color.new(MA2_15_min >MA2_15_min[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA2_15_min
>MA2_15_min[1] ? cell_up : cell_dn ,cell_transp))
if showMACross
table.cell(t,5,4, MA1_15_min > MA2_15_min ? "Bullish" :
"Bearish",text_color=color.new(MA1_15_min > MA2_15_min ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA1_15_min > MA2_15_min ?
cell_up : cell_dn ,cell_transp))
if showRSI
table.cell(t,6,4, str.tostring(RSI_15_min,
'#.###'),text_color=color.new(RSI_15_min > 50 ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(RSI_15_min > 50 ?
cell_up : cell_dn ,cell_transp))
if showMACDV
table.cell(t,7,4,str.tostring(MACDV_15_min,
'#.###'),text_color=color.new(MACDV_15_min > MACDV_15_min[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MACDV_15_min >
MACDV_15_min[1] ? cell_up : cell_dn ,cell_transp))
if showSignalV
table.cell(t,8,4,str.tostring(SignalV_15_min,
'#.###'),text_color=color.new(SignalV_15_min > SignalV_15_min[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(SignalV_15_min>
SignalV_15_min[1] ? cell_up : cell_dn ,cell_transp))
if showMACDV_Status
table.cell(t,9,4,stringmacdv_15_min,text_color=color.rgb(7, 7,
7),text_size=table_text_size, bgcolor=color.new(MACDV_15_min>50 ?
cell_up :MACDV_15_min<-50 ? cell_dn:cell_MACDV4 ,cell_transp))
if showmomentum
table.cell(t,10,4,stringmomentum_15_min,text_color=color.rgb(7, 7,
7),text_size=table_text_size, bgcolor=color.new(CLS_15_min>MA1_15_min and
CLS_15_min>MA2_15_min and MA1_15_min<MA2_15_min ? cell_phase1 :
(CLS_15_min>MA1_15_min and CLS_15_min>MA2_15_min and MA1_15_min>MA2_15_min) ?
cell_phase2 : (CLS_15_min<MA1_15_min and CLS_15_min>MA2_15_min and
MA1_15_min>MA2_15_min) ?cell_phase3 :(CLS_15_min<MA1_15_min and
CLS_15_min<MA2_15_min and MA1_15_min>MA2_15_min) ? cell_phase4:
(CLS_15_min<MA1_15_min and CLS_15_min<MA2_15_min and MA1_15_min<MA2_15_min) ?
cell_phase5:(CLS_15_min>MA1_15_min and CLS_15_min<MA2_15_min and
MA1_15_min<MA2_15_min) ? cell_phase6:col_col,cell_transp))

//---------------------- 1 Hour chart ----------------------------------

table.cell(t,1,6, "1 Hour",text_color=color.white,text_size=table_text_size,


bgcolor=color.rgb(0, 68, 255))
if showCls
table.cell(t,2,6, str.tostring(CLS_1_hour,
'#.###'),text_color=color.new(CLS_1_hour >CLS_1_hour[2] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(CLS_1_hour
>CLS_1_hour[2] ? cell_up : cell_dn ,cell_transp))
if showMA01
table.cell(t,3,6, str.tostring(MA1_1_hour,
'#.###'),text_color=color.new(MA1_1_hour >MA1_1_hour[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA1_1_hour >MA1_1_hour[1]
? cell_up : cell_dn ,cell_transp))
if showMA02
table.cell(t,4,6, str.tostring(MA2_1_hour,
'#.###'),text_color=color.new(MA2_1_hour >MA2_1_hour[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA2_1_hour
>MA2_1_hour[1] ? cell_up : cell_dn ,cell_transp))
if showMACross
table.cell(t,5,6, MA1_1_hour > MA2_1_hour ? "Bullish" :
"Bearish",text_color=color.new(MA1_1_hour > MA2_1_hour ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA1_1_hour > MA2_1_hour ?
cell_up : cell_dn ,cell_transp))
if showRSI
table.cell(t,6,6, str.tostring(RSI_1_hour,
'#.###'),text_color=color.new(RSI_1_hour > 50 ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(RSI_1_hour > 50 ?
cell_up : cell_dn ,cell_transp))
if showMACDV
table.cell(t,7,6,str.tostring(MACDV_1_hour,
'#.###'),text_color=color.new(MACDV_1_hour > MACDV_1_hour[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MACDV_1_hour >
MACDV_1_hour[1] ? cell_up : cell_dn ,cell_transp))
if showSignalV
table.cell(t,8,6,str.tostring(SignalV_1_hour,
'#.###'),text_color=color.new(SignalV_1_hour > SignalV_1_hour[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(SignalV_1_hour>
SignalV_1_hour[1] ? cell_up : cell_dn ,cell_transp))
if showMACDV_Status
table.cell(t,9,6,stringmacdv_1_hour,text_color=color.rgb(7, 7,
7),text_size=table_text_size, bgcolor=color.new(MACDV_1_hour>50 ?
cell_up :MACDV_1_hour<-50 ? cell_dn:cell_MACDV4 ,cell_transp))
if showmomentum
table.cell(t,10,6,stringmomentum_1_hour,text_color=color.rgb(8, 8,
8),text_size=table_text_size, bgcolor=color.new(CLS_1_hour>MA1_1_hour and
CLS_1_hour>MA2_1_hour and MA1_1_hour<MA2_1_hour ? cell_phase1 :
(CLS_1_hour>MA1_1_hour and CLS_1_hour>MA2_1_hour and MA1_1_hour>MA2_1_hour) ?
cell_phase2 : (CLS_1_hour<MA1_1_hour and CLS_1_hour>MA2_1_hour and
MA1_1_hour>MA2_1_hour) ?cell_phase3 :(CLS_1_hour<MA1_1_hour and
CLS_1_hour<MA2_1_hour and MA1_1_hour>MA2_1_hour) ? cell_phase4:
(CLS_1_hour<MA1_1_hour and CLS_1_hour<MA2_1_hour and MA1_1_hour<MA2_1_hour) ?
cell_phase5:(CLS_1_hour>MA1_1_hour and CLS_1_hour<MA2_1_hour and
MA1_1_hour<MA2_1_hour) ? cell_phase6:col_col,cell_transp))

//---------------------- 4 Hour chart ----------------------------------

table.cell(t,1,7, "4 Hour",text_color=color.white,text_size=table_text_size,


bgcolor=color.rgb(0, 68, 255))
if showCls
table.cell(t,2,7, str.tostring(CLS_4_hour,
'#.###'),text_color=color.new(CLS_4_hour >CLS_4_hour[2] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(CLS_4_hour
>CLS_4_hour[2] ? cell_up : cell_dn ,cell_transp))
if showMA01
table.cell(t,3,7, str.tostring(MA1_4_hour,
'#.###'),text_color=color.new(MA1_4_hour >MA1_4_hour[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA1_4_hour >MA1_4_hour[1]
? cell_up : cell_dn ,cell_transp))
if showMA02
table.cell(t,4,7, str.tostring(MA2_4_hour,
'#.###'),text_color=color.new(MA2_4_hour >MA2_4_hour[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA2_4_hour
>MA2_4_hour[1] ? cell_up : cell_dn ,cell_transp))
if showMACross
table.cell(t,5,7, MA1_4_hour > MA2_4_hour ? "Bullish" :
"Bearish",text_color=color.new(MA1_4_hour > MA2_4_hour ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA1_4_hour > MA2_4_hour ?
cell_up : cell_dn ,cell_transp))
if showRSI
table.cell(t,6,7, str.tostring(RSI_4_hour,
'#.###'),text_color=color.new(RSI_4_hour > 50 ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(RSI_4_hour > 50 ?
cell_up : cell_dn ,cell_transp))
if showMACDV
table.cell(t,7,7,str.tostring(MACDV_4_hour,
'#.###'),text_color=color.new(MACDV_4_hour > MACDV_4_hour[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MACDV_4_hour >
MACDV_4_hour[1] ? cell_up : cell_dn ,cell_transp))
if showSignalV
table.cell(t,8,7,str.tostring(SignalV_4_hour,
'#.###'),text_color=color.new(SignalV_4_hour > SignalV_4_hour[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(SignalV_4_hour>
SignalV_4_hour[1] ? cell_up : cell_dn ,cell_transp))
if showMACDV_Status
table.cell(t,9,7,stringmacdv_4_hour,text_color=color.rgb(7, 7,
7),text_size=table_text_size, bgcolor=color.new(MACDV_4_hour>50 ?
cell_up :MACDV_4_hour<-50 ? cell_dn:cell_MACDV4 ,cell_transp))
if showmomentum
table.cell(t,10,7,stringmomentum_4_hour,text_color=color.rgb(7, 7,
7),text_size=table_text_size, bgcolor=color.new(CLS_4_hour>MA1_4_hour and
CLS_4_hour>MA2_4_hour and MA1_4_hour<MA2_4_hour ? cell_phase1 :
(CLS_4_hour>MA1_4_hour and CLS_4_hour>MA2_4_hour and MA1_4_hour>MA2_4_hour) ?
cell_phase2 : (CLS_4_hour<MA1_4_hour and CLS_4_hour>MA2_4_hour and
MA1_4_hour>MA2_4_hour) ?cell_phase3 :(CLS_4_hour<MA1_4_hour and
CLS_4_hour<MA2_4_hour and MA1_4_hour>MA2_4_hour) ? cell_phase4:
(CLS_4_hour<MA1_4_hour and CLS_4_hour<MA2_4_hour and MA1_4_hour<MA2_4_hour) ?
cell_phase5:(CLS_4_hour>MA1_4_hour and CLS_4_hour<MA2_4_hour and
MA1_4_hour<MA2_4_hour) ? cell_phase6:col_col,cell_transp))
//---------------------- 1 Day chart ----------------------------------

table.cell(t,1,9, "1 Day",text_color=color.white,text_size=table_text_size,


bgcolor=color.rgb(0, 68, 253))
if showCls
table.cell(t,2,9, str.tostring(CLS_1_day,
'#.###'),text_color=color.new(CLS_1_day >CLS_1_day[2] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(CLS_1_day >CLS_1_day[2] ?
cell_up : cell_dn ,cell_transp))
if showMA01
table.cell(t,3,9, str.tostring(MA1_1_day,
'#.###'),text_color=color.new(MA1_1_day >MA1_1_day[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA1_1_day >MA1_1_day[1] ?
cell_up : cell_dn ,cell_transp))
if showMA02
table.cell(t,4,9, str.tostring(MA2_1_day,
'#.###'),text_color=color.new(MA2_1_day >MA2_1_day[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA2_1_day >MA2_1_day[1] ?
cell_up : cell_dn ,cell_transp))
if showMACross
table.cell(t,5,9, MA1_1_day > MA2_1_day ? "Bullish" :
"Bearish",text_color=color.new(MA1_1_day > MA2_1_day ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MA1_1_day > MA2_1_day ?
cell_up : cell_dn ,cell_transp))
if showRSI
table.cell(t,6,9, str.tostring(RSI_1_day,
'#.###'),text_color=color.new(RSI_1_day > 50 ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(RSI_1_day > 50 ? cell_up :
cell_dn ,cell_transp))
if showMACDV
table.cell(t,7,9,str.tostring(MACDV_1_day,
'#.###'),text_color=color.new(MACDV_1_day > MACDV_1_day[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(MACDV_1_day >
MACDV_1_day[1] ? cell_up : cell_dn ,cell_transp))
if showSignalV
table.cell(t,8,9,str.tostring(SignalV_1_day,
'#.###'),text_color=color.new(SignalV_1_day > SignalV_1_day[1] ? cell_up :
cell_dn ,0),text_size=table_text_size, bgcolor=color.new(SignalV_1_day>
SignalV_1_day[1] ? cell_up : cell_dn ,cell_transp))
if showMACDV_Status
table.cell(t,9,9,stringmacdv_1_day,text_color=color.rgb(5, 5,
5),text_size=table_text_size, bgcolor=color.new(MACDV_1_day>50 ?
cell_up :MACDV_1_day<-50 ? cell_dn:cell_MACDV4 ,cell_transp))
if showmomentum
table.cell(t,10,9,stringmomentum_1_day,text_color=color.rgb(7, 7,
7),text_size=table_text_size, bgcolor=color.new(CLS_1_day>MA1_1_day and
CLS_1_day>MA2_1_day and MA1_1_day<MA2_1_day ? cell_phase1 : (CLS_1_day>MA1_1_day
and CLS_1_day>MA2_1_day and MA1_1_day>MA2_1_day) ? cell_phase2 :
(CLS_1_day<MA1_1_day and CLS_1_day>MA2_1_day and MA1_1_day>MA2_1_day) ?
cell_phase3 :(CLS_1_day<MA1_1_day and CLS_1_day<MA2_1_day and
MA1_1_day>MA2_1_day) ? cell_phase4:(CLS_1_day<MA1_1_day and CLS_1_day<MA2_1_day and
MA1_1_day<MA2_1_day) ? cell_phase5:(CLS_1_day>MA1_1_day and CLS_1_day<MA2_1_day and
MA1_1_day<MA2_1_day) ? cell_phase6:col_col,cell_transp))
plot(showRevBands ? upperKC1 : na, "Rev.Zone Upper 1", red30)
plot(showRevBands ? upperKC2 : na, "Rev.Zone Upper 2", red30)
plot(showRevBands ? upperKC3 : na, "Rev.Zone Upper 3", red30)
plot(showRevBands ? upperKC4 : na, "Rev.Zone Upper 4", red30)
plot(showRevBands ? lowerKC4 : na, "Rev.Zone Lower 4", cyan30)
plot(showRevBands ? lowerKC3 : na, "Rev.Zone Lower 3", cyan30)
plot(showRevBands ? lowerKC2 : na, "Rev.Zone Lower 2", cyan30)
plot(showRevBands ? lowerKC1 : na, "Rev.Zone Lower 1", cyan30)
fill(plot(showRibbon ? ribbon1 : na, "", na, editable=false), plot(showRibbon ?
ribbon2 : na, "", na, editable=false), ribbon1 > ribbon2 ? cyan30 : pink30, "Ribbon
Fill Color")
tf = input.timeframe(defval='D', title='ZigZag Resolution')
prd = input.int(defval=2, title='ZigZag Period', minval=2, maxval=10)
showzigzag = input(defval=false, title='Show Zig Zag')
showfibo = input(defval=true, title='Show Fibonacci Ratios')
colorfulfibo = input(defval=false, title='Colorful Fibonacci Levels')
labelcol = input(defval=color.blue, title='Text Color')
fibolinecol = input(defval=color.lime, title='Line Color')
upcol = input.color(defval=color.lime, title='Zigzag Line Colors', inline='zzcol')
dncol = input.color(defval=color.red, title='', inline='zzcol')
labelloc = input.string(defval='Left', title='Label Location', options=['Left',
'Right'])
enable236 = input(defval=true, title='Enable Level 0.236')
enable382 = input(defval=true, title='Enable Level 0.382')
enable500 = input(defval=true, title='Enable Level 0.500')
enable618 = input(defval=true, title='Enable Level 0.618')
enable786 = input(defval=true, title='Enable Level 0.786')

bool newbar = ta.change(time(tf)) != 0

bi = ta.valuewhen(newbar, bar_index, prd - 1)


len = bar_index - bi + 1

float ph = na
float pl = na
ph := ta.highestbars(high, nz(len, 1)) == 0 ? high : na
pl := ta.lowestbars(low, nz(len, 1)) == 0 ? low : na

var dir = 0
iff_1 = pl and na(ph) ? -1 : dir
dir := ph and na(pl) ? 1 : iff_1
var max_array_size = 50
var zigzag = array.new_float(0)
oldzigzag = array.copy(zigzag)

add_to_zigzag(value, bindex) =>


array.unshift(zigzag, bindex)
array.unshift(zigzag, value)
if array.size(zigzag) > max_array_size
array.pop(zigzag)
array.pop(zigzag)

update_zigzag(value, bindex) =>


if array.size(zigzag) == 0
add_to_zigzag(value, bindex)
else
if dir == 1 and value > array.get(zigzag, 0) or dir == -1 and value <
array.get(zigzag, 0)
array.set(zigzag, 0, value)
array.set(zigzag, 1, bindex)
0.

bool dirchanged = dir != dir[1]


if ph or pl
if dirchanged
add_to_zigzag(dir == 1 ? ph : pl, bar_index)
else
update_zigzag(dir == 1 ? ph : pl, bar_index)

if showzigzag and array.size(zigzag) >= 4 and array.size(oldzigzag) >= 4


var line zzline = na
if array.get(zigzag, 0) != array.get(oldzigzag, 0) or array.get(zigzag, 1) !=
array.get(oldzigzag, 1)
if array.get(zigzag, 2) == array.get(oldzigzag, 2) and array.get(zigzag, 3)
== math.round(array.get(oldzigzag, 3))
line.delete(zzline)
zzline := line.new(x1=math.round(array.get(zigzag, 1)),
y1=array.get(zigzag, 0), x2=math.round(array.get(zigzag, 3)), y2=array.get(zigzag,
2), color=dir == 1 ? upcol : dncol, width=2)
zzline

if not showzigzag and array.size(zigzag) >= 6


var line zzline = na
line.delete(zzline)
zzline := line.new(x1=math.round(array.get(zigzag, 3)), y1=array.get(zigzag,
2), x2=math.round(array.get(zigzag, 5)), y2=array.get(zigzag, 4), color=dir == 1 ?
upcol : dncol, width=2, style=line.style_dotted)
zzline

var fibo_ratios = array.new_float(0)


var fibo_colors = array.new_color(10)
var shownlevels = 1
if barstate.isfirst
array.push(fibo_ratios, 0.000)
if enable236
array.push(fibo_ratios, 0.236)
shownlevels += 1
shownlevels
if enable382
array.push(fibo_ratios, 0.382)
shownlevels += 1
shownlevels
if enable500
array.push(fibo_ratios, 0.500)
shownlevels += 1
shownlevels
if enable618
array.push(fibo_ratios, 0.618)
shownlevels += 1
shownlevels
if enable786
array.push(fibo_ratios, 0.786)
shownlevels += 1
shownlevels
for x = 1 to 5 by 1
array.push(fibo_ratios, x)
array.push(fibo_ratios, x + 0.272)
array.push(fibo_ratios, x + 0.414)
array.push(fibo_ratios, x + 0.618)

// set colors
array.set(fibo_colors, 0, color.lime)
array.set(fibo_colors, 1, color.silver)
array.set(fibo_colors, 2, color.gray)
array.set(fibo_colors, 3, color.red)
array.set(fibo_colors, 4, color.purple)
array.set(fibo_colors, 5, color.fuchsia)
array.set(fibo_colors, 6, color.olive)
array.set(fibo_colors, 7, color.navy)
array.set(fibo_colors, 8, color.teal)
array.set(fibo_colors, 9, color.orange)

var fibolines = array.new_line(0)


var fibolabels = array.new_label(0)
if showfibo and array.size(zigzag) >= 6 and barstate.islast
if array.size(fibolines) > 0
for x = 0 to array.size(fibolines) - 1 by 1
line.delete(array.get(fibolines, x))
label.delete(array.get(fibolabels, x))

diff = array.get(zigzag, 4) - array.get(zigzag, 2)


stopit = false
for x = 0 to array.size(fibo_ratios) - 1 by 1
if stopit and x > shownlevels
break
fibo_line_col = colorfulfibo ? array.get(fibo_colors, timenow / 1000 * x %
10) : fibolinecol
array.unshift(fibolines, line.new(x1=math.round(array.get(zigzag, 5)),
y1=array.get(zigzag, 2) + diff * array.get(fibo_ratios, x), x2=bar_index,
y2=array.get(zigzag, 2) + diff * array.get(fibo_ratios, x), color=fibo_line_col,
extend=extend.right))
label_x_loc = labelloc == 'Left' ? math.round(array.get(zigzag, 5)) - 1 :
bar_index
txt = labelloc == 'Left' ? '' : ' '
array.unshift(fibolabels, label.new(x=label_x_loc, y=array.get(zigzag, 2) +
diff * array.get(fibo_ratios, x), text=txt + str.tostring(array.get(fibo_ratios,
x), '#.###') + '(' + str.tostring(math.round_to_mintick(array.get(zigzag, 2) + diff
* array.get(fibo_ratios, x))) + ')', textcolor=labelcol, style=label.style_none))
if dir == 1 and array.get(zigzag, 2) + diff * array.get(fibo_ratios, x) >
array.get(zigzag, 0) or dir == -1 and array.get(zigzag, 2) + diff *
array.get(fibo_ratios, x) < array.get(zigzag, 0)
stopit := true
stopit
// ����� Constants
string TT_len = "Length for John Ehlers� 2-pole Butterworth filter
�Super Smoother�"
string TT_mult = "Multiplier for the bands"
string TT_showMiddle = "On and off center line"
string TT_showdisclaimer = "Uncheck to hide the disclaimer"
string GRP2 = '----------- ??Settings?? -----------'
// ����� Inputs
float mult = input(5.0,"Adjustable multiplier", tooltip = TT_mult ,
group = GRP2)
bool showMiddle = input(false, "Show middle band" , tooltip = TT_showMiddle ,
group = GRP2)
bool disclaimer = input(false, 'Hide Disclaimer' , tooltip = TT_showdisclaimer,
group = GRP2)
up_col = input.color(#39ff14,'Colors',inline='col')
dn_col = input.color(#ff1100,'',inline='col')
// �������������������� Functions {
super(float src, int len) =>
f = (1.414 * math.pi)/len
a = math.exp(-f)
c2 = 2 * a * math.cos(f)
c3 = -a*a
c1 = 1-c2-c3
smooth = 0.0
smooth := c1*(src+src[1])*0.5+c2*nz(smooth[1])+c3*nz(smooth[2])

// �������������������� Calculations and Plots {


// Stop the indicator on charts with no volume.
if barstate.islast and ta.cum(nz(volume)) == 0
runtime.error("No volume is provided by the data vendor.")

a=super(high,len)
b=super(low,len)
c=(a-b)/2*mult
d=b+(a-b)/2
plotcolor = d>d[1]? up_col : dn_col
bullish_bearish = d>d[1]? true : false
plot(a+c, color=up_col)
plot(b-c, color=dn_col)
plot(showMiddle? d:na, color=plotcolor)
plotchar(ta.crossover(high,a+c),char = "??", location = location.abovebar, size =
size.tiny)
plotchar(ta.crossunder(low,b-c),char = "??",location = location.belowbar , size =
size.tiny)

// �������������������� Alerts
alertcondition(bullish_bearish == true ,title='Bearish Change', message='Nadaraya-
Watson: {{ticker}} ({{interval}}) turned Bearish ?')
alertcondition(bullish_bearish == false, title='Bullish Change', message='Nadaraya-
Watson: {{ticker}} ({{interval}}) turned Bullish ?')
alertcondition(ta.crossunder(high,a+c) , title='Price close under lower band',
message='Nadaraya-Watson: {{ticker}} ({{interval}}) crossed under lower band ??')
alertcondition(ta.crossover(low,b-c) , title='Price close above upper band',
message='Nadaraya-Watson: {{ticker}} ({{interval}}) Crossed above upper band ??')

//----
var tb = table.new(position.top_right, 1, 1
, bgcolor = #35202b)

if barstate.isfirst and not disclaimer


table.cell(tb, 0, 0, 'Super Envelope [CHE] non repaiting'
, text_size = size.small
, text_color = #cc2f3c)

// Alerts
alert01 = ta.crossover(ribbon1, ribbon2)
alert02 = bull
alert03 = wtDivBull
alert04 = wtDivBear
alert05 = bull or bear
alert06 = ta.crossover(wt1, wt2) and wt2 <= -53
alert07 = ta.crossunder(wt1, wt2) and wt2 >= 53
alert08 = ta.crossunder(ribbon1, ribbon2)
alert09 = rsiOb or rsiOs
alert10 = bear
alert11 = ta.cross(ribbon1, ribbon2)
alerts(sym) =>
if alert02 or alert03 or alert04 or alert06 or alert07 or alert10
alert_text = alert02 ? "Buy Signal EzAlgo" : alert03 ? "Strong Buy Signal
EzAlgo" : alert04 ? "Strong Sell Signal EzAlgo" : alert06 ? "Mild Buy Signal
EzAlgo" : alert07 ? "Mild Sell Signal EzAlgo" : "Sell Signal EzAlgo"
alert(alert_text, alert.freq_once_per_bar_close)
alerts(syminfo.tickerid)
alertcondition(alert01, "Blue Trend Ribbon Alert", "Blue Trend Ribbon,
TimeFrame={{interval}}")
alertcondition(alert02, "Buy Signal", "Buy Signal EzAlgo")
alertcondition(alert03, "Divergence Buy Alert", "Strong Buy Signal EzAlgo,
TimeFrame={{interval}}")
alertcondition(alert04, "Divergence Sell Alert", "Strong Sell Signal EzAlgo,
TimeFrame={{interval}}")
alertcondition(alert05, "Either Buy or Sell Signal", "EzAlgo Signal")
alertcondition(alert06, "Mild Buy Alert", "Mild Buy Signal EzAlgo,
TimeFrame={{interval}}")
alertcondition(alert07, "Mild Sell Alert", "Mild Sell Signal EzAlgo,
TimeFrame={{interval}}")
alertcondition(alert08, "Red Trend Ribbon Alert", "Red Trend Ribbon,
TimeFrame={{interval}}")
alertcondition(alert09, "Reversal Signal", "Reversal Signal")
alertcondition(alert10, "Sell Signal", "Sell Signal EzAlgo")
alertcondition(alert11, "Trend Ribbon Color Change Alert", "Trend Ribbon Color
Change, TimeFrame={{interval}}")

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy