0% found this document useful (0 votes)
11 views

ATCA HO

Tradingview Indicator

Uploaded by

limoko7589
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)
11 views

ATCA HO

Tradingview Indicator

Uploaded by

limoko7589
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/ 6

//@version=5

indicator("ATCA-HO",overlay=true, max_bars_back=2000, max_lines_count=500,


max_labels_count=500,max_boxes_count=500)

src = input(close, title='Source')

//5-8-13 Signal
len15 = input.int(5, minval=1, title='EMA-1')
out15 = ta.ema(src, len15)
plot(out15, color=color.rgb(10, 170, 2), linewidth=2, title='EMA-1')

len181 = input.int(14, minval=1, title='EMA-2')


out181 = ta.ema(src, len181)
plot(out181, color=color.rgb(255, 196, 0), linewidth=1, title='EMA-2')

len131 = input.int(22, minval=1, title='EMA-3')


out131 = ta.ema(src, len131)
plot(out131, color=color.rgb(243, 0, 0), linewidth=2, title='EMA-3')

len115 = input.int(34, minval=1, title='EMA-4')


out115 = ta.ema(src, len115)
plot(out115, color=color.rgb(178, 0, 133), linewidth=2, title='EMA4')

len1811 = input.int(55, minval=1, title='EMA-5')


out1811 = ta.ema(src, len1811)
plot(out1811, color=color.rgb(34, 0, 255), linewidth=2, title='EMA5')

len1311 = input.int(89, minval=1, title='EMA-6')


out1311 = ta.ema(src, len1311)
plot(out1311, color=color.rgb(255, 196, 0), linewidth=2, title='EMA-6')

len13111 = input.int(200, minval=1, title='SMA')


out13111 = ta.sma(src, len13111)
plot(out13111, color=color.rgb(133, 0, 130), linewidth=2, title='SMA')

// Al/Sat Sinyalleri
longCondition = ta.crossover(out15, out131)
shortCondition = ta.crossunder(out15, out131)

//Al/Sat Etiketleri
plotshape(longCondition ? true : na, color=color.new(#1000c2, 0),
style=shape.labelup, title= "AL", location=location.belowbar, size=size.small,
textcolor=color.white, text='A')
plotshape(shortCondition ? true : na, color=color.new(#ff9500, 0),
style=shape.labeldown, title= "SAT", location=location.abovebar, size=size.small,
textcolor=color.white, text='S')

alertcondition(ta.crossover(out15, out131), title='EMA 5-13 AL KESİŞİM',


message='DİKKAT EMA5, EMA13 YUKARI KESTİ- AL')
alertcondition(ta.crossunder(out15, out131), title='EMA 5-13 SAT KESİŞİM',
message='DİKKAT EMA5, EMA13 AŞAĞI KESTİ- SAT')

//////////////////////////////////////
// Otomatik Trend Ayarları
string gr_trend = "╠══════ Otomatik Trend Ayarları ══════╣"
var int history_bars = input(300, title='Geçmiş çubuk sayısı', defval=300,
group=gr_trend)

// Destek çizgisi ayarları


col_sup = input(color.new(#260097, 0), title="Destek Rengi", group="Destek
Çizgisi")
style_sup = input(line.style_solid, title="Destek Çizgi Stili", group="Destek
Çizgisi")
width_sup = input(2, title="Destek Çizgi Kalınlığı", group="Destek Çizgisi")

// Direnç çizgisi ayarları


col_res = input(color.new(#d40000, 0), title="Direnç Rengi", group="Direnç
Çizgisi")
style_res = input(line.style_solid, title="Direnç Çizgi Stili", group="Direnç
Çizgisi")
width_res = input(2, title="Direnç Çizgi Kalınlığı", group="Direnç Çizgisi")

// Fiyatı hesapla
price_at(t1, p1, t2, p2, t3) =>
p1 + (p2 - p1) * (t3 - t1) / (t2 - t1)

// Uyarılar
// if 1 == 1
// alert('test')

// Yuvaya çevrilmiş yuvarlama fonksiyonu


round_to_tick(x) =>
mult = 1 / syminfo.mintick
value = math.ceil(x * mult) / mult
value

// Destek ve Direnç çizgilerini saklamak için diziler


var line[] supports = array.new_line()
var line[] resistances = array.new_line()
var label[] labels = array.new_label()

// Geçmiş çizgileri temizle


line temp_line = na
if array.size(supports) > 0
for i = array.size(supports) - 1 to 0 by -1
temp_line := array.get(supports, i)
line.delete(temp_line)
array.remove(supports, i)

if array.size(resistances) > 0
for i = array.size(resistances) - 1 to 0 by -1
temp_line := array.get(resistances, i)
line.delete(temp_line)
array.remove(resistances, i)

// Ekstremumları belirle
min_values = low
max_values = high
xx1 = input(title='Çözünürlük (çubuklar)', defval=6, group=gr_trend)
xx2 = math.round(xx1 / 2)
int minimums = 0
minimums := ta.lowestbars(min_values, xx1) == -xx2 ? xx2 : minimums[1] + 1

int maximums = 0
maximums := ta.highestbars(max_values, xx1) == -xx2 ? xx2 : maximums[1] + 1

int minimum1 = 0
int minimum2 = 0
int maximum1 = 0
int maximum2 = 0
int medium = 0

// Destek çizgileri
if barstate.islast
line last_line = na
line last_line2 = na
label last_label = na
for k1 = 0 to 50 by 1
if minimum1 >= history_bars
break
minimum1 += minimums[minimum1]
minimum2 := minimum1 * 2
for k2 = 0 to 50 by 1
if minimum2 >= minimum1 * 8 or minimum2 >= history_bars
break
minimum2 += minimums[minimum2]

if minimum1 >= history_bars or minimum2 >= history_bars


break

bar1 = bar_index - minimum1


bar2 = bar_index - minimum2

price1 = low[minimum1]
price2 = low[minimum2]

current_price = price_at(bar2, price2, bar1, price1, bar_index)


current_price2 = price_at(bar1, price1, bar_index, current_price,
bar_index)

if current_price < high[1]


crossed = 0
medium := 0
for k3 = 0 to 50 by 1
if medium >= minimum2
break
medium += minimums[medium]
if medium >= minimum2
break
if price_at(bar2, price2, bar1, price1, bar_index - medium) >
math.min(open[medium], close[medium])
crossed := 1
break

if crossed == 0
if not na(last_line) and not na(last_line2)
last_price = price_at(line.get_x1(last_line),
line.get_y1(last_line), line.get_x2(last_line), line.get_y2(last_line), bar_index)
last_price2 = price_at(line.get_x1(last_line2),
line.get_y1(last_line2), line.get_x2(last_line2), line.get_y2(last_line2),
bar_index)

if bar1 == line.get_x2(last_line) and bar_index ==


line.get_x2(last_line2)
if current_price > last_price and current_price >
last_price2
line.set_xy1(last_line, bar2, price2)
line.set_xy2(last_line, bar1, price1)
line.set_color(last_line, col_sup)
// label.set_xy(last_label, bar_index,
current_price)
// label.set_text(last_label,
str.tostring(round_to_tick(current_price)))
line.set_xy1(last_line2, bar1, price1)
line.set_xy2(last_line2, bar_index, current_price)
line.set_color(last_line2, col_sup)
true
else
last_line := line.new(bar2, price2, bar1, price1,
extend=extend.none, color=col_sup, style=style_sup)
last_line2 := line.new(bar1, price1, bar_index,
current_price, extend=extend.none, color=col_sup, style=line.style_dashed)
// last_label := label.new(bar_index, current_price2,
color=col_sup, style=label.style_label_upper_left,
text=str.tostring(round_to_tick(current_price)))
// array.push(labels, last_label)
array.push(supports, last_line)
array.push(supports, last_line2)
true
else
last_line := line.new(bar2, price2, bar1, price1,
extend=extend.none, color=col_sup, style=style_sup)
last_line2 := line.new(bar1, price1, bar_index,
current_price, extend=extend.none, color=col_sup, style=line.style_dashed)
// last_label := label.new(bar_index, current_price2,
color=col_sup, style=label.style_label_upper_left,
text=str.tostring(round_to_tick(current_price)))
// array.push(labels, last_label)
array.push(supports, last_line)
array.push(supports, last_line2)
true

last_line := na
last_line2 := na
// Direnç çizgileri
for k1 = 0 to 100 by 1
if maximum1 >= history_bars
break
maximum1 += maximums[maximum1]
maximum2 := maximum1 * 2
for k2 = 0 to 50 by 1
if maximum2 >= maximum1 * 8 or maximum2 >= history_bars
break
maximum2 += maximums[maximum2]

if maximum1 >= history_bars or maximum2 >= history_bars


break

bar1 = bar_index - maximum1


bar2 = bar_index - maximum2

price1 = high[maximum1]
price2 = high[maximum2]

current_price = price_at(bar2, price2, bar1, price1, bar_index)


current_price2 = price_at(bar1, price1, bar_index, current_price,
bar_index)

if current_price > low[1]


crossed = 0
medium := 0
for k3 = 0 to 100 by 1
if medium >= maximum2
break
medium += maximums[medium]
if medium >= maximum2
break
if price_at(bar2, price2, bar1, price1, bar_index - medium) <
math.max(open[medium], close[medium])
crossed := 1
break

if crossed == 0
if not na(last_line) and not na(last_line2)
last_price = price_at(line.get_x1(last_line),
line.get_y1(last_line), line.get_x2(last_line), line.get_y2(last_line), bar_index)
last_price2 = price_at(line.get_x1(last_line2),
line.get_y1(last_line2), line.get_x2(last_line2), line.get_y2(last_line2),
bar_index)

if bar1 == line.get_x2(last_line) and bar_index ==


line.get_x2(last_line2)
if current_price < last_price and current_price <
last_price2
line.set_xy1(last_line, bar2, price2)
line.set_xy2(last_line, bar1, price1)
line.set_color(last_line, col_res)
// label.set_xy(last_label, bar_index,
current_price)
// label.set_text(last_label,
str.tostring(round_to_tick(current_price)))
line.set_xy1(last_line2, bar1, price1)
line.set_xy2(last_line2, bar_index, current_price)
line.set_color(last_line2, col_res)
true
else
last_line := line.new(bar2, price2, bar1, price1,
extend=extend.none, color=col_res, style=style_res)
last_line2 := line.new(bar1, price1, bar_index,
current_price, extend=extend.none, color=col_res, style=line.style_dashed)
// last_label := label.new(bar_index, current_price2,
color=col_res, style=label.style_label_lower_left,
text=str.tostring(round_to_tick(current_price)))
// array.push(labels, last_label)
array.push(resistances, last_line)
array.push(resistances, last_line2)
true
else
last_line := line.new(bar2, price2, bar1, price1,
extend=extend.none, color=col_res, style=style_res)
last_line2 := line.new(bar1, price1, bar_index,
current_price, extend=extend.none, color=col_res, style=line.style_dashed)
// last_label := label.new(bar_index, current_price2,
color=col_res, style=label.style_label_lower_left,
text=str.tostring(round_to_tick(current_price)))
// array.push(labels, last_label)
array.push(resistances, last_line)
array.push(resistances, last_line2)
true

You might also like