0% found this document useful (0 votes)
211 views

ALERTS

Uploaded by

Rihan B S
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)
211 views

ALERTS

Uploaded by

Rihan B S
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/ 27

//@version=5

indicator("Premium Lux Algo", overlay=true, precision=0, explicit_plot_zorder=true,


max_labels_count=500)
// Get user input
sensitivity = input.float(5.5, "Sensitivity (0.5 - 12)", 0.5, 12, step=0.05, group
= 'Settings')
ShowSmartTrail = input.bool(true, 'Smart Trail ', inline = 'overlayLine1', group =
'Settings')
maj = input(true, title='TP Points', inline = 'overlayLine1', group = 'Settings')
enableReversal = input.bool(false, 'Reversal Signal ', inline = 'overlayLine2',
group = 'Settings')
show_ha = input.bool(false, 'Trend Tracker', inline = 'overlayLine2', group =
'Settings')
enableSR = input(false, 'Support/Resistance ', inline = 'overlayLine3', group =
'Settings')
usePsar = input.bool(false, 'PSAR', inline = 'overlayLine3', group = 'Settings')
show_rev = input.bool(true, 'Reversal Cloud ', inline = 'overlayLine4', group =
'Settings')
Show_rangefilter = input.bool(true, 'Range Filter', inline = 'overlayLine4', group
= 'Settings')
Show_SuperIchi = input.bool(true, 'SuperIchi ', inline = 'overlayLine5', group =
'Settings')
Show_TBO = input.bool(true, 'Show TBO', inline = 'overlayLine5', group =
'Settings')
/// Functions
supertrend(_src, factor, atrLen) =>
atrat = ta.atr(atrLen)
upperBand = _src + factor * atrat
lowerBand = _src - factor * atrat
prevLowerBand = nz(lowerBand[1])
prevUpperBand = nz(upperBand[1])
lowerBand := lowerBand > prevLowerBand or close[1] < prevLowerBand ?
lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or close[1] > prevUpperBand ?
upperBand : prevUpperBand
int direction = na
float superTrend = na
prevSuperTrend = superTrend[1]
if na(atrat[1])
direction := 1
else if prevSuperTrend == prevUpperBand
direction := close > upperBand ? -1 : 1
else
direction := close < lowerBand ? 1 : -1
superTrend := direction == -1 ? lowerBand : upperBand
[ superTrend , direction ]

// 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

lele(qual, len) =>


bindex = 0.0
sindex = 0.0
bindex := nz(bindex[1], 0)
sindex := nz(sindex[1], 0)
ret = 0
if close > close[4]
bindex += 1
bindex
if close < close[4]
sindex += 1
sindex
if bindex > qual and close < open and high >= ta.highest(high, len)
bindex := 0
ret := -1
ret
if sindex > qual and close > open and low <= ta.lowest(low, len)
sindex := 0
ret := 1
ret
return_1 = ret
return_1
major = lele(maj_qual, maj_len)
minor = lele(min_qual, min_len)
if minor == -1 and min == true
selll := 1
selll
if major == -1 and maj == true
selll := 2
selll
if major == -1 and maj == true and minor == -1 and min == true
selll := 3
selll
if minor == 1 and min == true
buyy := 1
buyy
if major == 1 and maj == true
buyy := 2
buyy
if major == 1 and maj == true and minor == 1 and min == true
buyy := 3
buyy
plotshape(selll == 2, style=shape.xcross, location=location.abovebar,
color=color.new(#354996, 0), textcolor=color.new(color.white, 0), offset=0)
plotshape(buyy == 2, style=shape.xcross, location=location.belowbar,
color=color.new(#354996, 0), textcolor=color.new(color.white, 0), offset=0)
// Ha Market Bias //
tf(_res, _exp, gaps_on) =>
gaps_on == 0 ? request.security(syminfo.tickerid, _res, _exp) : gaps_on == true ?
request.security(syminfo.tickerid, _res, _exp, barmerge.gaps_on,
barmerge.lookahead_off) : request.security(syminfo.tickerid, _res, _exp,
barmerge.gaps_off, barmerge.lookahead_off)
ha_htf = ''
ha_len = 100
ha_len2 = 100
// Calculations {
o = ta.ema(open, ha_len)
c = ta.ema(close, ha_len)
h = ta.ema(high, ha_len)
l = ta.ema(low, ha_len)
haclose = tf(ha_htf, (o + h + l + c) / 4, 0)
xhaopen = tf(ha_htf, (o + c) / 2, 0)
haopen = na(xhaopen[1]) ? (o + c) / 2 : (xhaopen[1] + haclose[1]) / 2
hahigh = math.max(h, math.max(haopen, haclose))
halow = math.min(l, math.min(haopen, haclose))
o2 = tf(ha_htf, ta.ema(haopen, ha_len2), 0)
c2 = tf(ha_htf, ta.ema(haclose, ha_len2), 0)
h2 = tf(ha_htf, ta.ema(hahigh, ha_len2), 0)
l2 = tf(ha_htf, ta.ema(halow, ha_len2), 0)
ha_avg = (h2 + l2) / 2
// }

// 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-----------------------------------------------------------------------------
-----------------------------------------

//Conditional Sampling EMA Function


Cond_EMA(x, cond, n) =>
var val = array.new_float(0)
var ema_val = array.new_float(1)
if cond
array.push(val, x)
if array.size(val) > 1
array.remove(val, 0)
if na(array.get(ema_val, 0))
array.fill(ema_val, array.get(val, 0))
array.set(ema_val, 0, (array.get(val, 0) - array.get(ema_val, 0)) *
(2 / (n + 1)) + array.get(ema_val, 0))
EMA = array.get(ema_val, 0)
EMA
//Conditional Sampling SMA Function
Cond_SMA(x, cond, n) =>
var vals = array.new_float(0)
if cond
array.push(vals, x)
if array.size(vals) > n
array.remove(vals, 0)
SMA = array.avg(vals)
SMA
//Standard Deviation Function
Stdev(x, n) =>
math.sqrt(Cond_SMA(math.pow(x, 2), 1, n) - math.pow(Cond_SMA(x, 1, n), 2))
//Range Size Function
rng_size(x, scale, qty, n) =>
ATR = Cond_EMA(ta.tr(true), 1, n)
AC = Cond_EMA(math.abs(x - x[1]), 1, n)
SD = Stdev(x, n)
rng_size = scale == 'Pips' ? qty * 0.0001 : scale == 'Points' ? qty *
syminfo.pointvalue : scale == '% of Price' ? close * qty / 100 : scale == 'ATR' ?
qty * ATR : scale == 'Average Change' ? qty * AC : scale == 'Standard Deviation' ?
qty * SD : scale == 'Ticks' ? qty * syminfo.mintick : qty
rng_size
//Two Type Range Filter Function
rng_filt(h, l, rng_, n, type, smooth, sn, av_rf, av_n) =>
rng_smooth = Cond_EMA(rng_, 1, sn)
r = smooth ? rng_smooth : rng_
var rfilt = array.new_float(2, (h + l) / 2)
array.set(rfilt, 1, array.get(rfilt, 0))
if type == 'Type 1'
if h - r > array.get(rfilt, 1)
array.set(rfilt, 0, h - r)
if l + r < array.get(rfilt, 1)
array.set(rfilt, 0, l + r)
if type == 'Type 2'
if h >= array.get(rfilt, 1) + r
array.set(rfilt, 0, array.get(rfilt, 1) + math.floor(math.abs(h
- array.get(rfilt, 1)) / r) * r)
if l <= array.get(rfilt, 1) - r
array.set(rfilt, 0, array.get(rfilt, 1) - math.floor(math.abs(l
- array.get(rfilt, 1)) / r) * r)
rng_filt1 = array.get(rfilt, 0)
hi_band1 = rng_filt1 + r
lo_band1 = rng_filt1 - r
rng_filt2 = Cond_EMA(rng_filt1, rng_filt1 != rng_filt1[1],
av_n)
hi_band2 = Cond_EMA(hi_band1, rng_filt1 != rng_filt1[1], av_n)
lo_band2 = Cond_EMA(lo_band1, rng_filt1 != rng_filt1[1], av_n)
rng_filt = av_rf ? rng_filt2 : rng_filt1
hi_band = av_rf ? hi_band2 : hi_band1
lo_band = av_rf ? lo_band2 : lo_band1
[hi_band, lo_band, rng_filt]
//---------------------------------------------------------------------------------
--------------------------------------------------------------------------------
//Inputs
//---------------------------------------------------------------------------------
--------------------------------------------------------------------------------
//Filter Type
f_type = 'Type 2'
//Movement Source
mov_src = 'Close'
//Range Size Inputs
rng_qty = 2.618
rng_scale = 'Average Change'
//Range Period
rng_per = 14
//Range Smoothing Inputs
smooth_range = true
smooth_per = 27
//Filter Value Averaging Inputs
av_vals = false
av_samples = 2
//---------------------------------------------------------------------------------
--------------------------------------------------------------------------------
//Definitions
//---------------------------------------------------------------------------------
--------------------------------------------------------------------------------
//High And Low Values
h_val = mov_src == 'Wicks' ? high : close
l_val = mov_src == 'Wicks' ? low : close
//Range Filter Values
[h_band, l_band, filt] = rng_filt(h_val, l_val, rng_size((h_val + l_val) / 2,
rng_scale, rng_qty, rng_per), rng_per, f_type, smooth_range, smooth_per, av_vals,
av_samples)
//Direction Conditions
var fdir = 0.0
fdir := filt > filt[1] ? 1 : filt < filt[1] ? -1 : fdir
upward = fdir == 1 ? 1 : 0
downward = fdir == -1 ? 1 : 0
//Colors

filt_color = upward ? #36db7f : downward ? #be130f : #cccccc


//---------------------------------------------------------------------------------
--------------------------------------------------------------------------------
//Outputs
//---------------------------------------------------------------------------------
--------------------------------------------------------------------------------
//Filter Plot
filt_plot = plot(Show_rangefilter ? filt : na, color=filt_color,
linewidth=3,title='Filter', transp=0)
//Bar Color
//External Trend Output
plot(fdir, editable=false, display=display.none, title='External Output - Trend
Signal', transp=100)
// Superlchi + TBO
tenkan_len = 6
tenkan_mult = 2
kijun_len = 5
kijun_mult = 3.
spanB_len = 26
spanB_mult = 4.
offset = 0
//------------------------------------------------------------------------------
avg(srcc,length,mult)=>
atr = ta.atr(length)*mult
up = hl2 + atr
dn = hl2 - atr
upper = 0.,lower = 0.
upper := srcc[1] < upper[1] ? math.min(up,upper[1]) : up
lower := srcc[1] > lower[1] ? math.max(dn,lower[1]) : dn
os = 0,max = 0.,min = 0.
os := srcc > upper ? 1 : srcc < lower ? 0 : os[1]
spt = os == 1 ? lower : upper
max := ta.cross(srcc,spt) ? math.max(srcc,max[1]) : os == 1 ?
math.max(srcc,max[1]) : spt
min := ta.cross(srcc,spt) ? math.min(srcc,min[1]) : os == 0 ?
math.min(srcc,min[1]) : spt
math.avg(max,min)
//------------------------------------------------------------------------------
tenkan = avg(close,tenkan_len,tenkan_mult)
kijun = avg(close,kijun_len,kijun_mult)
senkouA = math.avg(kijun,tenkan)
senkouB = avg(close,spanB_len,spanB_mult)
//------------------------------------------------------------------------------
tenkan_css = #2157f3
kijun_css = #ff5d00
cloud_a = color.new(color.teal,80)

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

/////////// TRUE RANGE CALCULATIONS /////////////////


HiLo = math.min(norm_h - norm_l, 1.5 * nz(ta.sma(norm_h - norm_l, ATRPeriod)))
HRef = norm_l <= norm_h[1] ? norm_h - norm_c[1] : norm_h - norm_c[1] - 0.5 *
(norm_l - norm_h[1])
LRef = norm_h >= norm_l[1] ? norm_c[1] - norm_l : norm_c[1] - norm_l - 0.5 *
(norm_l[1] - norm_h)
trueRange = trailType == 'modified' ? math.max(HiLo, HRef, LRef) : math.max(norm_h
- norm_l, math.abs(norm_h - norm_c[1]), math.abs(norm_l - norm_c[1]))
//}
/////////// TRADE LOGIC ////////////////////////
//{
loss = ATRFactor * Wild_ma(trueRange, ATRPeriod)
Up = norm_c - loss
Dn = norm_c + loss
TrendUp = Up
TrendDown = Dn
Trend = 1
TrendUp := norm_c[1] > TrendUp[1] ? math.max(Up, TrendUp[1]) : Up
TrendDown := norm_c[1] < TrendDown[1] ? math.min(Dn, TrendDown[1]) : Dn
Trend := norm_c > TrendDown[1] ? 1 : norm_c < TrendUp[1] ? -1 : nz(Trend[1], 1)
trail = Trend == 1 ? TrendUp : TrendDown
ex = 0.0
ex := ta.crossover(Trend, 0) ? norm_h : ta.crossunder(Trend, 0) ? norm_l : Trend ==
1 ? math.max(ex[1], norm_h) : Trend == -1 ? math.min(ex[1], norm_l) : ex[1]
//}
// //////// PLOT TP and SL /////////////
////// FIBONACCI LEVELS ///////////
//{
state = Trend == 1 ? 'long' : 'short'
fib1Level = 61.8
fib2Level = 78.6
fib3Level = 88.6
f1 = ex + (trail - ex) * fib1Level / 100
f2 = ex + (trail - ex) * fib2Level / 100
f3 = ex + (trail - ex) * fib3Level / 100
l100 = trail + 0
fill(plot(ShowSmartTrail ? (ta.sma(trail, smoothing)) : na, 'Trailingstop',
style=plot.style_line, color=Trend == 1 ? color.new(#2157f9, 0) : Trend == -1 ?
color.new(#ff1100, 0) : na), plot( ShowSmartTrail ? (ta.sma(f2, smoothing)) : na,
'Fib 2', style=plot.style_line, display=display.none), color=state == 'long' ?
color.new(#2157f9, 80) : state == 'short' ? color.new(#ff1100, 80) : na)

// -Inputs
═══════════════════════════════════════════════════════════════════════════════════
═══ //

tooltip_threshold = 'Deviation is a multiplier that affects how much the price


should deviate from the previous pivot in order for the bar to become a new pivot'
+
'\n\nDepth affects the minimum number of bars that will be
taken into account when building'
tooltip_pitch = 'A Pitchfan is a set of rays spreading out of the point of a
trend\'s beginning. These rays inclined with the coefficients formed by a Fibonacci
number sequence' +
'\nIt is recommended to apply a Pitchfan after the first wave
of the trend has passed and the correction has clearly begun'

i_dev_thresh = ta.atr(10) / close * 100 * input.float(3, 'Deviation', minval=0,


inline='Pivots', tooltip=tooltip_threshold)
i_depth = input.int(11, ' Depth', minval=1, inline='Pivots')
i_histPivot = input.int(0, 'Historical PitchFan/Fibonacci Levels ', minval=0)

group_pitch = 'PitchFan Settings'

i_pPitch = input.bool(true, 'PitchFan Rays | Background', inline =


'pfan', group=group_pitch, tooltip=tooltip_pitch)
i_bgPitch = input.bool(true, '', inline = 'pfan', group=group_pitch)

i_pLabels = input.string('Levels (Prices)', 'PitchFan Level Labels',


options=['Levels', 'Prices', 'Levels (Prices)', 'None'], inline='pLines',
group=group_pitch)
i_levelsS = input.string('Small', '', options=['Small', 'Normal'], inline='pLines',
group=group_pitch)

i_pcolor_m = input.color(#f44336, 'Median Line ', inline='PLM',


group=group_pitch)
i_pwidth_m = input.int(3, '', minval=1, inline='PLM', group=group_pitch)
i_pstyle_m = input.string('Solid', '', options=['Dashed', 'Dotted', 'Solid'],
inline='PLM', group=group_pitch)
group_zz = 'Zig Zag Settings'
i_zigZag = input.bool(false, 'Zig Zag ', inline='ZZ', group=group_zz)
i_zzColor = input.color(color.orange, '', inline='ZZ', group=group_zz)
i_zzWidth = input.int(1, '', minval=1, inline='ZZ', group=group_zz)
i_zzStyle = input.string('Solid', '', options=['Dashed', 'Dotted', 'Solid'],
inline='ZZ', group=group_zz)

group_fib = 'Fibonacci Retracement/Extension Settings'

i_isFib = input.bool(false, 'Pick a Fibonacci Tool', inline='FIB',


group=group_fib)
i_fibTool = input.string('Retracements', ' ', options=['Retracements',
'Extentions'], inline='FIB', group=group_fib)

i_reverse = input.bool(false, 'Reverse Levels ', inline='fLines',


group=group_fib)
i_extend = input.bool(false, 'Extend Lines', inline='fLines', group=group_fib)

i_levels = input.string('Levels', 'Level Labels', options=['Levels', 'Prices',


'Levels (Prices)', 'None'], inline='fLines1', group=group_fib)
i_levelsP = input.string('Pivot Start', '', options=['Last Bar', 'Pivot Start'],
inline='fLines1', group=group_fib)
i_levelsF = input.string('Small', '', options=['Small', 'Normal'],
inline='fLines1', group=group_fib)

// -Calculations
════════════════════════════════════════════════════════════════════════════════ //

var line lineLast = na


var int iLast = 0
var int iPrev = 0
var float pLast = 0
var isHighLast = false // otherwise the last pivot is a low pivot

var iPrevPivotRef = 0
var pPrevPivotRef = 0.
var iLastPivotRef = 0
var pLastPivotRef = 0.

pivots(src, length, isHigh) =>


l2 = length * 2
c = nz(src[length])
ok = true

for i = 0 to l2 by 1
if isHigh and src[i] > c
ok := false
ok

if not isHigh and src[i] < c


ok := false
ok
if ok
[bar_index[length], c]
else
[int(na), float(na)]

[iH, pH] = pivots(high, i_depth / 2, true )


[iL, pL] = pivots(low , i_depth / 2, false)
calc_dev(base_price, price) =>
100 * (price - base_price) / price

pivotFound(dev, isHigh, index, price) =>


if isHighLast == isHigh and not na(lineLast)
// same direction
if isHighLast ? price > pLast : price < pLast
line.set_xy2(lineLast, index, price)
[lineLast, isHighLast]
else
[line(na), bool(na)]
else
// reverse the direction (or create the very first line)
if math.abs(dev) > i_dev_thresh
// price move is significant

//
-----------------------------------------------------------------------------------
----- //
[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]
//
-----------------------------------------------------------------------------------
----- //

id = line.new(iLast, pLast, index, price, color=zzCol, width=zzWid,


style=zzSty)
[id, isHigh]
else
[line(na), bool(na)]

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

var a_lnr = array.new_line()


if ta.change(time) and array.size(a_lnr) > 0
for i = 1 to array.size(a_lnr)
line.delete(array.shift(a_lnr))

var a_lns = array.new_line()


if ta.change(time) and array.size(a_lns) > 0
for i = 1 to array.size(a_lns)
line.delete(array.shift(a_lns))

var a_lf = array.new_linefill()


if ta.change(time) and array.size(a_lf) > 0
for i = 1 to array.size(a_lf)
linefill.delete(array.shift(a_lf))

f_drawPitchLine(_iStart, _pStart, _iEnd, _pEnd, _color, _width, _style, hg) =>


style = _style == 'Solid' ? line.style_solid : _style == 'Dotted' ?
line.style_dotted : line.style_dashed
if _iEnd < bar_index
if hg
array.push(a_lnr, line.new(_iStart, _pStart, _iEnd, _pEnd,
xloc.bar_index, extend.right, _color, style, _width))
else
array.push(a_lns, line.new(_iStart, _pStart, _iEnd, _pEnd,
xloc.bar_index, extend.right, _color, style, _width))

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)

f_drawLabelX(_x, _y, _text, _xloc, _yloc, _color, _style, _textcolor, _size,


_textalign, _tooltip) =>
var id = label.new(_x, _y, _text, _xloc, _yloc, _color, _style, _textcolor,
_size, _textalign, _tooltip)
label.set_xy(id, _x, _y)
label.set_text(id, _text + '\n\n')
label.set_tooltip(id, _tooltip)

f_crossingLevel(_curret, _level) =>


_level > _curret and _level < _curret[1] or _level < _curret and _level >
_curret[1]

iStartMedian = i_histPivot > 0 ? ta.valuewhen(ta.change(iPrevPivotRef),


iPrevPivotRef, i_histPivot + 1) : ta.valuewhen(ta.change(iPrevPivotRef),
iPrevPivotRef, 1)
pStartMedian = i_histPivot > 0 ? ta.valuewhen(ta.change(pPrevPivotRef),
pPrevPivotRef, i_histPivot + 1) : ta.valuewhen(ta.change(pPrevPivotRef),
pPrevPivotRef, 1)
iLastPivot = i_histPivot > 0 ? ta.valuewhen(ta.change(iLastPivotRef),
iLastPivotRef, i_histPivot) : ta.valuewhen(ta.change(iLastPivotRef),
iLastPivotRef, 0)
pLastPivot = i_histPivot > 0 ? ta.valuewhen(ta.change(pLastPivotRef),
pLastPivotRef, i_histPivot) : ta.valuewhen(ta.change(pLastPivotRef),
pLastPivotRef, 0)
iPrevPivot = i_histPivot > 0 ? ta.valuewhen(ta.change(iPrevPivotRef),
iPrevPivotRef, i_histPivot) : ta.valuewhen(ta.change(iPrevPivotRef),
iPrevPivotRef, 0)
pPrevPivot = i_histPivot > 0 ? ta.valuewhen(ta.change(pPrevPivotRef),
pPrevPivotRef, i_histPivot) : ta.valuewhen(ta.change(pPrevPivotRef),
pPrevPivotRef, 0)

iEndMedian = int(math.avg(iPrevPivot, iLastPivot))


pEndMedian = math.avg(pPrevPivot, pLastPivot)

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)

slopeMedianP = (pEndMedian - pStartMedian) / (iEndMedian - iStartMedian)


mPrice = slopeMedianP * bar_index + pStartMedian - slopeMedianP * iStartMedian

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')

processPitchLevel(show, level, colorL, widthL, styleL) =>


if i_pPitch
iPvtDiff = math.abs(iPrevPivot - iLastPivot) / 2
pPvtDiff = math.abs(pPrevPivot - pLastPivot) / 2

iEndX = pPrevPivot > pLastPivot ? int(math.round(iEndMedian - iPvtDiff *


level)) : int(math.round(iEndMedian + iPvtDiff * level))
pEndX = pEndMedian + pPvtDiff * level

iEndY = pPrevPivot > pLastPivot ? int(math.round(iEndMedian + iPvtDiff *


level)) : int(math.round(iEndMedian - iPvtDiff * level))
pEndY = pEndMedian - pPvtDiff * level

if show
f_drawPitchLine(iStartMedian, pStartMedian, iEndX, pEndX, colorL,
widthL, styleL, true )
f_drawPitchLine(iStartMedian, pStartMedian, iEndY, pEndY, colorL,
widthL, styleL, false)

slopeX = (pEndX - pStartMedian) / (iEndX - iStartMedian)


slopeY = (pEndY - pStartMedian) / (iEndY - iStartMedian)

rPrice = slopeX * bar_index + pStartMedian - slopeX * iStartMedian


sPrice = slopeY * bar_index + pStartMedian - slopeY * iStartMedian

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

f_drawLabelX(bar_index, rPrice, rTxt, xloc.bar_index, yloc.price,


#00000000, label.style_label_left, colorL , size , text.align_left, rTip)
f_drawLabelX(bar_index, sPrice, sTxt, xloc.bar_index, yloc.price,
#00000000, label.style_label_left, colorL , size , text.align_left, sTip)
f_drawLabelX(bar_index, rPrice, '' , xloc.bar_index, yloc.price,
colorL , label.style_circle , #00000000, size.auto, text.align_left, '' )
f_drawLabelX(bar_index, sPrice, '' , xloc.bar_index, yloc.price,
colorL , label.style_circle , #00000000, size.auto, text.align_left, '' )

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)))

processFibLevel(_show, _level, _color) =>


if i_isFib
pPivotDiff = math.abs(pPrevPivot - pLastPivot)
price = 0.

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)

offset = math.abs(pPrevPivot - pStartMedian)


price := pLastPivot < pPrevPivot ? pPrevPivot - pPivotDiff + (i_reverse
? -1 : 1) * offset * _level : pPrevPivot + pPivotDiff - (i_reverse ? -1 : 1) *
offset * _level
price

else if i_fibTool == 'Retracements'


f_drawLineX(iPrevPivot, pPrevPivot, iLastPivot, pLastPivot,
xloc.bar_index, extend.none, color.gray, line.style_dashed, 1)

price := pLastPivot < pPrevPivot ? (i_reverse ? pLastPivot :


pPrevPivot) - (i_reverse ? -1 : 1) * pPivotDiff * _level : (i_reverse ?
pLastPivot : pPrevPivot) + (i_reverse ? -1 : 1) * pPivotDiff * _level
price

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))

pshow_0_25 = input.bool(false, '', inline='pLevel_0_25', group=group_pitch)


pvalue_0_25 = input.float(.25, '', minval=.0, inline='pLevel_0_25',
group=group_pitch)
pcolor_0_25 = input.color(#ffb74d, '', inline='pLevel_0_25', group=group_pitch)
pwidth_0_25 = input.int(1, '', minval=1, inline='pLevel_0_25', group=group_pitch)
pstyle_0_25 = input.string('Dashed', '', options=['Dashed', 'Dotted', 'Solid'],
inline='pLevel_0_25', group=group_pitch)
processPitchLevel(pshow_0_25, pvalue_0_25, pcolor_0_25, pwidth_0_25, pstyle_0_25)

pshow_0_382 = input.bool(false, '', inline='pLevel_0_382', group=group_pitch)


pvalue_0_382 = input.float(.382, '', minval=.0, inline='pLevel_0_382',
group=group_pitch)
pcolor_0_382 = input.color(#81c784, '', inline='pLevel_0_382', group=group_pitch)
pwidth_0_382 = input.int(1, '', minval=1, inline='pLevel_0_382', group=group_pitch)
pstyle_0_382 = input.string('Dotted', '', options=['Dashed', 'Dotted', 'Solid'],
inline='pLevel_0_382', group=group_pitch)
processPitchLevel(pshow_0_382, pvalue_0_382, pcolor_0_382, pwidth_0_382,
pstyle_0_382)

pshow_0_50 = input.bool(true, '', inline='pLevel_0_50', group=group_pitch)


pvalue_0_50 = input.float(.5, '', minval=.0, inline='pLevel_0_50',
group=group_pitch)
pcolor_0_50 = input.color(#4caf50, '', inline='pLevel_0_50', group=group_pitch)
pwidth_0_50 = input.int(1, '', minval=1, inline='pLevel_0_50', group=group_pitch)
pstyle_0_50 = input.string('Solid', '', options=['Dashed', 'Dotted', 'Solid'],
inline='pLevel_0_50', group=group_pitch)
processPitchLevel(pshow_0_50, pvalue_0_50, pcolor_0_50, pwidth_0_50, pstyle_0_50)

pshow_0_618 = input.bool(false, '', inline='pLevel_0_618', group=group_pitch)


pvalue_0_618 = input.float(.618, '', minval=.0, inline='pLevel_0_618',
group=group_pitch)
pcolor_0_618 = input.color(#009688, '', inline='pLevel_0_618', group=group_pitch)
pwidth_0_618 = input.int(1, '', minval=1, inline='pLevel_0_618', group=group_pitch)
pstyle_0_618 = input.string('Dotted', '', options=['Dashed', 'Dotted', 'Solid'],
inline='pLevel_0_618', group=group_pitch)
processPitchLevel(pshow_0_618, pvalue_0_618, pcolor_0_618, pwidth_0_618,
pstyle_0_618)

pshow_0_75 = input.bool(false, '', inline='pLevel_0_75', group=group_pitch)


pvalue_0_75 = input.float(.75, '', minval=.0, inline='pLevel_0_75',
group=group_pitch)
pcolor_0_75 = input.color(#64b5f6, '', inline='pLevel_0_75', group=group_pitch)
pwidth_0_75 = input.int(1, '', minval=1, inline='pLevel_0_75', group=group_pitch)
pstyle_0_75 = input.string('Dashed', '', options=['Dashed', 'Dotted', 'Solid'],
inline='pLevel_0_75', group=group_pitch)
processPitchLevel(pshow_0_75, pvalue_0_75, pcolor_0_75, pwidth_0_75, pstyle_0_75)

pshow_1 = input.bool(true, '', inline='pLevel_1', group=group_pitch)


pvalue_1 = input.float(1, '', minval=.0, inline='pLevel_1', group=group_pitch)
pcolor_1 = input.color(#2196f3, '', inline='pLevel_1', group=group_pitch)
pwidth_1 = input.int(2, '', minval=1, inline='pLevel_1', group=group_pitch)
pstyle_1 = input.string('Solid', '', options=['Dashed', 'Dotted', 'Solid'],
inline='pLevel_1', group=group_pitch)
processPitchLevel(pshow_1, pvalue_1, pcolor_1, pwidth_1, pstyle_1)

pshow_1_50 = input.bool(false, '', inline='pLevel_1_50', group=group_pitch)


pvalue_1_50 = input.float(1.5, '', minval=.0, inline='pLevel_1_50',
group=group_pitch)
pcolor_1_50 = input.color(#9c27b0, '', inline='pLevel_1_50', group=group_pitch)
pwidth_1_50 = input.int(1, '', minval=1, inline='pLevel_1_50', group=group_pitch)
pstyle_1_50 = input.string('Solid', '', options=['Dashed', 'Dotted', 'Solid'],
inline='pLevel_1_50', group=group_pitch)
processPitchLevel(pshow_1_50, pvalue_1_50, pcolor_1_50, pwidth_1_50, pstyle_1_50)

pshow_1_75 = input.bool(false, '', inline='pLevel_1_75', group=group_pitch)


pvalue_1_75 = input.float(1.75, '', minval=.0, inline='pLevel_1_75',
group=group_pitch)
pcolor_1_75 = input.color(#e91e63, '', inline='pLevel_1_75', group=group_pitch)
pwidth_1_75 = input.int(1, '', minval=1, inline='pLevel_1_75', group=group_pitch)
pstyle_1_75 = input.string('Dashed', '', options=['Dashed', 'Dotted', 'Solid'],
inline='pLevel_1_75', group=group_pitch)
processPitchLevel(pshow_1_75, pvalue_1_75, pcolor_1_75, pwidth_1_75, pstyle_1_75)

pshow_2 = input.bool(false, '', inline='pLevel_2', group=group_pitch)


pvalue_2 = input.float(2, '', minval=.0, inline='pLevel_2', group=group_pitch)
pcolor_2 = input.color(#e57373, '', inline='pLevel_2', group=group_pitch)
pwidth_2 = input.int(2, '', minval=1, inline='pLevel_2', group=group_pitch)
pstyle_2 = input.string('Solid', '', options=['Dashed', 'Dotted', 'Solid'],
inline='pLevel_2', group=group_pitch)
processPitchLevel(pshow_2, pvalue_2, pcolor_2, pwidth_2, pstyle_2)

show_0 = input.bool(true, '', inline='Level0', group=group_fib)


value_0 = input.int(0, '', inline='Level0', group=group_fib)
color_0 = input.color(#787b86, '', inline='Level0', group=group_fib)
processFibLevel(show_0, value_0, color_0)

show_0_236 = input.bool(true, '', inline='Level0', group=group_fib)


value_0_236 = input.float(0.236, '', inline='Level0', group=group_fib)
color_0_236 = input.color(#f44336, '', inline='Level0', group=group_fib)
processFibLevel(show_0_236, value_0_236, color_0_236)

show_0_382 = input.bool(true, '', inline='Level1', group=group_fib)


value_0_382 = input.float(0.382, '', inline='Level1', group=group_fib)
color_0_382 = input.color(#81c784, '', inline='Level1', group=group_fib)
processFibLevel(show_0_382, value_0_382, color_0_382)

show_0_5 = input.bool(true, '', inline='Level1', group=group_fib)


value_0_5 = input.float(0.5, '', inline='Level1', group=group_fib)
color_0_5 = input.color(#4caf50, '', inline='Level1', group=group_fib)
processFibLevel(show_0_5, value_0_5, color_0_5)

show_0_618 = input.bool(true, '', inline='Level2', group=group_fib)


value_0_618 = input.float(0.618, '', inline='Level2', group=group_fib)
color_0_618 = input.color(#009688, '', inline='Level2', group=group_fib)
processFibLevel(show_0_618, value_0_618, color_0_618)

show_0_65 = input.bool(false, '', inline='Level2', group=group_fib)


value_0_65 = input.float(0.65, '', inline='Level2', group=group_fib)
color_0_65 = input.color(#009688, '', inline='Level2', group=group_fib)
processFibLevel(show_0_65, value_0_65, color_0_65)

show_0_786 = input.bool(true, '', inline='Level3', group=group_fib)


value_0_786 = input.float(0.786, '', inline='Level3', group=group_fib)
color_0_786 = input.color(#64b5f6, '', inline='Level3', group=group_fib)
processFibLevel(show_0_786, value_0_786, color_0_786)

show_1 = input.bool(true, '', inline='Level3', group=group_fib)


value_1 = input.int(1, '', inline='Level3', group=group_fib)
color_1 = input.color(#787b86, '', inline='Level3', group=group_fib)
processFibLevel(show_1, value_1, color_1)
show_1_272 = input.bool(false, '', inline='Level4', group=group_fib)
value_1_272 = input.float(1.272, '', inline='Level4', group=group_fib)
color_1_272 = input.color(#81c784, '', inline='Level4', group=group_fib)
processFibLevel(show_1_272, value_1_272, color_1_272)

show_1_414 = input.bool(false, '', inline='Level4', group=group_fib)


value_1_414 = input.float(1.414, '', inline='Level4', group=group_fib)
color_1_414 = input.color(#f44336, '', inline='Level4', group=group_fib)
processFibLevel(show_1_414, value_1_414, color_1_414)

show_1_618 = input.bool(true, '', inline='Level5', group=group_fib)


value_1_618 = input.float(1.618, '', inline='Level5', group=group_fib)
color_1_618 = input.color(#2196f3, '', inline='Level5', group=group_fib)
processFibLevel(show_1_618, value_1_618, color_1_618)

show_1_65 = input.bool(false, '', inline='Level5', group=group_fib)


value_1_65 = input.float(1.65, '', inline='Level5', group=group_fib)
color_1_65 = input.color(#2196f3, '', inline='Level5', group=group_fib)
processFibLevel(show_1_65, value_1_65, color_1_65)

show_2_618 = input.bool(false, '', inline='Level6', group=group_fib)


value_2_618 = input.float(2.618, '', inline='Level6', group=group_fib)
color_2_618 = input.color(#f44336, '', inline='Level6', group=group_fib)
processFibLevel(show_2_618, value_2_618, color_2_618)

show_2_65 = input.bool(false, '', inline='Level6', group=group_fib)


value_2_65 = input.float(2.65, '', inline='Level6', group=group_fib)
color_2_65 = input.color(#f44336, '', inline='Level6', group=group_fib)
processFibLevel(show_2_65, value_2_65, color_2_65)

show_3_618 = input.bool(false, '', inline='Level7', group=group_fib)


value_3_618 = input.float(3.618, '', inline='Level7', group=group_fib)
color_3_618 = input.color(#9c27b0, '', inline='Level7', group=group_fib)
processFibLevel(show_3_618, value_3_618, color_3_618)

show_3_65 = input.bool(false, '', inline='Level7', group=group_fib)


value_3_65 = input.float(3.65, '', inline='Level7', group=group_fib)
color_3_65 = input.color(#9c27b0, '', inline='Level7', group=group_fib)
processFibLevel(show_3_65, value_3_65, color_3_65)

show_4_236 = input.bool(false, '', inline='Level8', group=group_fib)


value_4_236 = input.float(4.236, '', inline='Level8', group=group_fib)
color_4_236 = input.color(#e91e63, '', inline='Level8', group=group_fib)
processFibLevel(show_4_236, value_4_236, color_4_236)

show_4_618 = input.bool(false, '', inline='Level8', group=group_fib)


value_4_618 = input.float(4.618, '', inline='Level8', group=group_fib)
color_4_618 = input.color(#81c784, '', inline='Level8', group=group_fib)
processFibLevel(show_4_618, value_4_618, color_4_618)

show_neg_0_236 = input.bool(false, '', inline='Level9', group=group_fib)


value_neg_0_236 = input.float(-0.236, '', inline='Level9', group=group_fib)
color_neg_0_236 = input.color(#f44336, '', inline='Level9', group=group_fib)
processFibLevel(show_neg_0_236, value_neg_0_236, color_neg_0_236)

show_neg_0_382 = input.bool(false, '', inline='Level9', group=group_fib)


value_neg_0_382 = input.float(-0.382, '', inline='Level9', group=group_fib)
color_neg_0_382 = input.color(#81c784, '', inline='Level9', group=group_fib)
processFibLevel(show_neg_0_382, value_neg_0_382, color_neg_0_382)

show_neg_0_618 = input.bool(false, '', inline='Level10', group=group_fib)


value_neg_0_618 = input.float(-0.618, '', inline='Level10', group=group_fib)
color_neg_0_618 = input.color(#009688, '', inline='Level10', group=group_fib)
processFibLevel(show_neg_0_618, value_neg_0_618, color_neg_0_618)

show_neg_0_65 = input.bool(false, '', inline='Level10', group=group_fib)


value_neg_0_65 = input.float(-0.65, '', inline='Level10', group=group_fib)
color_neg_0_65 = input.color(#009688, '', inline='Level10', group=group_fib)
processFibLevel(show_neg_0_65, value_neg_0_65, color_neg_0_65)

var table logo = table.new(position.bottom_right, 1, 1)


table.cell(logo, 0, 0, '☼☾ ', text_size=size.normal, text_color=color.teal)

//}
// 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')

bd1 = input(9, title='Frontrun Band Deviation')


bd2 = input(11, title='Initial Band Deviation')
bd3 = input(14, title='Final Band Deviation')
//logic
rg = kama(ta.tr, llength)
basis = kama(close, llength)
upper1 = basis + rg * bd1
upper2 = basis + rg * bd2
upper3 = basis + rg * bd3
lower1 = basis - rg * bd1
lower2 = basis - rg * bd2
lower3 = basis - rg * bd3
//ploting
pp1 = plot(show_rev ? upper1 : na, transp=100)
pp2 = plot(show_rev ? upper2 : na, transp=100)
pp3 = plot(show_rev ? upper3 : na, transp=100)
pp4 = plot(show_rev ? lower1 : na, transp=100)
pp5 = plot(show_rev ? lower2 : na, transp=100)
pp6 = plot(show_rev ? lower3 : na, transp=100)
fill(pp1, pp2, color=color.new(#57202c, 70))
fill(pp2, pp3, color=color.new(#57202c, 50))
fill(pp4, pp5, color=color.new(#103c3c, 70))
fill(pp5, pp6, color=color.new(#103c3c, 50))
// Candle Coloring
// Input
fastLength = input(title="Fast Length", defval=12)
slowLength = input(title="Slow Length", defval=26)
srrrc = input(title="Source", defval=close)
signalLength = input.int(title="Signal Smoothing", minval = 1, maxval = 50, defval
= 9)
// Data reference
[macd, signal, hist] = ta.macd(srrrc, fastLength, slowLength, signalLength)
// 4 level of green
greenHigh = #05df09
greenMidHigh = #05df09
greenMidLow = #388E3C
greenLow = #5f3a97
// Yellow
yellowLow = #5f3a97
// 4 level of red
redHigh = #ea0402
redMidHigh = #ea0402
redMidLow = #cc0402
redLow = #5f3a97
// Default color
candleBody = yellowLow
// Ranging trend
if hist > 0
if hist > hist[1] and hist[1] > 0
candleBody := greenLow

if hist < 0
if hist < hist[1] and hist[1] < 0
candleBody := redLow
// Bullish trend
if macd > 0 and hist > 0
candleBody := greenMidLow

if hist > hist[1] and macd[1] > 0 and hist[1] > 0


candleBody := greenMidHigh

if hist > hist[2] and macd[2] > 0 and hist[2] > 0


candleBody := greenHigh
// Bearish trend
if macd < 0 and hist < 0
candleBody := redMidLow

if hist < hist[1] and macd[1] < 0 and hist[1] < 0


candleBody := redMidHigh

if hist < hist[2] and macd[2] < 0 and hist[2] < 0


candleBody := redHigh
barcolor(candleBody) // Include suggestion by Shaheen204

// Function to check if a new day has started


_isNewDay(utcOffsetInMs) =>
dow = dayofweek(time + utcOffsetInMs)
dayChanged = dow != dow[1]
dayChanged

// Function to check if a new week has started


_isNewWeek(utcOffsetInMs) =>
woy = weekofyear(time + utcOffsetInMs)
weekChanged = woy != woy[1]
weekChanged

_bottomMarkText(barTime, utcOffsetInMs) =>


var monthShortNames = array.from('', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')
var weekdayShortNames = array.from('', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu',
'Fri', 'Sat')
weekdayShort = array.get(weekdayShortNames, dayofweek(barTime + utcOffsetInMs))
out = ''
+ weekdayShort
+ ' ' + str.tostring(dayofmonth(barTime + utcOffsetInMs))
+ ' ' + array.get(monthShortNames, month(barTime + utcOffsetInMs))
+ " '" + str.substring(str.tostring(year(barTime + utcOffsetInMs), '#'),
2)
+ ' ' + str.format_time(barTime, 'HH:mm')

// Function to get the highest and lowest prices of the previous day
_getPreviousDayHighLow(utcOffsetInMs) =>
dow = dayofweek(time + utcOffsetInMs)
var prevDayHigh = high
var prevDayHighTime = time

var prevDayLow = low


var prevDayLowTime = time

var dayHigh = high


var dayHighTime = time

var dayLow = low


var dayLowTime = 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

if dayLow > low


dayLow := low
dayLowTime := time

[prevDayHigh, prevDayHighTime, prevDayLow, prevDayLowTime]

// Input for custom UTC offset


utcOffset = input.int(0, title="UTC Offset (in hours)", minval=-12, maxval=12)
utcOffsetInMs = utcOffset * 60 * 60 * 1000

// Daily separator inputs


var dailyGroup = 'Daily Separator'
dailySeparatorColor = input.color(color.orange, title='Color', group=dailyGroup)
dailySeparatorStyleInput = input.string('Solid', title='Style', options=['Solid',
'Dotted'], display=display.none, group=dailyGroup)
dailySeparatorWidthInput = input.int(1, title='Width', minval=1,
display=display.none, group=dailyGroup)
dailySeparatorLabelTextColor = input.color(color.white, title='Label Text Color',
group=dailyGroup)
dailySeparatorStyle = dailySeparatorStyleInput == 'Solid' ? line.style_solid :
line.style_dotted

// Weekly separator inputs


var weeklyGroup = 'Weekly Separator'
weeklySeparatorColorInput = input.color(color.gray, title='Color',
group=weeklyGroup)
weeklySeparatorStyleInput = input.string('Solid', title='Style', options=['Solid',
'Dotted'], display=display.none, group=weeklyGroup)
weeklySeparatorWidthInput = input.int(3, title='Width', minval=1,
display=display.none, group=weeklyGroup)
weeklySeparatorStyle = weeklySeparatorStyleInput == 'Solid' ? line.style_solid :
line.style_dotted

var prevDayHLGroup = 'Previous Day H&L'


prevDayHLColorInput = input.color(color.gray, title='Color', group=prevDayHLGroup)
prevDayHLTextColorInput = input.color(color.orange, title='Text Color',
group=prevDayHLGroup)
prevDayHLStyleInput = input.string('Dotted', title='Style', options=['Solid',
'Dotted'], display=display.none, group=prevDayHLGroup)
prevDayHLWidthInput = input.int(3, title='Width', minval=1, display=display.none,
group=prevDayHLGroup)
prevDayHLStyle = prevDayHLStyleInput == 'Solid' ? line.style_solid :
line.style_dotted

var transpColor = color.new(color.white, 100)


var weekdayFullNames = array.from('', 'Sunday', 'Monday', 'Tuesday', 'Wednesday',
'Thursday', 'Friday', 'Saturday')

var box weekdayTopLabelBox = na


var box[] weekdayTopLabels = array.new_box(0)
var label[] weekdayBottomLabels = array.new_label(0)

var string periodD = "D"


var string periodW = "W"
var string periodM = "M"
var string periodY = "12M"
var int mult = timeframe.multiplier
var bool isHourly = timeframe.isminutes and mult % 60 == 0
var bool isMinuteLessThan30 = timeframe.isminutes and mult < 30
var string tfAuto =
timeframe.isseconds or isMinuteLessThan30 ? periodD :
isHourly ? periodW :
timeframe.isdaily ? periodM :
timeframe.isweekly or timeframe.ismonthly ? periodY :
periodW

pivotLevels = ta.pivot_point_levels('Traditional', timeframe.change(tfAuto))


pivot = array.get(pivotLevels, 0)
weekdayTopLabelBoxTop = array.get(pivotLevels, 5)
weekdayTopLabelBoxBottom = array.get(pivotLevels, 4)

weekdayBottomLabelLevel = array.get(pivotLevels, 6)

isNewPivot = pivot != pivot[1]


isNewDay = _isNewDay(utcOffsetInMs)
isNewWeek = _isNewWeek(utcOffsetInMs)

// Plot daily separator line


if isNewDay
weekdayFull = array.get(weekdayFullNames, dayofweek(time + utcOffsetInMs))
line.new(bar_index, low, bar_index, high, style=dailySeparatorStyle,
width=dailySeparatorWidthInput, color=dailySeparatorColor, extend=extend.both)
weekdayTopLabelBox := box.new(bar_index, weekdayTopLabelBoxTop, bar_index,
weekdayTopLabelBoxBottom, xloc=xloc.bar_index, bgcolor=transpColor,
border_color=transpColor, text=weekdayFull, text_color=dailySeparatorColor,
text_size=size.small, text_halign = text.align_center, text_valign =
text.align_top)
array.push(weekdayTopLabels, weekdayTopLabelBox)
array.push(weekdayBottomLabels, label.new(bar_index, weekdayBottomLabelLevel,
text=_bottomMarkText(time, utcOffsetInMs), color=dailySeparatorColor,
textcolor=dailySeparatorLabelTextColor , style=label.style_label_up))
else
box.set_right(weekdayTopLabelBox, bar_index)

if isNewPivot and array.size(weekdayTopLabels) > 0


for i = 0 to array.size(weekdayTopLabels) - 1
box.set_top(array.get(weekdayTopLabels, i), weekdayTopLabelBoxTop)
box.set_bottom(array.get(weekdayTopLabels, i), weekdayTopLabelBoxBottom)
label.set_y(array.get(weekdayBottomLabels, i), weekdayBottomLabelLevel)

// Plot weekly separator line


if isNewWeek
line.new(bar_index, low, bar_index, high, color=weeklySeparatorColorInput,
style=weeklySeparatorStyle, width=weeklySeparatorWidthInput, extend=extend.both)

// Plot highest and lowest prices of the previous day


[prevDayHigh, prevDayHighTime, prevDayLow, prevDayLowTime] =
_getPreviousDayHighLow(utcOffsetInMs)
var line prevDayHighLine = line.new(time, prevDayHigh, time, prevDayHigh,
xloc=xloc.bar_time, color=prevDayHLColorInput, width=1)
var label prevDayHighLabel = label.new(time, prevDayHigh, xloc=xloc.bar_time,
text='HOD', color=transpColor, textcolor=prevDayHLTextColorInput,
style=label.style_label_down)//, style=label.style_label_lower_left)

var line prevDayLowLine = line.new(time, prevDayLow, time, prevDayLow,


xloc=xloc.bar_time, color=prevDayHLColorInput, width=1)
var label prevDayLowLabel = label.new(time, prevDayLow, xloc=xloc.bar_time,
text='LOD', color=transpColor, textcolor=prevDayHLTextColorInput,
style=label.style_label_up)//, style=label.style_label_upper_left)

if isNewDay
line.set_xy1(prevDayHighLine, prevDayHighTime, prevDayHigh)
line.set_xy2(prevDayHighLine, prevDayHighTime, prevDayHigh)
label.set_xy(prevDayHighLabel, prevDayHighTime, prevDayHigh)

line.set_xy1(prevDayLowLine, prevDayLowTime, prevDayLow)


line.set_xy2(prevDayLowLine, prevDayLowTime, prevDayLow)
label.set_xy(prevDayLowLabel, prevDayLowTime, prevDayLow)
else
t = time//chart.right_visible_bar_time
line.set_x2(prevDayHighLine, t)
label.set_x(prevDayHighLabel, t)

line.set_x2(prevDayLowLine, t)
label.set_x(prevDayLowLabel, t)

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