You are on page 1of 10

// THIS CODE USES CODE FROM AI SIGNALS GOLD!!!

//why ? because i was bored and i was lazy so i did not want to put all my
freetime on this but i did add extra options
// disclaimer : this does nt contain all options... if there is something you
would like me to add dm me
// @ moneymovesalgo
//
//-----------------------------------------
====================================================-------------------------------
\\
//
\\
//@version=5
indicator("EzAlgo V1.0", shorttitle='EzAlgo V1.0', overlay=true)

// -------------------------- user inputs ----------------------- \\


enSignals = input.bool(true, 'Enable Signals', group='Buy & Sell')
per1 = input.int(defval=3, minval=1, title='Sensitiviy', group='Buy & Sell')
enObOs = input.bool(true, 'Show OverBought & Oversold', group='Signals')
enrevser = input.bool(true, 'Reversal Signals', group='Signals')

RSI_Period = input(14, title='Overall Reversal Sensitivitiy', group='Reversal


Signals')
SF = input(5, title='Reversal Agility', group='Reversal Signals')
KQE = input(4.238, title='Reversal Fast Senstivity', group='Reversal Signals')
ThreshHold = input(10, title='Reversal Thresh-hold', group='Reversal Signals')

ensr = input.bool(true, 'Enable Support And Resistance', group='S & R')


ensra = input.bool(true, 'Enable Support And Resistance Zones', group='S & R')

enCloud = input.bool(true, 'Enable Trend Ribbon', group='Cloud')


volBands = input.bool(true, 'Show Bands', group='Cloud')
mal = input.bool(false, 'Show Trend Moving Average Line', inline='s')
mals = input.int(80, '', inline='s')

showSwings = input.bool(false, 'Show Swing Highs And Lows', group='Swing Higher


Highs & Lower Lows')
lb = input.int(5, title='L', minval=1, inline='HHLL', group='Swing Higher Highs &
Lower Lows')
rb = input.int(5, title='R', minval=1, inline='HHLL', group='Swing Higher Highs &
Lower Lows')
color colsh = input.color(color.new(#0dbbff, 18), 'High\'s', inline='sH',
group='Swing Higher Highs & Lower Lows')
color colsl = input.color(color.new(#e93e63, 18), 'Low\'s', inline='sH',
group='Swing Higher Highs & Lower Lows')

levelsl = input.bool(false, "Sl 1", group="TP & SL")


levels1 = input.bool(false, "TP 1", group="TP & SL", inline='tp1')
r1 = input.float(0.7, '', group='TP & SL', inline='tp1')
levels2 = input.bool(false, "TP 2", group="TP & SL", inline='tp2')
r2 = input.float(1.2, '', group='TP & SL', inline='tp2')
levels3 = input.bool(false, "TP 3", group="TP & SL", inline='tp3')
r3 = input.float(1.5, '', group='TP & SL', inline='tp3')
atrRisk = input.int(defval=4, minval=1, maxval=4, title="Risk To Reward",
group="TP & SL")

// -------------------------- signal function ------------------------ \\ based on


free algo's ai signal gold
supertrend(_src, factor, atrLen) =>
atr = ta.atr(atrLen)
upperBand = _src + factor * atr
lowerBand = _src - factor * atr
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(atr[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]
[supertrend, direction] = supertrend(close, per1, 11)
sma9 = ta.sma(close, 13)

bull = ta.crossover(close, supertrend)


bear = ta.crossunder(close, supertrend)

y1 = low - (ta.atr(30) * 2)
y2 = high + (ta.atr(30) * 2)

// -------------------------------- new buy functions


---------------------------- //
mult1 = 1.5

per2 = 50
mult2 = 3

smoothrng(x, t, m) =>
wper = t * 2 - 1
avrng = ta.ema(math.abs(x - x[1]), t)
smoothrng = ta.ema(avrng, wper) * m
smoothrng
smrng1 = smoothrng(close, per1 *9, mult1)
smrng2 = smoothrng(close, per2, mult2)
smrng = (smrng1 + smrng2) / 2

// -------------------- \\

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
rngfilt
filt = rngfilt(close, smrng)

upward = 0.0
upward := filt > filt[1] ? nz(upward[1]) + 1 : filt < filt[1] ? 0 : nz(upward[1])
downward = 0.0
downward := filt < filt[1] ? nz(downward[1]) + 1 : filt > filt[1] ? 0 :
nz(downward[1])
hband = filt + smrng
lband = filt - smrng

longCond = bool(na)
shortCond = bool(na)
longCond := close > filt and close > close[1] and upward > 0 or close > filt and
close < close[1] and upward > 0
shortCond := close < filt and close < close[1] and downward > 0 or close < filt and
close > close[1] and downward > 0

CondIni = 0
CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1]

long = longCond and CondIni[1] == -1


short = shortCond and CondIni[1] == 1

// ---------------------------------- plot buy & sell signal


-------------------------- \\

// Plotting

plotshape(long, title='Long', text='Buy', style=shape.labelup,


textcolor=color.new(color.white, 0), size=size.normal, location=location.belowbar,
color=color.new(#0dbbff, 0), editable=false)
plotshape(short, title='Short', text='Sell', style=shape.labeldown,
textcolor=color.new(color.white, 0), size=size.normal, location=location.abovebar,
color=color.new(#e93e63, 0), editable=false)

// Alerts
alertcondition(long and enSignals, title='Buy Signal' , message='Buy Signal Has
Appeared For EzAlgo V.5' )
alertcondition(short and enSignals, title='Sell Signal', message='Sell Signal Has
Appeared For EzAlgo V.5')

// ---------------------------- cloud ---------------------------- \\


candle = ta.sma(close, 5)
reach = ta.sma(close, 8)
candlep = plot(enCloud ? candle : na, color=color.new(color.white, 100))
reachp = plot(enCloud ? reach : na, color=color.new(color.white, 100))
fill(reachp, candlep, color= candle > reach ? color.new(#00DBFF, 75) :
color.new(#E93E63, 75))

barcolor(close > filt ? #00DBFF99 : #E93E6399)

// ====================--------------------- tp & sl -----------------


=================== \\ based on free algo's ai signal gold

lvlLines = (true)
linesStyle = ("SOLID")
lvlDecimals = (4)
lvlDistance = (1)
atrLen = (14)

decimals = lvlDecimals == 1 ? "#.#" : lvlDecimals == 2 ? "#.##" : lvlDecimals == 3


? "#.###" : lvlDecimals == 4 ? "#.####" : lvlDecimals == 5 ? "#.#####" :
lvlDecimals == 6 ? "#.######" : lvlDecimals == 7 ? "#.#######" : "#.########"
trigger = bull ? 1 : 0
trigger2 = bear ? 0 : 1
atrBand = ta.atr(atrLen) * atrRisk
atrStop = trigger == 1 ? low - atrBand : high + atrBand
atrStop2 = trigger2 == -1 ? high + atrBand : low - atrBand

countBull = ta.barssince(bull)
countBear = ta.barssince(bear)

lastTrade(src) => ta.valuewhen((bull) or (bear), src, 0)


entry = levelsl or levels1 or levels2 or levels3 ? label.new(time, close, "Entry |
" + str.tostring(lastTrade(close), decimals), xloc.bar_time, yloc.price,
color.new(color.gray ,0), label.style_label_left, color.white, size.small) : na
label.set_x(entry, label.get_x(entry) + math.round(ta.change(time) * lvlDistance))
label.set_y(entry, lastTrade(close))
label.delete(entry[1])

stop_y = lastTrade(atrStop)
stop = levelsl ? label.new(time, close, "Stop Loss | " + str.tostring(stop_y,
decimals), xloc.bar_time, yloc.price, color.rgb(255,82,83,0),
label.style_label_left, color.new(color.white, 10), size.small) : na
label.set_x(stop, label.get_x(stop) + math.round(ta.change(time) * lvlDistance))
label.set_y(stop, stop_y)
label.delete(stop[1])

tp1_y = (lastTrade(close)-lastTrade(atrStop))*r1 + lastTrade(close)


tp1 = levels1 ? label.new(time, close, "Take Profit 1 | " + str.tostring(tp1_y,
decimals), xloc.bar_time, yloc.price, color.rgb(0,217,252), label.style_label_left,
color.black, size.small) : na
label.set_x(tp1, label.get_x(tp1) + math.round(ta.change(time) * lvlDistance))
label.set_y(tp1, tp1_y)
label.delete(tp1[1])

tp1s = ta.crossover(close, tp1_y) and not bull and close>supertrend

plotshape(tp1s, text='', style=shape.xcross, location=location.abovebar,


size=size.tiny, color=color.new(#ff000099, 68), textcolor=#2157f999)

tp1sd = ta.crossunder(close, tp1_y) and not bull and not bear and close<supertrend

plotshape(tp1sd, text='', style=shape.xcross, location=location.belowbar,


size=size.tiny, color=color.new(#2157f999, 68), textcolor=#ff000099)

tp15_y = (lastTrade(close)-lastTrade(atrStop))*r2 + lastTrade(close)


tp15 = levels2 ? label.new(time, close, "Take Profit 2 | " + str.tostring(tp15_y,
decimals), xloc.bar_time, yloc.price, color.rgb(0,217,252), label.style_label_left,
color.black, size.small) : na
label.set_x(tp15, label.get_x(tp15) + math.round(ta.change(time) * lvlDistance))
label.set_y(tp15, tp15_y)
label.delete(tp15[1])

tp2s = ta.crossover(close, tp15_y) and not bull and close>supertrend

plotshape(tp2s, text='', style=shape.xcross, location=location.abovebar,


size=size.tiny, color=color.new(#ff000099, 68), textcolor=#2157f999)

tp2sd = ta.crossunder(close, tp15_y) and not bull and not bear and close<supertrend
plotshape(tp2sd, text='', style=shape.xcross, location=location.belowbar,
size=size.tiny, color=color.new(#2157f999, 68), textcolor=#ff000099)

tp2_y = (lastTrade(close)-lastTrade(atrStop))*r3 + lastTrade(close)


tp2 = levels3 ? label.new(time, close, "Take Profit 3 | " + str.tostring(tp2_y,
decimals), xloc.bar_time, yloc.price, color.rgb(0,217,252), label.style_label_left,
color.black, size.small) : na
label.set_x(tp2, label.get_x(tp2) + math.round(ta.change(time) * lvlDistance))
label.set_y(tp2, tp2_y)
label.delete(tp2[1])

tp3s = ta.crossover(close, tp2_y) and not bull and close>supertrend

plotshape(tp3s, text='', style=shape.xcross, location=location.abovebar,


size=size.tiny, color=color.new(#ff000099, 68), textcolor=#2157f999)

tp3sd = ta.crossunder(close, tp2_y) and not bull and not bear and close<supertrend

plotshape(tp3sd, text='', style=shape.xcross, location=location.belowbar,


size=size.tiny, color=color.new(#2157f999, 68), textcolor=#ff000099)

style = linesStyle == "SOLID" ? line.style_solid : linesStyle == "DASHED" ?


line.style_dashed : line.style_dotted
lineEntry = levelsl or levels1 or levels2 or levels3 and lvlLines ?
line.new(bar_index - (trigger == 0 ? countBull : countBear), lastTrade(close),
bar_index + lvlDistance, lastTrade(close), xloc.bar_index, extend.none,
color.new(color.gray, 0), style, 2) : na, line.delete(lineEntry[1])
lineStop = levelsl and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull :
countBear), stop_y, bar_index + lvlDistance, stop_y, xloc.bar_index, extend.none,
color.new(#E93E63, 0), style, 2) : na, line.delete(lineStop[1])
lineTp1 = levels1 and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull :
countBear), tp1_y, bar_index + lvlDistance, tp1_y, xloc.bar_index, extend.none,
color.rgb(0,217,252), style, 2) : na, line.delete(lineTp1[1])
lineTp15 = levels2 and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull :
countBear), tp15_y, bar_index + lvlDistance, tp15_y, xloc.bar_index, extend.none,
color.rgb(0,217,252), style, 2) : na, line.delete(lineTp15[1])
lineTp2 = levels3 and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull :
countBear), tp2_y, bar_index + lvlDistance, tp2_y, xloc.bar_index, extend.none,
color.rgb(0,217,252), style, 2) : na, line.delete(lineTp2[1])

// ----------------------------------------- bands
----------------------------------- \\
useEma = true
int volBandsSen = 5
gray = volBands ? #787B86 : na, gray40 = volBands ? color.new(gray, 60) : na,
gray5 = volBands ? color.new(gray, 95) : na, gray20 = volBands ?
color.new(gray, 80) : na
//
f_kc(src, len, mult) =>
float basis = useEma ? ta.ema(src, len) : ta.sma(src, len)
float span = useEma ? ta.ema(ta.tr, len) : ta.sma(ta.tr, len)
[basis + span * mult, basis - span * mult]

[upperKC1, lowerKC1] = f_kc(close, 35, 4.5 )


[upperKC2, lowerKC2] = f_kc(close, 35, 6.4 )
[upperKC3, lowerKC3] = f_kc(close, 35, 8.3 )
b1 = plot(upperKC1, "", color.new(#E93E63, 75), editable=false)
b2 = plot(upperKC2, "", color.new(#E93E63, 85), editable=false)
b3 = plot(upperKC3, "", color.new(#E93E63, 90), editable=false)
b4 = plot(lowerKC1, "", color.new(#00DBFF, 75), editable=false)
b5 = plot(lowerKC2, "", color.new(#00DBFF, 85), editable=false)
b6 = plot(lowerKC3, "", color.new(#00DBFF, 90), editable=false)

// ---------------------------- moving average line


------------------------------------- \\
shortem = ta.ema(close, 23)
intm = ta.ema(close, 200)
longem = ta.ema(close, mals)

// set bull
mal_is_bull = (shortem > intm ? color.new(#00DBFF, 75) : color.new(#E93E63, 75))

// plot it
plot(mal ? longem : na, color = mal_is_bull, linewidth=4)

//--------------------------- reversal signals --------------------------- \\

//number
rsiLength = 14
rsiOverbought = 66
rsiOversold = 35
drawOnRT = true

// Check to see if RSI has crossed our threshold


rsi = ta.rsi(close, rsiLength)
rsiOB = rsi >= rsiOverbought
rsiOS = rsi <= rsiOversold

// Plot signals and trigger any alerts


plotshape(enObOs and rsiOS and (barstate.ishistory or drawOnRT), title="Oversold",
location=location.belowbar, color=color.new(#0dbbff, 68), style=shape.diamond,
text="", size=size.tiny)
plotshape(enObOs and rsiOB and (barstate.ishistory or drawOnRT),
title="Overbought", color=color.new(#e93e63, 68), style=shape.diamond, text="",
size=size.tiny)
alertcondition(rsiOB or rsiOS, title="OB or OS Alert!", message="Overbought or
OverSold Alert for {{ticker}}")

// ------------------------------ support and resistance --------------------------


\\

left = 50
right = 25
quick_right = 5 // Used to try and detect a more recent significant swing.

pivot_high = ta.pivothigh(high, left, right)


pivot_lows = ta.pivotlow(low, left, right)

quick_pivot_high = ta.pivothigh(high, left, quick_right)


quick_pivot_lows = ta.pivotlow(low, left, quick_right)

level1 = ta.valuewhen(quick_pivot_high, high[quick_right], 0)


level2 = ta.valuewhen(quick_pivot_lows, low[quick_right], 0)
level3 = ta.valuewhen(pivot_high, high[right], 0)
level4 = ta.valuewhen(pivot_lows, low[right], 0)
level5 = ta.valuewhen(pivot_high, high[right], 1)
level6 = ta.valuewhen(pivot_lows, low[right], 1)
level7 = ta.valuewhen(pivot_high, high[right], 2)
level8 = ta.valuewhen(pivot_lows, low[right], 2)

level1_col = close >= level1 ? #0DBBFF : #E93E63


level2_col = close >= level2 ? #0DBBFF : #E93E63
level3_col = close >= level3 ? #0DBBFF : #E93E63
level4_col = close >= level4 ? #0DBBFF : #E93E63
level5_col = close >= level5 ? #0DBBFF : #E93E63
level6_col = close >= level6 ? #0DBBFF : #E93E63
level7_col = close >= level7 ? #0DBBFF : #E93E63
level8_col = close >= level8 ? #0DBBFF : #E93E63

plot(ensr ? level1 :na, style=plot.style_line, color=level1_col, show_last=1,


linewidth=2, trackprice=true)
plot(ensr ?level2:na, style=plot.style_line, color=level2_col, show_last=1,
linewidth=2, trackprice=true)
plot(ensr?level3:na, style=plot.style_line, color=level3_col, show_last=1,
linewidth=2, trackprice=true)
plot(ensr?level4:na, style=plot.style_line, color=level4_col, show_last=1,
linewidth=2, trackprice=true)
plot(ensr?level5:na, style=plot.style_line, color=level5_col, show_last=1,
linewidth=2, trackprice=true)
plot(ensr?level6:na, style=plot.style_line, color=level6_col, show_last=1,
linewidth=2, trackprice=true)
plot(ensr?level7:na, style=plot.style_line, color=level7_col, show_last=1,
linewidth=2, trackprice=true)
plot(ensr?level8:na, style=plot.style_line, color=level8_col, show_last=1,
linewidth=2, trackprice=true)

ig1 = ensra?line.new(bar_index, level1, bar_index + 1, level1, xloc.bar_index,


extend.both, color.new(level1_col, 85), line.style_solid, 13):na
ig2 = ensra?line.new(bar_index, level2, bar_index + 1, level2, xloc.bar_index,
extend.both, color.new(level2_col, 85), line.style_solid, 13):na
ig3 = ensra?line.new(bar_index, level3, bar_index + 1, level3, xloc.bar_index,
extend.both, color.new(level3_col, 85), line.style_solid, 13):na
ig4 = ensra?line.new(bar_index, level4, bar_index + 1, level4, xloc.bar_index,
extend.both, color.new(level4_col, 85), line.style_solid, 13):na
ig5 = ensra?line.new(bar_index, level5, bar_index + 1, level5, xloc.bar_index,
extend.both, color.new(level5_col, 85), line.style_solid, 13):na
ig6 = ensra?line.new(bar_index, level6, bar_index + 1, level6, xloc.bar_index,
extend.both, color.new(level6_col, 85), line.style_solid, 13):na
ig7 = ensra?line.new(bar_index, level7, bar_index + 1, level7, xloc.bar_index,
extend.both, color.new(level7_col, 85), line.style_solid, 13):na
ig8 = ensra?line.new(bar_index, level8, bar_index + 1, level8, xloc.bar_index,
extend.both, color.new(level8_col, 85), line.style_solid, 13):na

//--------------------------- reversal signals -------------------------------- \\

src = close
Wilders_Period = RSI_Period * 2 - 1

Rsi = ta.rsi(src, RSI_Period)


RsiMa = ta.ema(Rsi, SF)
AtrRsi = math.abs(RsiMa[1] - RsiMa)
MaAtrRsi = ta.ema(AtrRsi, Wilders_Period)
dar = ta.ema(MaAtrRsi, Wilders_Period) * KQE

longband = 0.0
shortband = 0.0
trend = 0

DeltaFastAtrRsi = dar
RSIndex = RsiMa
newshortband = RSIndex + DeltaFastAtrRsi
newlongband = RSIndex - DeltaFastAtrRsi
longband := RSIndex[1] > longband[1] and RSIndex > longband[1] ?
math.max(longband[1], newlongband) : newlongband
shortband := RSIndex[1] < shortband[1] and RSIndex < shortband[1] ?
math.min(shortband[1], newshortband) : newshortband
cross_1 = ta.cross(longband[1], RSIndex)
trend := ta.cross(RSIndex, shortband[1]) ? 1 : cross_1 ? -1 : nz(trend[1], 1)
FastAtrRsiTL = trend == 1 ? longband : shortband

Exlong = 0
Exlong := nz(Exlong[1])
Exshort = 0
Exshort := nz(Exshort[1])
Exlong := FastAtrRsiTL < RSIndex ? Exlong + 1 : 0
Exshort := FastAtrRsiTL > RSIndex ? Exshort + 1 : 0

//Conditions

qqeLong = Exlong == 1 ? FastAtrRsiTL[1] - 50 : na


qqeShort = Exshort == 1 ? FastAtrRsiTL[1] - 50 : na

// Plotting

plotshape(qqeLong and enrevser and barstate.isconfirmed, title='BUY', text='rev\


nup', textcolor=color.new(color.white, 99), style=shape.triangleup,
location=location.belowbar, color=color.new(#0DBBFF, 35), size=size.tiny)
plotshape(qqeShort and enrevser and barstate.isconfirmed, title='SELL', text='rev\
ndown', textcolor=color.new(color.white, 99), style=shape.triangledown,
location=location.abovebar, color=color.new(#E93E63, 35), size=size.tiny)

// ------------------------------------- hh and ll
---------------------------------------- \\

ph = ta.pivothigh(lb, rb)
pl = ta.pivotlow(lb, rb)

iff_1 = pl ? -1 : na // Trend direction


hl = ph ? 1 : iff_1
iff_2 = pl ? pl : na // similar to zigzag but may have multiple highs/lows
zz = ph ? ph : iff_2
valuewhen_1 = ta.valuewhen(hl, hl, 1)
valuewhen_2 = ta.valuewhen(zz, zz, 1)
zz := pl and hl == -1 and valuewhen_1 == -1 and pl > valuewhen_2 ? na : zz
valuewhen_3 = ta.valuewhen(hl, hl, 1)
valuewhen_4 = ta.valuewhen(zz, zz, 1)
zz := ph and hl == 1 and valuewhen_3 == 1 and ph < valuewhen_4 ? na : zz

valuewhen_5 = ta.valuewhen(hl, hl, 1)


valuewhen_6 = ta.valuewhen(zz, zz, 1)
hl := hl == -1 and valuewhen_5 == 1 and zz > valuewhen_6 ? na : hl
valuewhen_7 = ta.valuewhen(hl, hl, 1)
valuewhen_8 = ta.valuewhen(zz, zz, 1)
hl := hl == 1 and valuewhen_7 == -1 and zz < valuewhen_8 ? na : hl
zz := na(hl) ? na : zz

findprevious() => // finds previous three points (b, c, d, e)


ehl = hl == 1 ? -1 : 1
loc1 = 0.0
loc2 = 0.0
loc3 = 0.0
loc4 = 0.0
xx = 0
for x = 1 to 1000 by 1
if hl[x] == ehl and not na(zz[x])
loc1 := zz[x]
xx := x + 1
break
ehl := hl
for x = xx to 1000 by 1
if hl[x] == ehl and not na(zz[x])
loc2 := zz[x]
xx := x + 1
break
ehl := hl == 1 ? -1 : 1
for x = xx to 1000 by 1
if hl[x] == ehl and not na(zz[x])
loc3 := zz[x]
xx := x + 1
break
ehl := hl
for x = xx to 1000 by 1
if hl[x] == ehl and not na(zz[x])
loc4 := zz[x]
break
[loc1, loc2, loc3, loc4]

float a = na
float b = na
float c = na
float d = na
float e = na
if not na(hl)
[loc1, loc2, loc3, loc4] = findprevious()
a := zz
b := loc1
c := loc2
d := loc3
e := loc4
e

_hh = zz and a > b and a > c and c > b and c > d


_ll = zz and a < b and a < c and c < b and c < d
_hl = zz and (a >= c and b > c and b > d and d > c and d > e or a < b and a > c and
b < d)
_lh = zz and (a <= c and b < c and b < d and d < c and d < e or a > b and a < c and
b > d)

plotshape(showSwings and _hl, text='HL', title='Higher Low', style=shape.labelup,


color=color.new(color.lime, 100), textcolor=colsh, location=location.belowbar,
offset=-rb)
plotshape(showSwings and _hh, text='HH', title='Higher High',
style=shape.labeldown, color=color.new(color.lime, 100), textcolor=colsh,
location=location.abovebar, offset=-rb)
plotshape(showSwings and _ll, text='LL', title='Lower Low', style=shape.labelup,
color=color.new(color.red, 100), textcolor=colsl, location=location.belowbar,
offset=-rb)
plotshape(showSwings and _lh, text='LH', title='Lower High', style=shape.labeldown,
color=color.new(color.red, 100), textcolor=colsl, location=location.abovebar,
offset=-rb)

You might also like