KB Al - Sat Kombi̇ne İndi̇katör
KB Al - Sat Kombi̇ne İndi̇katör
///////TRENDDD HULLL///////
//INPUT
src5 = input(close, title='Source')
modeSwitch = input.string('Hma', title='Hull Variation', options=['Hma', 'Thma',
'Ehma'])
length8 = input(20, title='Length(180-200 for floating S/R , 20 for swing entry)')
lengthMult = input(1.0, title='Length multiplier (Used to view higher timeframes
with straight band)')
//FUNCTIONS
//HMA
HMA(_src5, _length) =>
ta.wma(2 * ta.wma(_src5, _length / 2) - ta.wma(_src5, _length),
math.round(math.sqrt(_length)))
//EHMA
EHMA(_src5, _length) =>
ta.ema(2 * ta.ema(_src5, _length / 2) - ta.ema(_src5, _length),
math.round(math.sqrt(_length)))
//THMA
THMA(_src5, _length) =>
ta.wma(ta.wma(_src5, _length / 3) * 3 - ta.wma(_src5, _length / 2) -
ta.wma(_src5, _length), _length)
//SWITCH
Mode(modeSwitch, src5, len) =>
modeSwitch == 'Hma' ? HMA(src5, len) : modeSwitch == 'Ehma' ? EHMA(src5, len) :
modeSwitch == 'Thma' ? THMA(src5, len / 2) : na
//OUT
_hull = Mode(modeSwitch, src5, int(length8 * lengthMult))
HULL = useHtf ? request.security(syminfo.ticker, htf, _hull) : _hull
MHULL = HULL[0]
SHULL = HULL[2]
//COLOR
hullColor = switchColor ? HULL > HULL[2] ? #00ff00 : #ff0000 : #ff9800
//PLOT
///< Frame
Fi1 = plot(MHULL, title='MHULL', color=hullColor, linewidth=thicknesSwitch,
transp=80)
Fi2 = plot(visualSwitch ? SHULL : na, title='SHULL', color=hullColor,
linewidth=thicknesSwitch, transp=80)
alertcondition(ta.crossover(MHULL, SHULL), title='Hull trending up.', message='Hull
trending up.')
alertcondition(ta.crossover(SHULL, MHULL), title='Hull trending down.',
message='Hull trending down.')
///< Ending Filler
fill(Fi1, Fi2, title='Band Filler', color=hullColor, transp=60)
///BARCOLOR
barcolor(color=candleCol ? switchColor ? hullColor : na : na)
/////////RSI ////////
ad = close == high and close == low or high == low ? 0 : (2 * close - low - high) /
(high - low) * volume
mf = math.sum(ad, length) / math.sum(volume, length)
dirmov(len) =>
up = ta.change(high)
down = -ta.change(low)
plusDM = na(up) ? na : up > down and up > 0 ? up : 0
minusDM = na(down) ? na : down > up and down > 0 ? down : 0
truerange = ta.rma(ta.tr, len)
plus = fixnan(100 * ta.rma(plusDM, len) / truerange)
minus = fixnan(100 * ta.rma(minusDM, len) / truerange)
[plus, minus]
adx(dilen, adxlen) =>
[plus, minus] = dirmov(dilen)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
adx
//src = Rsi
attt = ta.atr(14)
lengthSR = 14 //
highestHigh = ta.highest(high, lengthSR)
lowestLow = ta.lowest(low, lengthSR)
// RSI
lengthRSI = 9
rsiValue = ta.rsi(close, lengthRSI)
rsiOverbought = 85
rsiOversold = 17
//
// RSI
longCondition = rsiValue < rsiOversold and close > lowestLow
shortCondition = rsiValue > rsiOverbought and close < highestHigh
//
plotshape(series=longCondition, title="RSI-AL", location=location.belowbar,
color=color.new(color.green, 80), style=shape.labelup, text="AL")
plotshape(series=shortCondition, title="RSI-SAT", location=location.abovebar,
color=color.new(color.orange, 80),
style=shape.labeldown,textcolor=color.new(color.blue, 0), text="SAT")
////BOLL�NGERRR//////
//////FIBONACC� SEV�YELER�//////
FIBS = Fibs == 'Plot Fibs based on Lookback' ? 1 : Fibs == 'Plot Fibs based on
Price Input' ? 2 : na
Fib_x(n) =>
revfibs ? (Fhigh - Flow) * n + Flow : Fhigh - (Fhigh - Flow) * n
Fib_line(x) =>
var line ln = na
line.delete(ln)
ln := line.new(BB, x, bar_index, x, color=close > x ? BullColor : BearColor,
extend=EXTEND, style=STYLE, width=WIDTH)
ln
Fib0 = Fib_line(Fib_x(0))
Fib236 = Fib_line(Fib_x(0.236))
Fib382 = Fib_line(Fib_x(0.382))
Fib500 = Fib_line(Fib_x(0.500))
Fib618 = Fib_line(Fib_x(0.618))
Fib786 = Fib_line(Fib_x(0.786))
Fib1000 = Fib_line(Fib_x(1.000))
Fib1618 = Fib_line(Fib_x(1.618))
Fib2618 = Fib_line(Fib_x(2.618))
LFib1618 = Fib_label(Fib_x(1.618), '1.618 ( ')
LFib2618 = Fib_label(Fib_x(2.618), '2.618 ( ')
Fib1272 = Fib_line(Fib_x(1.272))
Fib1618 = Fib_line(Fib_x(1.618))
Fib2000 = Fib_line(Fib_x(2.000))
Fib2236 = Fib_line(Fib_x(2.236))
Fib2618 = Fib_line(Fib_x(2.618))
Fib3236 = Fib_line(Fib_x(3.236))
Fib3618 = Fib_line(Fib_x(3.618))
Fib4236 = Fib_line(Fib_x(4.236))
Fib4618 = Fib_line(Fib_x(4.618))
Fib4618
if FIBS == 2
////////DESTEK-D�REN�////////
// keep old SR channels and calculate/sort new channels if we met new pivot point
var suportresistance = array.new_float(20, 0) // min/max levels
changeit(x, y) =>
tmp = array.get(suportresistance, y * 2)
array.set(suportresistance, y * 2, array.get(suportresistance, x * 2))
array.set(suportresistance, x * 2, tmp)
tmp := array.get(suportresistance, y * 2 + 1)
array.set(suportresistance, y * 2 + 1, array.get(suportresistance, x * 2 + 1))
array.set(suportresistance, x * 2 + 1, tmp)
if ph or pl
supres = array.new_float(0) // number of pivot, strength, min/max levels
stren = array.new_float(10, 0)
// get levels and strengs
for x = 0 to array.size(pivotvals) - 1 by 1
[hi, lo, strength] = get_sr_vals(x)
array.push(supres, strength)
array.push(supres, hi)
array.push(supres, lo)
//reset SR levels
array.fill(suportresistance, 0)
// get strongest SRs
src = 0
for x = 0 to array.size(pivotvals) - 1 by 1
stv = -1. // value
stl = -1 // location
for y = 0 to array.size(pivotvals) - 1 by 1
if array.get(supres, y * 3) > stv and array.get(supres, y * 3) >=
minstrength * 20
stv := array.get(supres, y * 3)
stl := y
stl
if stl >= 0
//get sr level
hh = array.get(supres, stl * 3 + 1)
ll = array.get(supres, stl * 3 + 2)
array.set(suportresistance, src * 2, hh)
array.set(suportresistance, src * 2 + 1, ll)
array.set(stren, src, array.get(supres, stl * 3))
src += 1
if src >= 10
break
for x = 0 to 8 by 1
for y = x + 1 to 9 by 1
if array.get(stren, y) > array.get(stren, x)
tmp = array.get(stren, y)
array.set(stren, y, array.get(stren, x))
changeit(x, y)
get_level(ind) =>
float ret = na
if ind < array.size(suportresistance)
if array.get(suportresistance, ind) != 0
ret := array.get(suportresistance, ind)
ret
ret
get_color(ind) =>
color ret = na
if ind < array.size(suportresistance)
if array.get(suportresistance, ind) != 0
ret := array.get(suportresistance, ind) > close and
array.get(suportresistance, ind + 1) > close ? res_col :
array.get(suportresistance, ind) < close and array.get(suportresistance, ind + 1) <
close ? sup_col : inch_col
ret
ret
resistancebroken = false
supportbroken = false
//////MACD KES���M///