Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
456 views5 pages

Mint Algo TradingView Indicator

The document contains a Pine Script™ code for the 'Mint Algo indicator', which includes various user inputs for sensitivity, support and resistance, and trend lines. It features functions for calculating supertrend, linear regression, and ATR, as well as plotting buy/sell signals and a dashboard displaying market trends across multiple timeframes. Alerts are set for buy and sell signals based on market conditions.
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)
456 views5 pages

Mint Algo TradingView Indicator

The document contains a Pine Script™ code for the 'Mint Algo indicator', which includes various user inputs for sensitivity, support and resistance, and trend lines. It features functions for calculating supertrend, linear regression, and ATR, as well as plotting buy/sell signals and a dashboard displaying market trends across multiple timeframes. Alerts are set for buy and sell signals based on market conditions.
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/ 5

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.

0
at https://mozilla.org/MPL/2.0/

//@version=5
indicator("Mint Algo indicator", overlay=true, precision=0,
explicit_plot_zorder=true, max_labels_count=500)

//------------------ Mint Algo ---------------////


// Get user input
sensitivity = input.int(defval=5, title="Sensitivity", minval=1, maxval=20)
suppRes = input.bool(false, "Support & Resistance")
breaks = input.bool(false, "Breaks")
usePsar = input.bool(false, "PSAR")
emaEnergy = input.bool(true, "EMA Energy")
channelBal = input.bool(true, "Channel Balance")
autoTL = input.bool(false, "Auto Trend Lines")
// Functionsa
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]

lr_slope(_src, _len) =>


x = 0.0, y = 0.0, x2 = 0.0, xy = 0.0
for i = 0 to _len - 1
val = _src[i]
per = i + 1
x += per
y += val
x2 += per * per
xy += val * per
_slp = (_len * xy - x * y) / (_len * x2 - x * x)
_avg = y / _len
_int = _avg - _slp * x / _len + _slp
[_slp, _avg, _int]
lr_dev(_src, _len, _slp, _avg, _int) =>
upDev = 0.0, dnDev = 0.0
val = _int
for j = 0 to _len - 1
price = high[j] - val
if price > upDev
upDev := price
price := val - low[j]
if price > dnDev
dnDev := price
price := _src[j]
val += _slp
[upDev, dnDev]
// Get Components
ocAvg = math.avg(open, close)
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)
[middleKC1, upperKC1, lowerKC1] = ta.kc(close, 80, 10.5)
[middleKC2, upperKC2, lowerKC2] = ta.kc(close, 80, 9.5)
[middleKC3, upperKC3, lowerKC3] = ta.kc(close, 80, 8)
[middleKC4, upperKC4, lowerKC4] = ta.kc(close, 80, 3)
[supertrend, direction] = supertrend(close, sensitivity, 11)
barsL = 10
barsR = 10
pivotHigh = fixnan(ta.pivothigh(barsL, barsR)[1])
pivotLow = fixnan(ta.pivotlow(barsL, barsR)[1])
source = close, period = 150
[s, a, i] = lr_slope(source, period)
[upDev, dnDev] = lr_dev(source, period, s, a, i)
// Colors
green = #2BBC4D, green2 = #00DD00
red = #C51D0B, red2 = #DD0000
emaEnergyColor(ma) => emaEnergy ? (close >= ma ? green : red) : na

barcolor(close > supertrend ? #2BE300 : red2)


p3 = plot(ocAvg, "", na, editable=false)
p4 = plot(psar, "PSAR", usePsar ? (close > psar ? green : red) : na, 1,
plot.style_circles, editable=false)
fill(p3, p4, usePsar ? (close > psar ? color.new(green, 90) : color.new(red, 90)) :
na, editable=false)
y1 = low - (ta.atr(30) * 2), y1B = low - ta.atr(30)
y2 = high + (ta.atr(30) * 2), y2B = high + ta.atr(30)
bull = ta.crossover(close, supertrend) and close >= sma9
bear = ta.crossunder(close, supertrend) and close <= sma9
buy = bull ? label.new(bar_index, y1, "BUY", xloc.bar_index, yloc.price, #2BE300,
label.style_label_up, color.white) : na
sell = bear ? label.new(bar_index, y2, "SELL", xloc.bar_index, yloc.price, red2,
label.style_label_down, color.white) : na
plot(pivotHigh, "Resistance", not suppRes or ta.change(pivotHigh) ? na : red, 2,
offset=-(barsR + 1), editable=false)
plot(pivotLow, "Support", not suppRes or ta.change(pivotLow) ? na : green, 2,
offset=-(barsR + 1), editable=false)
upB = breaks and ta.crossover(close, pivotHigh) ? label.new(bar_index, y1B, "B",
xloc.bar_index, yloc.price, green, label.style_label_up, color.white, size.small) :
na
dnB = breaks and ta.crossunder(close, pivotLow) ? label.new(bar_index, y2B, "B",
xloc.bar_index, yloc.price, red, label.style_label_down, color.white, size.small) :
na
x1 = bar_index - period + 1, _y1 = i + s * (period - 1), x2 = bar_index, _y2 = i
upperTL = autoTL ? line.new(x1, _y1 + upDev, x2, _y2 + upDev, xloc.bar_index,
extend.none, red) : na
line.delete(upperTL[1])
middleTL = autoTL ? line.new(x1, _y1, x2, _y2, xloc.bar_index, extend.none,
color.white) : na
line.delete(middleTL[1])
lowerTL = autoTL ? line.new(x1, _y1 - dnDev, x2, _y2 - dnDev, xloc.bar_index,
extend.none, green) : na
line.delete(lowerTL[1])

showDashboard = input.bool(true, title='Enable dashboard', inline='dashboard')


dashboardType = ('Advanced dashboard')

xDashBoard = input.int(80, 'dashboard distance', minval=20, maxval=1000, step=10)

// Security function
secSMA(_res) =>
request.security(syminfo.tickerid, showDashboard ? _res : timeframe.period,
ta.sma(ohlc4, 200) < close, lookahead=barmerge.lookahead_on)

//}

advDash = dashboardType == 'Advanced dashboard'

// Simple dashboard has the following timeframes in it


// 1. Current
trendCurrent = ta.sma(close, 200) < close ? '🟢' : '🔴'

// 2. 15min
trend15min = secSMA(showDashboard ? '15' : '15') ? '🟢' : '🔴'

// 3. 1hr
trend1hr = secSMA(showDashboard ? '60' : '15') ? '🟢' : '🔴'

// 4. 4hr
trend4hr = secSMA(showDashboard ? '240' : '15') ? '🟢' : '🔴'

// 5. 1D
trend1d = secSMA(showDashboard ? '1D' : '15') ? '🟢' : '🔴'
// Advanced dashboard trends
// 1. 1min
trend1min = secSMA(advDash and showDashboard ? '1' : '15') ? '🟢' : '🔴'

// 2. 3min
trend3min = secSMA(advDash and showDashboard ? '3' : '15') ? '🟢' : '🔴'

// 3. 5min
trend5min = secSMA(advDash and showDashboard ? '5' : '15') ? '🟢' : '🔴'

// 4. 10min
trend10min = secSMA(advDash and showDashboard ? '10' : '15') ? '🟢' : '🔴'

// 5. 30min
trend30min = secSMA(advDash and showDashboard ? '30' : '15') ? '🟢' : '🔴'

// 6. 2hr
trend12hr = secSMA(advDash and showDashboard ? '720' : '15') ? '🟢' : '🔴'

// 7. 12hr
trend2hr = secSMA(advDash and showDashboard ? '120' : '15') ? '🟢' : '🔴'

rsiTrend = ta.rsi(close, 14)

// RSI condition
rsiCond = rsiTrend < 30 ? 'Oversold (' + str.tostring(math.round(rsiTrend, 2)) +
')' : rsiTrend > 70 ? 'Overbought (' + str.tostring(math.round(rsiTrend, 2)) +
')' : 'Healthy (' + str.tostring(math.round(rsiTrend, 2)) + ')'

// ATR function
atrTrend = ta.atr(14)
atrTrendCond = atrTrend > ta.ema(ta.sma(atrTrend, 100), 100) ? 'Trending' :
'Ranging'

btime = int(ta.sma(time - time[1], 50))

label dashboard = na

if showDashboard
dashboard := label.new(x=time + btime * xDashBoard, y=(ta.highest(20) +
ta.lowest(20)) / 2, text='🌿 discord.gg/indicator🌿' + '\n\nCurrent Trend: ' +
trendCurrent + '\nPrice condition: ' + rsiCond + '\nVolume: ' +
str.tostring(math.round(volume * close, 2)) + ' ' + syminfo.currency + '\
nVolatility: ' + atrTrendCond + '\n\n_____________________' + (advDash ? '\n\
n1min: ' + trend1min : '') + (advDash ? '\n3min: ' + trend3min : '') + (advDash ?
'\n5min: ' + trend5min : '') + (advDash ? '\n10min: ' + trend10min : '') + '\
n15min: ' + trend15min + (advDash ? '\n30min: ' + trend30min : '') + '\n1hr: ' +
trend1hr + (advDash ? '\n2hr: ' + trend2hr : '') + '\n4hr: ' + trend4hr +
(advDash ? '\n12hr: ' + trend12hr : '') + '\nDaily: ' + trend1d,
color=color.rgb(51,255,255,70), textcolor=color.white,
style=label.style_label_left, xloc=xloc.bar_time, yloc=yloc.price,
textalign=text.align_left)
dashboard

label.delete(dashboard[1])

alertcondition(bull, title='Buy Signal', message = "BUY")


alertcondition(bear, title='Buy Signal', message = "BUY")

//
===================================================================================
=======

You might also like