Untitled

 avatar
unknown
plain_text
a year ago
35 kB
333
Indexable
//@version=5
indicator("EzAlgo V.11 | Free Version [AlgoPoint]", shorttitle="Algo V.11 | Free Version [AlgoPoint]", overlay=true, max_labels_count=500)
// watermark

// title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? 
//text inputs
title = 'AlgoPoint'
subtitle = 'All Leaked Algos | IG: algopoint'
//symbol info
symInfoCheck = false
symInfo = syminfo.ticker + ' | ' + timeframe.period + (timeframe.isminutes ? 'M' : na)
date = str.tostring(dayofmonth(time_close)) + '/' + str.tostring(month(time_close)) + '/' + str.tostring(year(time_close))
//text positioning
textVPosition = 'middle'
textHPosition = 'center'
//symbol info positioning
symVPosition = 'top'
symHPosition = 'left'
//cell size
width = 0
height = 0
//title settings
c_title = #b2b5be80
s_title = 'large'
a_title = 'center'
//subtitle settings
c_subtitle = #b2b5be80
s_subtitle = 'normal'
a_subtitle = 'center'
c_bg = color.new(color.blue, 100)

// Get user settings
showBuySell       = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input(true, "Standard Signals", group="BUY & SELL SIGNALS | EzAlgo V12 Leaked! For Codes IG: algopoint") : na
sensitivitysetter = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.string("Smooth", "Signal Type", ["Fast", "Smooth", "Swing | Locked For Free 🔒", "EzAlgo V12 Leaked! For Codes IG: algopoint"], group = "BUY & SELL SIGNALS | EzAlgo V12 Leaked! For Codes IG: algopoint") : na
sensitivity       = (sensitivitysetter == "Fast" ? 1.7 : sensitivitysetter == "Smooth" ? 3.3 : na)
offsetSignal      = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.float(2, "Signals Offset", 0, group="BUY & SELL SIGNALS | EzAlgo V12 Leaked! For Codes IG: algopoint") : na
AiBuySell       = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input(true, "AI Signals", group="BUY & SELL SIGNALS | EzAlgo V12 Leaked! For Codes IG: algopoint") : na
aisensitivitysetter = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.string("Moderate", "AI Strength", ["Moderate", "Strong", "Strongest (Locked For Free 🔒)", "EzAlgo V12 Leaked! For Codes IG: algopoint"], group="BUY & SELL SIGNALS | EzAlgo V12 Leaked! For Codes IG: algopoint") : na
// MULTI-TIMEFRAME S/R
showSRR             = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.bool(false, title = "", inline = "01", group="MULTI-TIMEFRAME S/R | Locked For Free 🔒") : na
timef               = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.timeframe("", "", inline = "01", group="MULTI-TIMEFRAME S/R | Locked For Free 🔒") : na
levels              = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.int(5 , "Levels", inline = "01", group = "MULTI-TIMEFRAME S/R | Locked For Free 🔒") : na
linewidth           = input.int(1, "Width", inline = "02", group = "MULTI-TIMEFRAME S/R | Locked For Free 🔒") * 20
supportcolor        = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.color(color.new(#00DBFF, 75), "", inline = "02", group = "MULTI-TIMEFRAME S/R | Locked For Free 🔒") : na
resistancecolor     = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.color(color.new(#b2b5be, 75), "", inline = "02", group = "MULTI-TIMEFRAME S/R | Locked For Free 🔒") : na
labelon             = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.string("On", "Label", ["On", "Off"], inline = "03", group = "MULTI-TIMEFRAME S/R | Locked For Free 🔒") : na
labelsize           = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.string("Default", "Size", ["Small", "Default", "Large"], inline = "03", group = "MULTI-TIMEFRAME S/R | Locked For Free 🔒") : na
labelcol            = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.color(#5d606b, "", inline = "03", group = "MULTI-TIMEFRAME S/R | Locked For Free 🔒") : na
labelloc            = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.int(10, "Offset", inline = "04", group = "MULTI-TIMEFRAME S/R | Locked For Free 🔒") + 30  : na
showtimef           = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.bool(true, "Show Timeframe", inline = "04", group = "MULTI-TIMEFRAME S/R | Locked For Free 🔒") : na
showtprice          = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.bool(true, "Show Price", inline = "04", group = "MULTI-TIMEFRAME S/R | Locked For Free 🔒") : na
barcoloronof        = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input(true, "Show Candle Coloring", group = "TREND SETTINGS") : na
showRibbon          = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input(title='Show Trend Cloud',inline = 'TrendOption', defval=true, group= "TREND SETTINGS") : na
trendcloudbull      = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input(#00dbff, "",inline = 'TrendOption', group="TREND SETTINGS") : na
trendcloudbear      = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input(#b2b5be, "",inline = 'TrendOption', group="TREND SETTINGS") : na

showEmas          = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input(false, "Show EMAs", group="TREND SETTINGS") : na
srcEma1           = close
lenEma1           = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.int(8, "EMA 1", 1,group="TREND SETTINGS") : na
srcEma2           = close
lenEma2           = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.int(13, "EMA 2", 1,group="TREND SETTINGS") : na
srcEma3           = close
lenEma3           = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.int(144, "EMA 3", 1,group="TREND SETTINGS") : na

showRevBands        = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.bool(false, "Show Reversal Bands", group="REVERSAL BANDS") : na
lenRevBands         = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.int(30, "Length", group="REVERSAL BANDS") : na


// Functions
smoothrng(x, t, m) =>
    wper = t * 2 - 1
    avrng = ta.ema(math.abs(x - x[1]), t)
    smoothrng = ta.ema(avrng, wper) * m
rngfilt(x, r) =>
    rngfilt = x
    rngfilt := x > nz(rngfilt[1]) ? x - r < nz(rngfilt[1]) ? nz(rngfilt[1]) : x - r : x + r > nz(rngfilt[1]) ? nz(rngfilt[1]) : x + r
percWidth(len, perc) => (ta.highest(len) - ta.lowest(len)) * perc / 100
securityNoRep(sym, res, src) => request.security(sym, res, src, barmerge.gaps_off, barmerge.lookahead_on)
swingPoints(prd) =>
    pivHi = ta.pivothigh(prd, prd)
    pivLo = ta.pivotlow (prd, prd)
    last_pivHi = ta.valuewhen(pivHi, pivHi, 1)
    last_pivLo = ta.valuewhen(pivLo, pivLo, 1)
    hh = pivHi and pivHi > last_pivHi ? pivHi : na
    lh = pivHi and pivHi < last_pivHi ? pivHi : na
    hl = pivLo and pivLo > last_pivLo ? pivLo : na
    ll = pivLo and pivLo < last_pivLo ? pivLo : na
    [hh, lh, hl, ll]
f_chartTfInMinutes() =>
    float _resInMinutes = timeframe.multiplier * (
      timeframe.isseconds ? 1                   :
      timeframe.isminutes ? 1.                  :
      timeframe.isdaily   ? 60. * 24            :
      timeframe.isweekly  ? 60. * 24 * 7        :
      timeframe.ismonthly ? 60. * 24 * 30.4375  : na)
f_kc(src, len, sensitivity) =>
    basis = ta.sma(src, len)
    span  = ta.atr(len)
    [basis + span * sensitivity, basis - span * sensitivity]
wavetrend(src, chlLen, avgLen) =>
    esa = ta.ema(src, chlLen)
    d = ta.ema(math.abs(src - esa), chlLen)
    ci = (src - esa) / (0.015 * d)
    wt1 = ta.ema(ci, avgLen)
    wt2 = ta.sma(wt1, 3)
    [wt1, wt2]
f_top_fractal(src) => src[4] < src[2] and src[3] < src[2] and src[2] > src[1] and src[2] > src[0]
f_bot_fractal(src) => src[4] > src[2] and src[3] > src[2] and src[2] < src[1] and src[2] < src[0]
f_fractalize (src) => f_top_fractal(src) ? 1 : f_bot_fractal(src) ? -1 : 0
f_findDivs(src, topLimit, botLimit) =>
    fractalTop = f_fractalize(src) > 0 and src[2] >= topLimit ? src[2] : na
    fractalBot = f_fractalize(src) < 0 and src[2] <= botLimit ? src[2] : na
    highPrev = ta.valuewhen(fractalTop, src[2], 0)[2]
    highPrice = ta.valuewhen(fractalTop, high[2], 0)[2]
    lowPrev = ta.valuewhen(fractalBot, src[2], 0)[2]
    lowPrice = ta.valuewhen(fractalBot, low[2], 0)[2]
    bearSignal = fractalTop and high[2] > highPrice and src[2] < highPrev
    bullSignal = fractalBot and low[2] < lowPrice and src[2] > lowPrev
    [bearSignal, bullSignal]
//
// Get components
source    = close
smrng1    = smoothrng(source, 27, 1.5)
smrng2    = smoothrng(source, 55, sensitivity)
smrng     = (smrng1 + smrng2) / 2
filt      = rngfilt(source, smrng)
up        = 0.0, up := filt > filt[1] ? nz(up[1]) + 1 : filt < filt[1] ? 0 : nz(up[1])
dn        = 0.0, dn := filt < filt[1] ? nz(dn[1]) + 1 : filt > filt[1] ? 0 : nz(dn[1])
bullCond  = bool(na), bullCond := source > filt and source > source[1] and up > 0 or source > filt and source < source[1] and up > 0
bearCond  = bool(na), bearCond := source < filt and source < source[1] and dn > 0 or source < filt and source > source[1] and dn > 0
lastCond  = 0, lastCond := bullCond ? 1 : bearCond ? -1 : lastCond[1]
bull      = bullCond and lastCond[1] == -1
bear      = bearCond and lastCond[1] == 1
countBull = ta.barssince(bull)
countBear = ta.barssince(bear)
trigger   = nz(countBull, bar_index) < nz(countBear, bar_index) ? 1 : 0
rsi       = ta.rsi(close, 21)
rsiOb     = rsi > 70 and rsi > ta.ema(rsi, 10)
rsiOs     = rsi < 30 and rsi < ta.ema(rsi, 10)
dHigh     = securityNoRep(syminfo.tickerid, "D", high [1])
dLow      = securityNoRep(syminfo.tickerid, "D", low  [1])
dClose    = securityNoRep(syminfo.tickerid, "D", close[1])
ema = ta.ema(close, 144)
emaBull = close > ema
equal_tf(res) => str.tonumber(res) == f_chartTfInMinutes() and not timeframe.isseconds
higher_tf(res) => str.tonumber(res) > f_chartTfInMinutes() or timeframe.isseconds
too_small_tf(res) => (timeframe.isweekly and res=="1") or (timeframe.ismonthly and str.tonumber(res) < 10)
securityNoRep1(sym, res, src) =>
    bool bull_ = na
    bull_ := equal_tf(res) ? src : bull_
    bull_ := higher_tf(res) ? request.security(sym, res, src, barmerge.gaps_off, barmerge.lookahead_on) : bull_
    bull_array = request.security_lower_tf(syminfo.tickerid, higher_tf(res) ? str.tostring(f_chartTfInMinutes()) + (timeframe.isseconds ? "S" : "") : too_small_tf(res) ? (timeframe.isweekly ? "3" : "10") : res, src)
    if array.size(bull_array) > 1 and not equal_tf(res) and not higher_tf(res)
        bull_ := array.pop(bull_array)
    array.clear(bull_array)
    bull_
TF1Bull   = securityNoRep1(syminfo.tickerid, "1"   , emaBull)
TF3Bull   = securityNoRep1(syminfo.tickerid, "3"   , emaBull)
TF5Bull   = securityNoRep1(syminfo.tickerid, "5"   , emaBull)
TF15Bull  = securityNoRep1(syminfo.tickerid, "15"  , emaBull)
TF30Bull  = securityNoRep1(syminfo.tickerid, "30"  , emaBull)
TF60Bull  = securityNoRep1(syminfo.tickerid, "60"  , emaBull)
TF120Bull = securityNoRep1(syminfo.tickerid, "120" , emaBull)
TF240Bull = securityNoRep1(syminfo.tickerid, "240" , emaBull)
TF480Bull = securityNoRep1(syminfo.tickerid, "480" , emaBull)
TFDBull   = securityNoRep1(syminfo.tickerid, "1440", emaBull)
[upperKC1, lowerKC1] = f_kc(close, lenRevBands, 3)
[upperKC2, lowerKC2] = f_kc(close, lenRevBands, 4)
[upperKC3, lowerKC3] = f_kc(close, lenRevBands, 5)
[upperKC4, lowerKC4] = f_kc(close, lenRevBands, 6)
[wt1, wt2] = wavetrend(hlc3, 9, 12)
[wtDivBear1, wtDivBull1] = f_findDivs(wt2, 15, -40)
[wtDivBear2, wtDivBull2] = f_findDivs(wt2, 45, -65)
wtDivBull = wtDivBull1 or wtDivBull2
wtDivBear = wtDivBear1 or wtDivBear2
// Colors
cyan = #00DBFF, cyan30 = color.new(cyan, 70)
pink = #b2b5be, pink30 = color.new(pink, 70)
red  = #b2b5be, red30  = color.new(red , 70)
barupcolor = barcoloronof == true ? #00DBFF : na
bardowncolor = barcoloronof == true ? #b2b5be : na
// Plot

off = percWidth(300, offsetSignal)
plotshape(showBuySell and bull ? low  - off : na, "Buy Signal" , shape.circle  , location.absolute, cyan, 0, "" , color.white, size=size.tiny, editable = false)
plotshape(showBuySell and bear ? high + off : na, "Sell Signal", shape.circle, location.absolute, pink, 0, "", color.white, size=size.tiny, editable = false)
plotshape(ta.crossover(wt1, wt2) and wt2 <= -53 and AiBuySell and aisensitivitysetter == "Moderate", "AI Strong Buy", shape.triangleup, location.belowbar, cyan, size=size.tiny, editable = false)
plotshape(ta.crossunder(wt1, wt2) and wt2 >= 53 and AiBuySell and aisensitivitysetter == "Moderate", "AI Strong Sell", shape.triangledown, location.abovebar, pink, size=size.tiny, editable = false)
plotshape(ta.crossover(wt1, wt2) and wt2 <= -53 and AiBuySell and aisensitivitysetter == "Strong", "AI Strong Buy", shape.triangleup, location.belowbar, cyan, size=size.tiny, editable = false)
plotshape(ta.crossunder(wt1, wt2) and wt2 >= 53 and AiBuySell and aisensitivitysetter == "Strong", "AI Strong Sell", shape.triangledown, location.abovebar, pink, size=size.tiny, editable = false)
plotshape(wtDivBull and AiBuySell and aisensitivitysetter == "Moderate", "AI Strongest Buy ", shape.triangleup  , location.belowbar, cyan, size=size.tiny, editable = false)
plotshape(wtDivBear and AiBuySell and aisensitivitysetter == "Moderate", "AI Strongest Sell", shape.triangledown, location.abovebar, pink, size=size.tiny, editable = false)
barcolor(up > dn ? barupcolor : bardowncolor)
//aisensitivitysetter = input.string("Moderate", "AI Strength", ["Moderate", "Strong", "Strongest"], group="BUY & SELL SIGNALS")
plot(showRevBands  ? upperKC1 : na, "Rev.Zone Upper 1", red30)
plot(showRevBands ? upperKC2 : na, "Rev.Zone Upper 2", red30)
plot(showRevBands ? upperKC3 : na, "Rev.Zone Upper 3", red30)
plot(showRevBands ? upperKC4 : na, "Rev.Zone Upper 4", red30)
plot(showRevBands ? lowerKC4 : na, "Rev.Zone Lower 4", cyan30)
plot(showRevBands ? lowerKC3 : na, "Rev.Zone Lower 3", cyan30)
plot(showRevBands ? lowerKC2 : na, "Rev.Zone Lower 2", cyan30)
plot(showRevBands ? lowerKC1 : na, "Rev.Zone Lower 1", cyan30)

// Alerts
alert02 = bull
alert03 = wtDivBull
alert04 = wtDivBear
alert05 = bull or bear
alert06 = ta.crossover(wt1, wt2) and wt2 <= -53
alert07 = ta.crossunder(wt1, wt2) and wt2 >= 53
alert09 = rsiOb or rsiOs
alert10 = bear

alerts(sym) =>
    if alert02 or alert03 or alert04 or alert06 or alert07 or alert10
        alert_text = alert02 ? "Buy Signal PunkAlgo" : alert03 ? "Strong Buy Signal PunkAlgo" : alert04 ? "Strong Sell Signal PunkAlgo" : alert06 ? "Mild Buy Signal PunkAlgo" : alert07 ? "Mild Sell Signal PunkAlgo" : "Sell Signal PunkAlgo"
        alert(alert_text,  alert.freq_once_per_bar_close)
alerts(syminfo.tickerid)

alertcondition(alert02, "Buy Signal", "Buy Signal EzAlgo")
alertcondition(alert03, "Divergence Buy Alert", "Strong Buy Signal EzAlgo, TimeFrame={{interval}}")
alertcondition(alert04, "Divergence Sell Alert", "Strong Sell Signal EzAlgo, TimeFrame={{interval}}")
alertcondition(alert05, "Either Buy or Sell Signal", "EzAlgo Signal")
alertcondition(alert06, "Mild Buy Alert", "Mild Buy Signal EzAlgo, TimeFrame={{interval}}")
alertcondition(alert07, "Mild Sell Alert", "Mild Sell Signal EzAlgo, TimeFrame={{interval}}")
alertcondition(alert09, "Reversal Signal", "Reversal Signal")
alertcondition(alert10, "Sell Signal", "Sell Signal EzAlgo")

// Trend Cloud Module

ema21 = ta.ema(close, 21)
ema55 = ta.ema(close, 55)
plot21EMA = plot(showRibbon ? ema21 :  na, '21 EMA', color=color.new(#000000,100))
plot55EMA = plot(showRibbon ? ema55 :  na, '55 EMA', color=color.new(#000000,100))

fill(plot21EMA, plot55EMA, color=ema21 > ema55 ? trendcloudbull : trendcloudbear, transp=80)


// Trendlines Modules

//inputs

show_trendlines = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.bool(true, 'Show Trendlines', inline = 'tl_1',group='Trendlines') : na
upper_trendline_color        = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.color(#9598a1, '', inline = 'tl_1',group='Trendlines') : na
lower_trendline_color        = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.color(#9598a1, '', inline = 'tl_1',group='Trendlines') : na
extendLine      = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.bool(true, 'Extend', inline = 'tl_1',group='Trendlines') : na

linestyle_curr_inp = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.string(defval = 'Solid', title = "Style", options = ['Solid', 'Dotted', 'Dashed'],inline = "tl_3",group='Trendlines') : na
line_width_curr          = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.int(1, 'Width', step = 1, minval = 1,maxval = 4,inline = "tl_3",group='Trendlines') : na

pivLen_L          = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.int(20, 'Lookback', step = 1, minval = 1, inline ='tl_5',group='Trendlines') : na
pivLen_R          = pivLen_L//input.int(20, '/', step = 1, minval = 1, inline ='tl_5',group='Trendlines')

hideCrossed     = not(input.bool(false, 'Show Broken', inline = 'tl_2',group='Trendlines'))
broken_color_up        = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.color(#9598a1, '', inline = 'tl_2',group='Trendlines') : na
broken_color_down        = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.color(#9598a1, '', inline = 'tl_2',group='Trendlines') : na
extendLine_B      = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.bool(true, 'Extend', inline = 'tl_2',group='Trendlines') : na

show_signals     = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.bool(false, 'Show Signals', inline = 'tl_s',group='Trendlines') : na
broken_color_up_signal        = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.color(color.yellow, '', inline = 'tl_s',group='Trendlines') : na
broken_color_down_signal        = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.color(color.yellow, '', inline = 'tl_s',group='Trendlines') : na

maxLines        = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.int(3, 'Max Broken', step = 1, minval = 1, maxval = 50, inline = 'tl_2_B',group='Trendlines') : na
Source_tl        = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.string('Close', 'Mitigation', options = ['Close', 'High/Low'], inline ='tl_2_B',group='Trendlines') : na

linestyle_broken_inp = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.string(defval = 'Dashed', title = "Style (Broken)", options = ['Solid', 'Dotted', 'Dashed'],inline = "tl_2-1",group='Trendlines') : na
line_width_broken         = title == 'AlgoPoint' and subtitle == 'All Leaked Algos | IG: algopoint' and textVPosition == 'middle' and textHPosition == 'center' and c_title == #b2b5be80 and s_title == 'large' and a_title == 'center' and c_subtitle == #b2b5be80 and s_subtitle == 'normal' and a_subtitle == 'center' ? input.int(1, 'Width', step = 1, minval = 1,maxval = 4,inline = "tl_2-1",group='Trendlines') : na

lineStyle_curr= linestyle_curr_inp == 'Solid' ?  line.style_solid : linestyle_curr_inp == 'Dotted' ?  line.style_dotted : line.style_dashed
lineStyle_broken= linestyle_broken_inp == 'Solid' ?  line.style_solid : linestyle_broken_inp == 'Dotted' ?  line.style_dotted : line.style_dashed

s_close = request.security(ticker.standard(syminfo.tickerid), timeframe.period, close)
s_open = request.security(ticker.standard(syminfo.tickerid), timeframe.period, open)
s_high = request.security(ticker.standard(syminfo.tickerid), timeframe.period, high)
s_low = request.security(ticker.standard(syminfo.tickerid), timeframe.period, low)
textWatermark = table.new(textVPosition + '_' + textHPosition, 1, 3)
var line[] pivot_high_array = array.new_line(),var line[] pivot_low_array = array.new_line()
ph2_M = ta.pivothigh(s_high, pivLen_L, pivLen_R)
pl2_M = ta.pivotlow(s_low, pivLen_L, pivLen_R)
ph2 = ta.pivothigh(s_high, pivLen_L, pivLen_R)
pl2 = ta.pivotlow(s_low, pivLen_L, pivLen_R)

var float prev_close_H = na, var float curr_close_H = na
var float prev_close_L = na, var float curr_close_L = na

var int X_prev_low = na, var float Y_prev_low = na, var int X_curr_low = na, var float Y_curr_low = na
var int X_curr_high = na, var float Y_curr_high = na, var int X_prev_high = na, var float Y_prev_high = na


maxLines        := hideCrossed ? 0 : maxLines
tl_array_size_up    = maxLines/2
tl_array_size_dn    = maxLines%2==0? maxLines/2 : (maxLines/2)+1

//functions
table.cell(textWatermark, 0, 0, title, width, height, c_title, a_title, text_size=s_title, bgcolor=c_bg)
newTrendLine(ptype, x1, y1, x2, y2)=>
    new_trendline = line.new(x1, y1, x2, y2, extend = extendLine ? extend.right : extend.none, color = ptype == 'ph2' ? upper_trendline_color : lower_trendline_color, width = line_width_curr,style = lineStyle_curr,xloc = xloc.bar_index)
    if ptype == 'ph2'
        pivot_high_array.unshift(new_trendline)
    else
        pivot_low_array.unshift(new_trendline)

SlopeOfLine(line)=>
    slopeph2 = (line.get_y2(line) - line.get_y1(line))/(line.get_x2(line) -line.get_x1(line))
    extendedph2 = line.get_y2(line) - slopeph2 * (line.get_x2(line) - bar_index)
    extendedph2

up_trend_line_formed= false
down_trend_line_formed = false
table.cell(textWatermark, 0, 1, subtitle, width, height, c_subtitle, a_subtitle, text_size=s_subtitle, bgcolor=c_bg)
if pl2
    X_prev_low := X_curr_low, Y_prev_low := Y_curr_low, prev_close_L := curr_close_L
    X_curr_low := bar_index[pivLen_R], Y_curr_low := s_low[pivLen_R], curr_close_L:= s_close[pivLen_R]
    if Y_prev_low < Y_curr_low and show_trendlines and Y_curr_low > prev_close_L 
        newTrendLine('pl2', X_prev_low, Y_prev_low, X_curr_low, Y_curr_low)
        down_trend_line_formed:=true

if ph2
    X_prev_high := X_curr_high, Y_prev_high := Y_curr_high, prev_close_H := curr_close_H
    X_curr_high := bar_index[pivLen_R], Y_curr_high := s_high[pivLen_R], curr_close_H:= s_close[pivLen_R]
    
    if Y_prev_high > Y_curr_high and show_trendlines and prev_close_H > Y_curr_high
        newTrendLine('ph2', X_prev_high, Y_prev_high, X_curr_high, Y_curr_high)
        up_trend_line_formed := true


if close > Y_prev_high
    Y_prev_high:=0.000000

if close < Y_prev_low
    Y_prev_low:= 9999999999.9999


// alertcondition(up_trend_line_formed,'Up TrendLine Formed','Up TrendLine Formed')
// alertcondition(down_trend_line_formed,'Down TrendLine Formed','Down TrendLine Formed')
alertcondition(down_trend_line_formed or up_trend_line_formed,'Trendline Formed','Trendline Formed')

up_trend_line_broken = false
down_trend_line_broken = false

for x in pivot_low_array
    var line [] Down_Trend_Lines = array.new_line(tl_array_size_up)
    var label [] Down_Trend_Labels = array.new_label(tl_array_size_up)
    src = Source_tl == 'Close' ? s_close : s_low
    x.set_xy2(bar_index, SlopeOfLine(x))
    if x.get_x2() - x.get_x1() > 300
        x.delete()
    if src < line.get_y2(x)
        tl_line = line.new(line.get_x1(x), line.get_y1(x), line.get_x2(x), line.get_y2(x), color = broken_color_down, style = lineStyle_broken, width = line_width_broken,xloc = xloc.bar_index, extend = extendLine_B ? extend.right : extend.none)
        down_trend_line_broken:=true
        Down_Trend_Lines.unshift(tl_line)
        line.delete(x)
    if Down_Trend_Lines.size() > (tl_array_size_up)
        line.delete(Down_Trend_Lines.pop())

for x in pivot_high_array
    var line [] Up_Trend_Lines = array.new_line(tl_array_size_dn)
    var label [] Up_Trend_Labels = array.new_label(tl_array_size_dn)
    src = Source_tl == 'Close' ? s_close : s_high
    x.set_xy2(bar_index, SlopeOfLine(x))
    if x.get_x2() - x.get_x1() > 300
        x.delete()
    if src > line.get_y2(x)
        tl_line = line.new(line.get_x1(x), line.get_y1(x), line.get_x2(x), line.get_y2(x), color = broken_color_up, style = lineStyle_broken, width = line_width_broken,xloc = xloc.bar_index, extend = extendLine_B ? extend.right : extend.none)
        up_trend_line_broken:=true
        Up_Trend_Lines.unshift(tl_line)
        line.delete(x)
    if Up_Trend_Lines.size() > (tl_array_size_dn)
        line.delete(Up_Trend_Lines.pop())


plotshape(show_signals and up_trend_line_broken? low : na, title='Trendline Broken Up', style=shape.xcross, textcolor=color.new(color.white, 0), size=size.small, location=location.belowbar, color=broken_color_up_signal,display=  display.all - display.status_line, editable = false)
plotshape(show_signals and down_trend_line_broken? high : na, title='Trendline Broken Down', style=shape.xcross,  textcolor=color.new(color.white, 0), size=size.small, location=location.abovebar, color=broken_color_down_signal,display=  display.all - display.status_line, editable = false)
Editor is loading...
Leave a Comment