ZZ Algo MR Algo
ZZ Algo MR Algo
//@version=5
indicator('ZZ Algo MR V3', overlay=true)
import TradingView/ta/7
// Setting
showsignals = input(title='Sinyalleri Goster', defval=true, group = 'Al Ve Sat
Sinyal [ZZAlgo]')
sensitivity = input.int(title='Hassasiyet (1-20)', defval=20, minval = 1, maxval =
45, group = 'Al Ve Sat Sinyal [ZZAlgo]') + 1
Periods = sensitivity * 10
src = hl2
Multiplier = sensitivity / 2
changeATR = true
highlighting = false
atr2 = ta.sma(ta.tr, Periods)
atr = changeATR ? ta.atr(Periods) : atr2
up = src - Multiplier * atr
up1 = nz(up[1], up)
up := close[1] > up1 ? math.max(up, up1) : up
dn = src + Multiplier * atr
dn1 = nz(dn[1], dn)
dn := close[1] < dn1 ? math.min(dn, dn1) : dn
trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
buySignal = trend == 1 and trend[1] == -1
plotshape(buySignal and showsignals ? up : na, title='Al', text='Al Sinyal',
location=location.absolute, style=shape.labelup, size=size.normal, color=#00ff00,
textcolor=color.new(color.black, 0))
sellSignal = trend == -1 and trend[1] == 1
plotshape(sellSignal and showsignals ? dn : na, title='Sat', text='Sat Sinyal',
location=location.absolute, style=shape.labeldown, size=size.normal, color=#ff0000,
textcolor=color.new(color.white, 0))
// Data reference
[macd, signal, hist] = ta.macd(src, fastLength, slowLength, signalLength)
// 4 level of green
greenHigh = color.rgb(0, 188, 212)
greenMidHigh = color.rgb(0, 188, 212)
greenMidLow = color.rgb(0, 188, 212)
greenLow = color.rgb(0, 188, 212)
// Yellow
yellowLow = color.rgb(0, 230, 118)
// 4 level of red
redHigh = color.rgb(156, 39, 176)
redMidHigh = color.rgb(156, 39, 176)
redMidLow = color.rgb(156, 39, 176)
redLow = color.rgb(156, 39, 176)
// 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
// Bearish trend
if macd < 0 and hist < 0
candleBody := redMidLow
// Smart Trail
// inputs //
//{
trailType = 'modified'
ATRPeriod = 13
ATRFactor = 4
smoothing = 8
Up = norm_c - loss
Dn = norm_c + loss
TrendUp = Up
TrendDown = Dn
Trend = 1
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]
//}
fib1Level = 61.8
fib2Level = 78.6
fib3Level = 88.6