ALERTS
ALERTS
// Get Components
ocAvg = math.avg(open, close)
ema1 = ta.ema(high, 9)
ema2 = ta.ema(high, 12)
ema3 = ta.ema(high, 15)
ema4 = ta.ema(high, 18)
sma1 = ta.sma(close, 5)
sma2 = ta.sma(close, 6)
sma3 = ta.sma(close, 7)
sma4 = ta.sma(close, 8)
sma5 = ta.sma(close, 9)
sma6 = ta.sma(close, 10)
sma7 = ta.sma(close, 11)
sma8 = ta.sma(close, 12)
sma9 = ta.sma(close, 13)
sma10 = ta.sma(close, 14)
sma11 = ta.sma(close, 15)
sma12 = ta.sma(close, 16)
sma13 = ta.sma(close, 17)
sma14 = ta.sma(close, 18)
sma15 = ta.sma(close, 19)
sma16 = ta.sma(close, 20)
psar = ta.sar(0.02, 0.02, 0.2)
[supertrend, direction] = supertrend(close, sensitivity, 11)
barsL = 10
barsR = 10
pivotHigh = fixnan(ta.pivothigh(barsL, barsR)[1])
pivotLow = fixnan(ta.pivotlow(barsL, barsR)[1])
// Colors
green = #04994b, green2 = #15c02a
red = #b4060d, red2 = #ff0002
p5 = plot(ocAvg, "", na, editable=false)
p6 = plot(psar, "PSAR", usePsar ? (psar < ocAvg ? green : red) : na, 1,
plot.style_circles, editable=false)
fill(p5, p6, usePsar ? (psar < ocAvg ? color.new(green, 90) : color.new(red, 90)) :
na, editable=false)
y1 = low - (ta.atr(30) * 2)
y2 = high + (ta.atr(30) * 2)
bull = ta.crossover(close, supertrend) and close >= sma9
bear = ta.crossunder(close, supertrend) and close <= sma9
buy = bull ? label.new(bar_index, y1, "▲", xloc.bar_index, yloc.price, #04994b,
label.style_label_up, color.white, size.normal) : na
sell = bear ? label.new(bar_index, y2, "▼", xloc.bar_index, yloc.price, #b4060d,
label.style_label_down, color.white, size.normal) : na
// Strong TP Points //
maj_qual = 13
maj_len = 40
min_qual = 5
min_len = 5
min = false
selll = 0.0
buyy = 0.0
// Oscillator {
osc_len = 7
osc_bias = 100 *(c2 - o2)
osc_smooth = ta.ema(osc_bias, osc_len)
sigcolor = (osc_bias > 0) and (osc_bias >= osc_smooth) ? color.new(color.lime,
35) : (osc_bias > 0) and (osc_bias < osc_smooth) ? color.new(color.lime, 75) :
(osc_bias < 0) and (osc_bias <= osc_smooth) ? color.new(color.red, 35) : (osc_bias
< 0) and (osc_bias > osc_smooth) ? color.new(color.red, 75) :
na
// }
// Plots {
p_h = plot(h2, "Bias High", color=color(na), display=display.none, editable=false)
p_l = plot(l2, "Bias Low", color=color(na), display=display.none, editable=false)
p_avg = plot(ha_avg, "Bias Avergae", color=color(na), display=display.none,
editable=false)
fill(p_l, p_h, show_ha ? sigcolor : na)
col = o2 > c2 ? color.red : color.lime
// }
// Range Filter DW
//---------------------Range
Filter-----------------------------------------------------------------------------
-----------------------------------------
cloud_b = color.new(color.red,80)
chikou_css = #7b1fa2
plot(Show_SuperIchi ? tenkan : na,'Tenkan-Sen',tenkan_css)
plot(Show_SuperIchi ? kijun : na,'Kijun-Sen',kijun_css)
plot(ta.crossover(tenkan,kijun) ? kijun :
na,'Crossover',#2157f3,3,plot.style_circles)
plot(ta.crossunder(tenkan,kijun) ? kijun :
na,'Crossunder',#ff5d00,3,plot.style_circles)
A = plot(Show_SuperIchi ? senkouA : na,'Senkou Span A',na,offset=offset-1)
B = plot(Show_SuperIchi ? senkouB : na,'Senkou Span B',na,offset=offset-1)
fill(A,B,senkouA > senkouB ? cloud_a : cloud_b)
plot(close,'Chikou',chikou_css,offset=-offset+1,display=display.none)
//------------------------- TBO | https://www.thebettertraders.com -----------//
// Get user input
bool enableCustomTBO = input(false, "Enable?", "Custom trend settings are not
enabled by default. The default settings loaded are not shown publicly. You have
the option to enter your own custom settings as you get more familiar with the
TBO.", group="CUSTOM TREND STRENGTH SETTINGS")
var fastLen = input.int(1, "TBO Fast", 1, group="CUSTOM TREND STRENGTH SETTINGS")
var mediumLen = input.int(2, "TBO Medium", 2, group="CUSTOM TREND STRENGTH
SETTINGS")
var medfastLen = input.int(3, "TBO Med Fast", 3, group="CUSTOM TREND STRENGTH
SETTINGS")
var slowLen = input.int(4, "TBO Slow", 4, group="CUSTOM TREND STRENGTH SETTINGS")
bool enableRSI = input(false, "Enable?", "Enable this if you wish to combine an RSI
requirement with the TBO Long or TBO Short signal. The default settings shown here
have no importance, they are just placeholders and are not significant. It is
raccomended to have the RSI showing when this is enabled so you can see what kind
of settings will work.", group="TBO LONG/SHORT W/ RSI")
var shortRsiBand = input.int(70, "Short RSI Band", 1, 100, group="TBO LONG/SHORT W/
RSI")
var shortBandGL = input.string("Greater Than", "Greater/Less Than", ["Greater
Than", "Less Than"], group="TBO LONG/SHORT W/ RSI")
var longRsiBand = input.int(30, "Long RSI Band", 1, 100, group="TBO LONG/SHORT W/
RSI")
var longBandGL = input.string("Less Than", "Greater/Less Than", ["Greater Than",
"Less Than"], group="TBO LONG/SHORT W/ RSI")
var rsiLen = input.int(14, "TBO Med Fast", 1, group="TBO LONG/SHORT W/RSI")
bool enableTP = input(false, "Enable?", group="TAKE PROFIT SETTINGS")
var longTPperc = input.int(9, "TP Long %", 1, group="TAKE PROFIT SETTINGS")
var shortTPperc = input.int(9, "TP Short %", 1, group="TAKE PROFIT SETTINGS")
bool static = input(false, "Static", "If enabled will plot a signal every time
volume gets greater than your defined value.", group="DHP VOLUME SCALPING")
var volThreshold = input.int(20000, "Volume", 1, group="DHP VOLUME SCALPING")
bool maMultiple = input(false, "MA Multiple", "If enabled will plot a signal every
time volume gets greater than his average multiplied by your defined value.",
group="DHP VOLUME SCALPING")
var average = input.int(20, "Average", 2, tooltip="Number of bars back used to
calculate the volume's average.", group="DHP VOLUME SCALPING")
var multipleX = input.int(3, "Multiple X", 1, tooltip="Number of times the
volume's average will be multiplied.", group="DHP VOLUME SCALPING")
// Functions
bb(src, len, mult) =>
float basis = ta.ema(src, len)
float dev = mult * ta.stdev(src, len)
[basis, basis + dev, basis - dev]
[_, upperBB, lowerBB] = bb(close, 25, 1)
isLast(var1, var2) => ta.barssince(var1) < ta.barssince(var2)
// Get components
float fastTBO = ta.ema(close, enableCustomTBO ? fastLen : 20)
float mediumTBO = ta.ema(close, enableCustomTBO ? mediumLen : 40)
float medfastTBO = ta.sma(close, enableCustomTBO ? medfastLen : 50)
float slowTBO = ta.sma(close, enableCustomTBO ? slowLen : 150)
float rsi = ta.rsi(close, rsiLen)
bool rsiShort = enableRSI and shortBandGL == "Greater Than" ? (rsi >
shortRsiBand) : (rsi < shortRsiBand)
bool rsiLong = enableRSI and longBandGL == "Less Than" ? (rsi < longRsiBand) : (rsi
> longRsiBand)
float vol = volume
float volMA = ta.sma(vol, average) * multipleX
bool openLong = ta.crossover(fastTBO, mediumTBO) and rsiLong, lastLong =
ta.barssince(openLong), long = ta.crossover(fastTBO, mediumTBO)
bool openShort = ta.crossunder(fastTBO, mediumTBO) and rsiShort, lastShort =
ta.barssince(openShort), short = ta.crossunder(fastTBO, mediumTBO)
// Colors
greenn = #2FD282
pink = #E34DED
// Plots
plotshape(Show_TBO ? openLong : na, "▲ Open Long", shape.triangleup,
location.belowbar, greenn, size=size.tiny)
plotshape(Show_TBO ? openShort : na, "▼ Open Short", shape.triangledown,
location.abovebar, pink, size=size.tiny)
// Smart Trail
trailType = input.string('modified', 'Trailtype',
options=['modified','unmodified'])
ATRPeriod = input(13, 'ATR Period')
ATRFactor = input(4, 'ATR Factor')
smoothing = input(8, 'Smoothing')
norm_o = request.security(ticker.new(syminfo.prefix, syminfo.ticker),
timeframe.period, open)
norm_h = request.security(ticker.new(syminfo.prefix, syminfo.ticker),
timeframe.period, high)
norm_l = request.security(ticker.new(syminfo.prefix, syminfo.ticker),
timeframe.period, low)
norm_c = request.security(ticker.new(syminfo.prefix, syminfo.ticker),
timeframe.period, close)
//}
//////// FUNCTIONS //////////////
//{
// Wilders ma //
Wild_ma(_src, _malength) =>
_wild = 0.0
_wild := nz(_wild[1]) + (_src - nz(_wild[1])) / _malength
_wild
// -Inputs
═══════════════════════════════════════════════════════════════════════════════════
═══ //
// -Calculations
════════════════════════════════════════════════════════════════════════════════ //
var iPrevPivotRef = 0
var pPrevPivotRef = 0.
var iLastPivotRef = 0
var pLastPivotRef = 0.
for i = 0 to l2 by 1
if isHigh and src[i] > c
ok := false
ok
//
-----------------------------------------------------------------------------------
----- //
[zzCol, zzWid, zzSty] = if not i_zigZag
[na, 1, line.style_dashed]
else
[i_zzColor, i_zzWidth, i_zzStyle == 'Solid' ? line.style_solid :
i_zzStyle == 'Dotted' ? line.style_dotted : line.style_dashed]
//
-----------------------------------------------------------------------------------
----- //
if not na(iH)
dev = calc_dev(pLast, pH)
[id, isHigh] = pivotFound(dev, true, iH, pH)
if not na(id)
if id != lineLast
//
-----------------------------------------------------------------------------------
----- //
iPrevPivotRef := line.get_x1(lineLast)
pPrevPivotRef := line.get_y1(lineLast)
iLastPivotRef := line.get_x2(lineLast)
pLastPivotRef := line.get_y2(lineLast)
if not i_zigZag
//
-----------------------------------------------------------------------------------
----- //
line.delete(lineLast)
lineLast := id
isHighLast := isHigh
iPrev := iLast
iLast := iH
pLast := pH
pLast
else
if not na(iL)
dev = calc_dev(pLast, pL)
[id, isHigh] = pivotFound(dev, false, iL, pL)
if not na(id)
if id != lineLast
//
-----------------------------------------------------------------------------------
----- //
iPrevPivotRef := line.get_x1(lineLast)
pPrevPivotRef := line.get_y1(lineLast)
iLastPivotRef := line.get_x2(lineLast)
pLastPivotRef := line.get_y2(lineLast)
if not i_zigZag
//
-----------------------------------------------------------------------------------
----- //
line.delete(lineLast)
lineLast := id
isHighLast := isHigh
iPrev := iLast
iLast := iL
pLast := pL
pLast
f_drawLineX(_x1, _y1, _x2, _y2, _xloc, _extend, _color, _style, _width) =>
var id = line.new(_x1, _y1, _x2, _y2, _xloc, _extend, _color, _style, _width)
line.set_xy1(id, _x1, _y1)
line.set_xy2(id, _x2, _y2)
if i_pPitch
f_drawPitchLine(iStartMedian, pStartMedian, iEndMedian, pEndMedian, i_pcolor_m,
i_pwidth_m, i_pstyle_m, true )
f_drawPitchLine(iStartMedian, pStartMedian, iEndMedian, pEndMedian, i_pcolor_m,
i_pwidth_m, i_pstyle_m, false)
f_drawLineX(iPrevPivot, pPrevPivot, iLastPivot, pLastPivot, xloc.bar_index,
extend.none, i_pcolor_m, line.style_solid, i_pwidth_m)
if i_pLabels != 'None'
mTip = str.tostring(mPrice, format.mintick)
mTxt = i_pLabels == 'Prices' ? mTip : i_pLabels == 'Levels (Prices)' ? 'PF
M (' + mTip + ')' : 'PF M'
size = i_levelsS == 'Small' ? size.small : size.normal
f_drawLabelX(bar_index, mPrice, mTxt, xloc.bar_index, yloc.price, #00000000
, label.style_label_left, i_pcolor_m, size , text.align_left, mTip)
f_drawLabelX(bar_index, mPrice, '' , xloc.bar_index, yloc.price,
i_pcolor_m, label.style_circle , #00000000 , size.auto, text.align_left, '' )
if f_crossingLevel(close, mPrice)
alert('AutoPitchFan: ' + syminfo.ticker + ' crossing median level')
if show
f_drawPitchLine(iStartMedian, pStartMedian, iEndX, pEndX, colorL,
widthL, styleL, true )
f_drawPitchLine(iStartMedian, pStartMedian, iEndY, pEndY, colorL,
widthL, styleL, false)
if i_pLabels != 'None'
rTip = str.tostring(rPrice, format.mintick)
sTip = str.tostring(sPrice, format.mintick)
rTxt = i_pLabels == 'Prices' ? rTip : i_pLabels == 'Levels
(Prices)' ? 'PF ' + str.tostring(level) + ' R (' + rTip + ')' : 'PF ' +
str.tostring(level) + ' R'
sTxt = i_pLabels == 'Prices' ? sTip : i_pLabels == 'Levels
(Prices)' ? 'PF ' + str.tostring(level) + ' S (' + sTip + ')' : 'PF ' +
str.tostring(level) + ' S'
size = i_levelsS == 'Small' ? size.small : size.normal
if f_crossingLevel(close, rPrice)
alert('AutoPitchFan: ' + syminfo.ticker + ' crossing resistance
level ' + str.tostring(level))
if f_crossingLevel(close, sPrice)
alert('AutoPitchFan: ' + syminfo.ticker + ' crossing support level
' + str.tostring(level))
if i_bgPitch
rLines = array.size(a_lnr)
if rLines > 1
array.push(a_lf, linefill.new(array.get(a_lnr, rLines - 2),
array.get(a_lnr, rLines - 1), color.new(colorL, 89)))
sLines = array.size(a_lns)
if sLines > 1
array.push(a_lf, linefill.new(array.get(a_lns, sLines - 2),
array.get(a_lns, sLines - 1), color.new(colorL, 89)))
if i_fibTool == 'Extentions'
f_drawLineX(iStartMedian, pStartMedian, iPrevPivot, pPrevPivot,
xloc.bar_index, extend.none, color.gray, line.style_dashed, 1)
f_drawLineX(iPrevPivot , pPrevPivot , iLastPivot, pLastPivot,
xloc.bar_index, extend.none, color.gray, line.style_dashed, 1)
if _show
f_drawLineX(iPrevPivot, price, bar_index, price, xloc.bar_index,
i_extend ? extend.both : extend.right, _color, line.style_solid, 1)
if i_levels != 'None'
bar = i_levelsP == "Last Bar" ? bar_index : iPrevPivot
style = i_levelsP == "Last Bar" ? label.style_label_left :
label.style_label_right
size = i_levelsF == 'Small' ? size.small : size.normal
txt = i_levels =='Levels' ? str.tostring(_level) : i_levels ==
'Prices' ? str.tostring(price, format.mintick) : str.tostring(_level) + ' (' +
str.tostring(price, format.mintick) + ')'
f_drawLabelX(bar, price, (i_fibTool == 'Extentions' ? 'EXT ' : 'RET
') + txt, xloc.bar_index, yloc.price, #00000000, style, _color, size,
text.align_left, str.tostring(price, format.mintick))
if f_crossingLevel(close, price)
alert('AutoFib ' + (i_fibTool == 'Extentions' ? 'Extention : ' :
'Retracment : ') + syminfo.ticker + ' crossing level ' + str.tostring(_level))
//}
// Reversal Signals
ReversalInputs = input.int(14, minval=1, title="Reversals Sensitivity",
group="Reversal Settings")
overbought = input(75, 'Reversal Down Level', group='Reversal Settings')
oversold = input(25, 'Reversal Up Level', group='Reversal Settings')
upwardd = ta.rma(math.max(ta.change(close), 0), ReversalInputs)
dnwardd = ta.rma(-math.min(ta.change(close), 0), ReversalInputs)
source = dnwardd == 0 ? 100 : upwardd == 0 ? 0 : 100 - (100 / (1 + upwardd /
dnwardd))
revdn = ta.crossunder(source, overbought) and enableReversal
revup = ta.crossover(source, oversold) and enableReversal
plotshape(revup, 'Reversal Up Signal', shape.labelup, location.belowbar,
color.new(#2157f9, 65), text='Reversal Up Chance', size=size.small,
textcolor=color.white)
plotshape(revdn, 'Reversal Down Signal', shape.labeldown, location.abovebar,
color.new(#ff1100, 65), text='Reversal Down Chance', size=size.small,
textcolor=color.white)
// EzAlgo SR
// Get user input
colorSup = input(#00DBFF, "Support Color", group="SR")
colorRes = input(#E91E63, "Resistance Color", group="SR")
strengthSR = input.int(2, "S/R Strength", 1, group="SR")
lineStyle = input.string("Dotted", "Line Style", ["Solid", "Dotted", "Dashed"],
group="SR")
lineWidth = input.int(2, "S/R Line Width", 1, group="SR")
useZones = input(true, "Zones On/Off", group="SR")
useHLZones = input(true, "High Low Zones On/Off", group="SR")
zoneWidth = input.int(2, "Zone Width %", 0, tooltip="it's calculated using % of
the distance between highest/lowest in last 300 bars", group="SR")
expandSR = input(true, "Expand SR")
// Functions
percWidth(len, perc) => (ta.highest(len) - ta.lowest(len)) * perc / 100
// Get components
rb = 10
prd = 284
ChannelW = 10
label_loc = 55
style = lineStyle == "Solid" ? line.style_solid : lineStyle == "Dotted" ?
line.style_dotted : line.style_dashed
ph = ta.pivothigh(rb, rb)
pl = ta.pivotlow (rb, rb)
sr_levels = array.new_float(21, na)
prdhighest = ta.highest(prd)
prdlowest = ta.lowest(prd)
cwidth = percWidth(prd, ChannelW)
zonePerc = percWidth(300, zoneWidth)
aas = array.new_bool(41, true)
u1 = 0.0, u1 := nz(u1[1])
d1 = 0.0, d1 := nz(d1[1])
highestph = 0.0, highestph := highestph[1]
lowestpl = 0.0, lowestpl := lowestpl[1]
var sr_levs = array.new_float(21, na)
label hlabel = na, label.delete(hlabel[1])
label llabel = na, label.delete(llabel[1])
var sr_lines = array.new_line(21, na)
var sr_linesH = array.new_line(21, na)
var sr_linesL = array.new_line(21, na)
var sr_linesF = array.new_linefill(21, na)
var sr_labels = array.new_label(21, na)
if ph or pl
for x = 0 to array.size(sr_levels) - 1
array.set(sr_levels, x, na)
highestph := prdlowest
lowestpl := prdhighest
countpp = 0
for x = 0 to prd
if na(close[x])
break
if not na(ph[x]) or not na(pl[x])
highestph := math.max(highestph, nz(ph[x], prdlowest), nz(pl[x],
prdlowest))
lowestpl := math.min(lowestpl, nz(ph[x], prdhighest), nz(pl[x],
prdhighest))
countpp += 1
if countpp > 40
break
if array.get(aas, countpp)
upl = (ph[x] ? high[x + rb] : low[x + rb]) + cwidth
dnl = (ph[x] ? high[x + rb] : low[x + rb]) - cwidth
u1 := countpp == 1 ? upl : u1
d1 := countpp == 1 ? dnl : d1
tmp = array.new_bool(41, true)
cnt = 0
tpoint = 0
for xx = 0 to prd
if na(close[xx])
break
if not na(ph[xx]) or not na(pl[xx])
chg = false
cnt += 1
if cnt > 40
break
if array.get(aas, cnt)
if not na(ph[xx])
if high[xx + rb] <= upl and high[xx + rb] >= dnl
tpoint += 1
chg := true
if not na(pl[xx])
if low[xx + rb] <= upl and low[xx + rb] >= dnl
tpoint += 1
chg := true
if chg and cnt < 41
array.set(tmp, cnt, false)
if tpoint >= strengthSR
for g = 0 to 40 by 1
if not array.get(tmp, g)
array.set(aas, g, false)
if ph[x] and countpp < 21
array.set(sr_levels, countpp, high[x + rb])
if pl[x] and countpp < 21
array.set(sr_levels, countpp, low[x + rb])
// Plot
var line highest_ = na, line.delete(highest_)
var line lowest_ = na, line.delete(lowest_)
var line highest_fill1 = na, line.delete(highest_fill1)
var line highest_fill2 = na, line.delete(highest_fill2)
var line lowest_fill1 = na, line.delete(lowest_fill1)
var line lowest_fill2 = na, line.delete(lowest_fill2)
hi_col = close >= highestph ? colorSup : colorRes
lo_col = close >= lowestpl ? colorSup : colorRes
if enableSR
highest_ := line.new(bar_index - 311, highestph, bar_index, highestph,
xloc.bar_index, expandSR ? extend.both : extend.right, hi_col, style, lineWidth)
lowest_ := line.new(bar_index - 311, lowestpl , bar_index, lowestpl ,
xloc.bar_index, expandSR ? extend.both : extend.right, lo_col, style, lineWidth)
if useHLZones
highest_fill1 := line.new(bar_index - 311, highestph + zonePerc, bar_index,
highestph + zonePerc, xloc.bar_index, expandSR ? extend.both : extend.right, na)
highest_fill2 := line.new(bar_index - 311, highestph - zonePerc, bar_index,
highestph - zonePerc, xloc.bar_index, expandSR ? extend.both : extend.right, na)
lowest_fill1 := line.new(bar_index - 311, lowestpl + zonePerc , bar_index,
lowestpl + zonePerc , xloc.bar_index, expandSR ? extend.both : extend.right, na)
lowest_fill2 := line.new(bar_index - 311, lowestpl - zonePerc , bar_index,
lowestpl - zonePerc , xloc.bar_index, expandSR ? extend.both : extend.right, na)
linefill.new(highest_fill1, highest_fill2, color.new(hi_col, 80))
linefill.new(lowest_fill1 , lowest_fill2 , color.new(lo_col, 80))
if ph or pl
for x = 0 to array.size(sr_lines) - 1
array.set(sr_levs, x, array.get(sr_levels, x))
for x = 0 to array.size(sr_lines) - 1
line.delete(array.get(sr_lines, x))
line.delete(array.get(sr_linesH, x))
line.delete(array.get(sr_linesL, x))
linefill.delete(array.get(sr_linesF, x))
if array.get(sr_levs, x) and enableSR
line_col = close >= array.get(sr_levs, x) ? colorSup : colorRes
array.set(sr_lines, x, line.new(bar_index - 355, array.get(sr_levs, x),
bar_index, array.get(sr_levs, x), xloc.bar_index, expandSR ? extend.both :
extend.right, line_col, style, lineWidth))
if useZones
array.set(sr_linesH, x, line.new(bar_index - 355, array.get(sr_levs, x)
+ zonePerc, bar_index, array.get(sr_levs, x) + zonePerc, xloc.bar_index, expandSR ?
extend.both : extend.right, na))
array.set(sr_linesL, x, line.new(bar_index - 355, array.get(sr_levs, x)
- zonePerc, bar_index, array.get(sr_levs, x) - zonePerc, xloc.bar_index, expandSR ?
extend.both : extend.right, na))
array.set(sr_linesF, x, linefill.new(array.get(sr_linesH, x),
array.get(sr_linesL, x), color.new(line_col, 80)))
for x = 0 to array.size(sr_labels) - 1
label.delete(array.get(sr_labels, x))
if array.get(sr_levs, x) and enableSR
lab_loc = close >= array.get(sr_levs, x) ? label.style_label_up :
label.style_label_down
lab_col = close >= array.get(sr_levs, x) ? colorSup : colorRes
array.set(sr_labels, x, label.new(bar_index + label_loc, array.get(sr_levs,
x), str.tostring(math.round_to_mintick(array.get(sr_levs, x))), color=lab_col ,
textcolor=#000000, style=lab_loc))
hlabel := enableSR ? label.new(bar_index + label_loc +
math.round(math.sign(label_loc)) * 20, highestph, "High Level : " +
str.tostring(highestph), color=hi_col, textcolor=#000000,
style=label.style_label_down) : na
llabel := enableSR ? label.new(bar_index + label_loc +
math.round(math.sign(label_loc)) * 20, lowestpl , "Low Level : " +
str.tostring(lowestpl) , color=lo_col, textcolor=#000000,
style=label.style_label_up ) : na
// Lux Algo Reversal Band
//func
kama(ssrc, llen) =>
kama = 0.0
sum_1 = math.sum(math.abs(ssrc - ssrc[1]), llen)
sum_2 = math.sum(math.abs(ssrc - ssrc[1]), llen)
kama := nz(kama[1]) + math.pow((sum_1 != 0 ? math.abs(ssrc - ssrc[llen]) /
sum_2 : 0) * (0.288 - 0.0666) + 0.0666, 2) * (ssrc - nz(kama[1]))
kama
//inputs
llength = input(50, title='Band Length')
if hist < 0
if hist < hist[1] and hist[1] < 0
candleBody := redLow
// Bullish trend
if macd > 0 and hist > 0
candleBody := greenMidLow
// Function to get the highest and lowest prices of the previous day
_getPreviousDayHighLow(utcOffsetInMs) =>
dow = dayofweek(time + utcOffsetInMs)
var prevDayHigh = high
var prevDayHighTime = time
if (dow != dow[1])
dayHigh := high
dayHighTime := time
dayLow := low
dayLowTime := time
prevDayHigh := dayHigh[1]
prevDayHighTime := dayHighTime[1]
prevDayLow := dayLow[1]
prevDayLowTime := dayLowTime[1]
else
if dayHigh < high
dayHigh := high
dayHighTime := time
weekdayBottomLabelLevel = array.get(pivotLevels, 6)
if isNewDay
line.set_xy1(prevDayHighLine, prevDayHighTime, prevDayHigh)
line.set_xy2(prevDayHighLine, prevDayHighTime, prevDayHigh)
label.set_xy(prevDayHighLabel, prevDayHighTime, prevDayHigh)
line.set_x2(prevDayLowLine, t)
label.set_x(prevDayLowLabel, t)