AYDIN-fibo v2
AYDIN-fibo v2
AYDIN-fibo v2
0 at
https://mozilla.org/MPL/2.0/
//@version=5
indicator('AYDIN-FİBO V2', shorttitle='AYDIN-FİBO V2', overlay=true)
//////////////EMA
//EMA
len5 = input.int(5, minval=1, title='EMA-1', group="EMA")
out5 = ta.ema(src, len5)
plot(out5, color=color.rgb(68, 177, 0), linewidth=2, title='EMA-1')
// Al/Sat Sinyalleri
longCondition = ta.crossover(out5, out13)
shortCondition = ta.crossunder(out5, out13)
//Al/Sat Etiketleri
plotshape(longCondition ? true : na, color=color.new(#44c200, 0),
style=shape.labelup, title= "AL", location=location.belowbar, size=size.small,
textcolor=color.white, text='AL')
plotshape(shortCondition ? true : na, color=color.new(#ff0000, 0),
style=shape.labeldown, title= "SAT", location=location.abovebar, size=size.small,
textcolor=color.white, text='SAT')
/////////////BOLLINGER
length = input.int(20, minval=1, title='BB MA')
src9 = input(close, title='BB Source')
mult = input.float(2.0, minval=0.001, maxval=50, title='Narrow BB Multitude')
////ALMA
// INPUTS:
len1 = input.int(14, title='Arnaud Legoux MA Length', minval=1, group="ALMA")
src22 = input(close, title='Source', group="ALMA")
offset = input.float(0.85, title='ALMA Offset', minval=0.0001)
sigma = input.int(6, title='ALMA Sigma Value', minval=1)
trendALMA = ta.alma(src22, len1, offset, sigma)
res18 = input.timeframe('1W', "Resolution", title="ALMAPeriyod")
out18 = request.security(syminfo.tickerid, res18, trendALMA)
// PLOTTING:
almaColor = trendALMA >= trendALMA[1] ? color.rgb(2, 170, 10) : color.rgb(253, 2,
2)
p01 = plot(trendALMA, title='ALMA', color=almaColor, linewidth=2)
////////////////////FİBO
// Kullanıcı tarafından değiştirilebilir Fibonacci seviyeleri
fibLevel214 = input.float(0.214, title="Fibonacci Seviyesi - 0.214", group="FIBO")
fibLevel382 = input.float(0.382, title="Fibonacci Seviyesi - 0.382")
fibLevel5 = input.float(0.5, title="Fibonacci Seviyesi - 0.5")
fibLevel618 = input.float(0.618, title="Fibonacci Seviyesi - 0.618")
fibLevel702 = input.float(0.702, title="Fibonacci Seviyesi - 0.702")
fibLevel786 = input.float(0.786, title="Fibonacci Seviyesi - 0.786")
fibLevel1618 = input.float(1.618, title="Fibonacci Seviyesi - 1.618")
fibLevel2618 = input.float(2.618, title="Fibonacci Seviyesi - 2.618")
fibLevel3618 = input.float(3.618, title="Fibonacci Seviyesi - 3.618")
// Grafik çizimleri
plot(upper, color=color.rgb(6, 0, 7), title='Üst')
plot(lower, color=color.rgb(18, 0, 10), title='Alt')
//////
///////////////uyumsuzluklar
prd = input.int(defval=5, title='Pivot Period', minval=1, maxval=50)
source = input.string(defval='Close', title='Source for Pivot Points',
options=['Close', 'High/Low'])
searchdiv = input.string(defval='Regular', title='Divergence Type',
options=['Regular', 'Hidden', 'Regular/Hidden'])
showindis = input.string(defval='Full', title='Show Indicator Names',
options=['Full', 'First Letter', 'Don\'t Show'])
showlimit = input.int(1, title='Minimum Number of Divergence', minval=1, maxval=11)
maxpp = input.int(defval=10, title='Maximum Pivot Points to Check', minval=1,
maxval=20)
maxbars = input.int(defval=100, title='Maximum Bars to Check', minval=30,
maxval=200)
shownum = input(defval=true, title='Show Divergence Number')
showlast = input(defval=false, title='Show Only Last Divergence')
dontconfirm = input(defval=false, title='Don\'t Wait for Confirmation')
showlines = input(defval=true, title='Show Divergence Lines')
showpivot = input(defval=false, title='Show Pivot Points')
calcmacd = input(defval=true, title='MACD')
calcmacda = input(defval=true, title='MACD Histogram')
calcrsi = input(defval=true, title='RSI')
calcstoc = input(defval=true, title='Stochastic')
calccci = input(defval=true, title='CCI')
calcmom = input(defval=true, title='Momentum')
calcobv = input(defval=true, title='OBV')
calcvwmacd = input(true, title='VWmacd')
calccmf = input(true, title='Chaikin Money Flow')
calcmfi = input(true, title='Money Flow Index')
calcext = input(false, title='Check External Indicator')
externalindi = input(defval=close, title='External Indicator')
pos_reg_div_col = input(defval=color.yellow, title='Positive Regular Divergence')
neg_reg_div_col = input(defval=color.navy, title='Negative Regular Divergence')
pos_hid_div_col = input(defval=color.lime, title='Positive Hidden Divergence')
neg_hid_div_col = input(defval=color.red, title='Negative Hidden Divergence')
pos_div_text_col = input(defval=color.black, title='Positive Divergence Text
Color')
neg_div_text_col = input(defval=color.white, title='Negative Divergence Text
Color')
reg_div_l_style_ = input.string(defval='Solid', title='Regular Divergence Line
Style', options=['Solid', 'Dashed', 'Dotted'])
hid_div_l_style_ = input.string(defval='Dashed', title='Hdden Divergence Line
Style', options=['Solid', 'Dashed', 'Dotted'])
reg_div_l_width = input.int(defval=2, title='Regular Divergence Line Width',
minval=1, maxval=5)
hid_div_l_width = input.int(defval=1, title='Hidden Divergence Line Width',
minval=1, maxval=5)
showmas = input.bool(defval=false, title='Show MAs 50 & 200', inline='ma12')
cma1col = input.color(defval=color.lime, title='', inline='ma12')
cma2col = input.color(defval=color.red, title='', inline='ma12')
// get indicators
rsi = ta.rsi(close, 14) // RSI
[macd, signal, deltamacd] = ta.macd(close, 12, 26, 9) // MACD
moment = ta.mom(close, 10) // Momentum
cci = ta.cci(close, 10) // CCI
Obv = ta.obv // OBV
stk = ta.sma(ta.stoch(close, high, low, 14), 3) // Stoch
maFast = ta.vwma(close, 12) // volume weighted macd
maSlow = ta.vwma(close, 26)
vwmacd = maFast - maSlow
Cmfm = (close - low - (high - close)) / (high - low) // Chaikin money flow
Cmfv = Cmfm * volume
cmf = ta.sma(Cmfv, 21) / ta.sma(volume, 21)
Mfi = ta.mfi(close, 14) // Moneyt Flow Index
if arrived
divlen := len
break
divlen
if arrived
divlen := len
break
divlen
// check minimum number of divergence, if less than showlimit then delete all
divergence
total_div = 0
for x = 0 to array.size(all_divergences) - 1 by 1
total_div += math.round(math.sign(array.get(all_divergences, x)))
total_div
delete_old_neg_div_lines() =>
if array.size(neg_div_lines) > 0
for j = 0 to array.size(neg_div_lines) - 1 by 1
line.delete(array.get(neg_div_lines, j))
array.clear(neg_div_lines)
delete_old_pos_div_labels() =>
if array.size(pos_div_labels) > 0
for j = 0 to array.size(pos_div_labels) - 1 by 1
label.delete(array.get(pos_div_labels, j))
array.clear(pos_div_labels)
delete_old_neg_div_labels() =>
if array.size(neg_div_labels) > 0
for j = 0 to array.size(neg_div_labels) - 1 by 1
label.delete(array.get(neg_div_labels, j))
array.clear(neg_div_labels)
// delete last creted lines and labels until we met new PH/PV
delete_last_pos_div_lines_label(n) =>
if n > 0 and array.size(pos_div_lines) >= n
asz = array.size(pos_div_lines)
for j = 1 to n by 1
line.delete(array.get(pos_div_lines, asz - j))
array.pop(pos_div_lines)
if array.size(pos_div_labels) > 0
label.delete(array.get(pos_div_labels, array.size(pos_div_labels) - 1))
array.pop(pos_div_labels)
delete_last_neg_div_lines_label(n) =>
if n > 0 and array.size(neg_div_lines) >= n
asz = array.size(neg_div_lines)
for j = 1 to n by 1
line.delete(array.get(neg_div_lines, asz - j))
array.pop(neg_div_lines)
if array.size(neg_div_labels) > 0
label.delete(array.get(neg_div_labels, array.size(neg_div_labels) - 1))
array.pop(neg_div_labels)
for x = 0 to 10 by 1
div_type = -1
for y = 0 to 3 by 1
if array.get(all_divergences, x * 4 + y) > 0 // any divergence?
div_type := y
if y % 2 == 1
dnumdiv_top += 1
top_label_col := array.get(div_colors, y)
top_label_col
if y % 2 == 0
dnumdiv_bottom += 1
bottom_label_col := array.get(div_colors, y)
bottom_label_col
if not array.includes(distances, array.get(all_divergences, x * 4 + y))
// line not exist ?
array.push(distances, array.get(all_divergences, x * 4 + y))
new_line = showlines ? line.new(x1=bar_index -
array.get(all_divergences, x * 4 + y), y1=source == 'Close' ?
close[array.get(all_divergences, x * 4 + y)] : y % 2 == 0 ?
low[array.get(all_divergences, x * 4 + y)] : high[array.get(all_divergences, x * 4
+ y)], x2=bar_index - startpoint, y2=source == 'Close' ? close[startpoint] : y % 2
== 0 ? low[startpoint] : high[startpoint], color=array.get(div_colors, y), style=y
< 2 ? reg_div_l_style : hid_div_l_style, width=y < 2 ? reg_div_l_width :
hid_div_l_width) : na
if y % 2 == 0
if old_pos_divs_can_be_removed
old_pos_divs_can_be_removed := false
if not showlast and remove_last_pos_divs
delete_last_pos_div_lines_label(last_pos_div_lines)
last_pos_div_lines := 0
last_pos_div_lines
if showlast
delete_old_pos_div_lines()
array.push(pos_div_lines, new_line)
last_pos_div_lines += 1
remove_last_pos_divs := true
remove_last_pos_divs
if y % 2 == 1
if old_neg_divs_can_be_removed
old_neg_divs_can_be_removed := false
if not showlast and remove_last_neg_divs
delete_last_neg_div_lines_label(last_neg_div_lines)
last_neg_div_lines := 0
last_neg_div_lines
if showlast
delete_old_neg_div_lines()
array.push(neg_div_lines, new_line)
last_neg_div_lines += 1
remove_last_neg_divs := true
remove_last_neg_divs
// draw labels
if showindis != 'Don\'t Show' or shownum
if shownum and dnumdiv_top > 0
divergence_text_top += str.tostring(dnumdiv_top)
divergence_text_top
if shownum and dnumdiv_bottom > 0
divergence_text_bottom += str.tostring(dnumdiv_bottom)
divergence_text_bottom
if divergence_text_top != ''
if showlast
delete_old_neg_div_labels()
array.push(neg_div_labels, label.new(x=bar_index, y=math.max(high,
high[1]), text=divergence_text_top, color=top_label_col,
textcolor=neg_div_text_col, style=label.style_label_down))
if divergence_text_bottom != ''
if showlast
delete_old_pos_div_labels()
array.push(pos_div_labels, label.new(x=bar_index, y=math.min(low, low[1]),
text=divergence_text_bottom, color=bottom_label_col, textcolor=pos_div_text_col,
style=label.style_label_up))