Bu indikatör, kısa, orta ve uzun vadeli 3 farklı hareketli ortalama (SMA veya EMA) değerini (20, 50, 200) kullanarak, 24 sembolün long veya short değerlerini tablo halinde ekrana yazar.
Özellikleri
Screener paneli
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Niteya
//@version=5
// Bu screener şablonu sadece eğitim amaçlı olarak verilmiştir. Yatırım kararlarınızda kullanmayınız.
indicator(title="Niteya MA Screener", shorttitle='Niteya MAS', overlay=true)
ma_length1 = input(20, '1. MA uzunluğu')
ma_length2 = input(50, '2. MA uzunluğu')
ma_length3 = input(200, '3. MA uzunluğu')
is_gold_cross = input.bool(defval=false, title="Altın kesişim")
table_pos = input.string(title='Table position', defval='Left', options=['Left', 'Center', 'Right'])
ticker1 = input.string("XAUTRYG", "Ticker1")
ticker2 = input.string("BIST_DLY:AKBNK", "Ticker2")
ticker3 = input.string("BIST_DLY:AKSA", "Ticker3")
ticker4 = input.string("BIST_DLY:ALARK", "Ticker4")
ticker5 = input.string("BIST_DLY:ALKIM", "Ticker5")
ticker6 = input.string("BIST_DLY:ARCLK", "Ticker6")
ticker7 = input.string("BIST_DLY:ASELS", "Ticker7")
ticker8 = input.string("BIST_DLY:ASTOR", "Ticker8")
ticker9 = input.string("BIST_DLY:AYDEM", "Ticker9")
ticker10 = input.string("BIST_DLY:BIMAS", "Ticker10")
ticker11 = input.string("BIST_DLY:BRISA", "Ticker11")
ticker12 = input.string("BIST_DLY:BRSAN", "Ticker12")
ticker13 = input.string("BIST_DLY:BUCIM", "Ticker13")
ticker14 = input.string("BIST_DLY:CCOLA", "Ticker14")
ticker15 = input.string("BIST_DLY:CEMTS", "Ticker15")
ticker16 = input.string("BIST_DLY:CIMSA", "Ticker16")
ticker17 = input.string("BIST_DLY:DOAS", "Ticker17")
ticker18 = input.string("BIST_DLY:EGEEN", "Ticker18")
ticker19 = input.string("BIST_DLY:ENJSA", "Ticker19")
ticker20 = input.string("BIST_DLY:ENKAI", "Ticker20")
ticker21 = input.string("BIST_DLY:ERBOS", "Ticker21")
ticker22 = input.string("BIST_DLY:EREGL", "Ticker22")
ticker23 = input.string("BIST_DLY:EUPWR", "Ticker23")
ticker24 = input.string("BIST_DLY:FROTO", "Ticker24")
get_vals() =>
[open, close, high, low, volume, bar_index, last_bar_index]
var long_index = array.new_int(24, 0)
var short_index = array.new_int(24, 0)
var symbol_cond = array.new_int(24, 0)
var time_value = array.new_string(24, ' ')
var close_s = array.new_float(24, na)
var close_e = array.new_float(24, na)
var pStart = array.new_int(24, 0)
var pStop = array.new_int(24, 0)
calcs(ticker_index, open_g, close_g, high_g, low_g, volume_g, bar_index_g, last_bar_index_g) =>
// MA hesaplamaları
ma_11 = ta.ema(close_g, ma_length1)
ma_12 = ta.ema(close_g, ma_length2)
ma_13 = ta.ema(close_g, ma_length3)
ma_long = (close_g>ma_11) and (ma_11>ma_12 or ta.crossover(ma_11, ma_12)) and (ma_12>ma_13 or ta.crossover(ma_12, ma_13))
ma_short = (close_g<ma_11) and (ma_11<ma_12 or ta.crossunder(ma_11, ma_12))
long_cond = ma_long ? true : false // Long işleme giriş değerinin kontrolü
short_cond = ma_short ? true : false // Short işleme giriş değerinin kontrolü
entry_long = long_cond or (is_gold_cross and ta.crossover(ma_12, ma_13))
entry_short = short_cond or (is_gold_cross and ta.crossunder(ma_12, ma_13))
array.set(symbol_cond, ticker_index, entry_long ? 1 : (entry_short ? -1 : 0))
bar_index_o = (last_bar_index_g - bar_index_g) + 1
int PeriodS1 = 0
int PeriodS2 = 0
if bar_index_g>0 and array.get(time_value, ticker_index)==' '
PeriodS1 := timestamp(year(time[1]), month(time[1]), dayofmonth(time[1]), 0, 0)
array.set(pStart, ticker_index, PeriodS1)
PeriodS2 := timestamp(year(last_bar_time), month(last_bar_time), dayofmonth(last_bar_time), 0, 0)
array.set(pStop, ticker_index, PeriodS2)
array.set(time_value, ticker_index, str.tostring(dayofmonth(PeriodS1), "00") + '.' + str.tostring(month(PeriodS1), "00") + '.' + str.tostring(year(PeriodS1)) + ' - ' +
str.tostring(dayofmonth(PeriodS2), "00") + '.' + str.tostring(month(PeriodS2), "00") + '.' + str.tostring(year(PeriodS2)))
if array.get(pStart, ticker_index)>0 and time >= array.get(pStart, ticker_index) and na(array.get(close_s, ticker_index))
array.set(close_s, ticker_index, close_g)
if array.get(pStop, ticker_index)>0 and time >= array.get(pStop, ticker_index) and na(array.get(close_e, ticker_index))
array.set(close_e, ticker_index, close_g)
if entry_long and array.get(long_index, ticker_index)==0
array.set(long_index, ticker_index, bar_index_o)
if not entry_long and array.get(long_index, ticker_index)>0
array.set(long_index, ticker_index, 0)
if entry_short and array.get(short_index, ticker_index)==0
array.set(short_index, ticker_index, bar_index_o)
if not entry_short and array.get(short_index, ticker_index)>0
array.set(short_index, ticker_index, 0)
bar_since_long = ta.barssince(entry_long) + 1
bar_since_short = ta.barssince(entry_short) + 1
if barstate.islast
if array.get(long_index, ticker_index)==0
array.set(long_index, ticker_index, bar_since_long)
if array.get(short_index, ticker_index)==0
array.set(short_index, ticker_index, bar_since_short)
get_date(time_val) =>
str.tostring(dayofmonth(time_val), "00") + '.' + str.tostring(month(time_val), "00") + '.' + str.tostring(year(time_val))
[open_g1, close_g1, high_g1, low_g1, volume_g1, bar_index_g1, last_bar_index_g1] = request.security(ticker1, timeframe.period, get_vals())
[open_g2, close_g2, high_g2, low_g2, volume_g2, bar_index_g2, last_bar_index_g2] = request.security(ticker2, timeframe.period, get_vals())
[open_g3, close_g3, high_g3, low_g3, volume_g3, bar_index_g3, last_bar_index_g3] = request.security(ticker3, timeframe.period, get_vals())
[open_g4, close_g4, high_g4, low_g4, volume_g4, bar_index_g4, last_bar_index_g4] = request.security(ticker4, timeframe.period, get_vals())
[open_g5, close_g5, high_g5, low_g5, volume_g5, bar_index_g5, last_bar_index_g5] = request.security(ticker5, timeframe.period, get_vals())
[open_g6, close_g6, high_g6, low_g6, volume_g6, bar_index_g6, last_bar_index_g6] = request.security(ticker6, timeframe.period, get_vals())
[open_g7, close_g7, high_g7, low_g7, volume_g7, bar_index_g7, last_bar_index_g7] = request.security(ticker7, timeframe.period, get_vals())
[open_g8, close_g8, high_g8, low_g8, volume_g8, bar_index_g8, last_bar_index_g8] = request.security(ticker8, timeframe.period, get_vals())
[open_g9, close_g9, high_g9, low_g9, volume_g9, bar_index_g9, last_bar_index_g9] = request.security(ticker9, timeframe.period, get_vals())
[open_g10, close_g10, high_g10, low_g10, volume_g10, bar_index_g10, last_bar_index_g10] = request.security(ticker10, timeframe.period, get_vals())
[open_g11, close_g11, high_g11, low_g11, volume_g11, bar_index_g11, last_bar_index_g11] = request.security(ticker11, timeframe.period, get_vals())
[open_g12, close_g12, high_g12, low_g12, volume_g12, bar_index_g12, last_bar_index_g12] = request.security(ticker12, timeframe.period, get_vals())
[open_g13, close_g13, high_g13, low_g13, volume_g13, bar_index_g13, last_bar_index_g13] = request.security(ticker13, timeframe.period, get_vals())
[open_g14, close_g14, high_g14, low_g14, volume_g14, bar_index_g14, last_bar_index_g14] = request.security(ticker14, timeframe.period, get_vals())
[open_g15, close_g15, high_g15, low_g15, volume_g15, bar_index_g15, last_bar_index_g15] = request.security(ticker15, timeframe.period, get_vals())
[open_g16, close_g16, high_g16, low_g16, volume_g16, bar_index_g16, last_bar_index_g16] = request.security(ticker16, timeframe.period, get_vals())
[open_g17, close_g17, high_g17, low_g17, volume_g17, bar_index_g17, last_bar_index_g17] = request.security(ticker17, timeframe.period, get_vals())
[open_g18, close_g18, high_g18, low_g18, volume_g18, bar_index_g18, last_bar_index_g18] = request.security(ticker18, timeframe.period, get_vals())
[open_g19, close_g19, high_g19, low_g19, volume_g19, bar_index_g19, last_bar_index_g19] = request.security(ticker19, timeframe.period, get_vals())
[open_g20, close_g20, high_g20, low_g20, volume_g20, bar_index_g20, last_bar_index_g20] = request.security(ticker20, timeframe.period, get_vals())
[open_g21, close_g21, high_g21, low_g21, volume_g21, bar_index_g21, last_bar_index_g21] = request.security(ticker21, timeframe.period, get_vals())
[open_g22, close_g22, high_g22, low_g22, volume_g22, bar_index_g22, last_bar_index_g22] = request.security(ticker22, timeframe.period, get_vals())
[open_g23, close_g23, high_g23, low_g23, volume_g23, bar_index_g23, last_bar_index_g23] = request.security(ticker23, timeframe.period, get_vals())
[open_g24, close_g24, high_g24, low_g24, volume_g24, bar_index_g24, last_bar_index_g24] = request.security(ticker24, timeframe.period, get_vals())
calcs(0, open_g1, close_g1, high_g1, low_g1, volume_g1, bar_index_g1, last_bar_index_g1)
calcs(1, open_g2, close_g2, high_g2, low_g2, volume_g2, bar_index_g2, last_bar_index_g2)
calcs(2, open_g3, close_g3, high_g3, low_g3, volume_g3, bar_index_g3, last_bar_index_g3)
calcs(3, open_g4, close_g4, high_g4, low_g4, volume_g4, bar_index_g4, last_bar_index_g4)
calcs(4, open_g5, close_g5, high_g5, low_g5, volume_g5, bar_index_g5, last_bar_index_g5)
calcs(5, open_g6, close_g6, high_g6, low_g6, volume_g6, bar_index_g6, last_bar_index_g6)
calcs(6, open_g7, close_g7, high_g7, low_g7, volume_g7, bar_index_g7, last_bar_index_g7)
calcs(7, open_g8, close_g8, high_g8, low_g8, volume_g8, bar_index_g8, last_bar_index_g8)
calcs(8, open_g9, close_g9, high_g9, low_g9, volume_g9, bar_index_g9, last_bar_index_g9)
calcs(9, open_g10, close_g10, high_g10, low_g10, volume_g10, bar_index_g10, last_bar_index_g10)
calcs(10, open_g11, close_g11, high_g11, low_g11, volume_g11, bar_index_g11, last_bar_index_g11)
calcs(11, open_g12, close_g12, high_g12, low_g12, volume_g12, bar_index_g12, last_bar_index_g12)
calcs(12, open_g13, close_g13, high_g13, low_g13, volume_g13, bar_index_g13, last_bar_index_g13)
calcs(13, open_g14, close_g14, high_g14, low_g14, volume_g14, bar_index_g14, last_bar_index_g14)
calcs(14, open_g15, close_g15, high_g15, low_g15, volume_g15, bar_index_g15, last_bar_index_g15)
calcs(15, open_g16, close_g16, high_g16, low_g16, volume_g16, bar_index_g16, last_bar_index_g16)
calcs(16, open_g17, close_g17, high_g17, low_g17, volume_g17, bar_index_g17, last_bar_index_g17)
calcs(17, open_g18, close_g18, high_g18, low_g18, volume_g18, bar_index_g18, last_bar_index_g18)
calcs(18, open_g19, close_g19, high_g19, low_g19, volume_g19, bar_index_g19, last_bar_index_g19)
calcs(19, open_g20, close_g20, high_g20, low_g20, volume_g20, bar_index_g20, last_bar_index_g20)
calcs(20, open_g21, close_g21, high_g21, low_g21, volume_g21, bar_index_g21, last_bar_index_g21)
calcs(21, open_g22, close_g22, high_g22, low_g22, volume_g22, bar_index_g22, last_bar_index_g22)
calcs(22, open_g23, close_g23, high_g23, low_g23, volume_g23, bar_index_g23, last_bar_index_g23)
calcs(23, open_g24, close_g24, high_g24, low_g24, volume_g24, bar_index_g24, last_bar_index_g24)
set_table_cell(table_name, col_index, row_index) =>
array_index = row_index-2
symbol_val = array.get(symbol_cond, array_index)
index_long = array.get(long_index, array_index)
index_short = array.get(short_index, array_index)
index_val = symbol_val==1 and index_long>=0 ? index_long : (symbol_val==-1 and index_short>=0 ? index_short : math.min(index_long, index_short))
symbol_char = symbol_val==1 ? '▲' : (symbol_val==-1 ? '▼' : '■')
text_color = symbol_val==1 ? color.green : (symbol_val==-1 ? color.red : color.gray)
table.cell(table_name, col_index, row_index, text=symbol_char, text_halign=text.align_center, text_color=text_color, tooltip=str.tostring(index_val) + ' - ' + get_date(time[index_val]))
if barstate.islast
int col_value = 0
var table m_table = table.new((table_pos=='Left') ? position.middle_left : (table_pos=='Center') ? position.middle_center : position.middle_right, columns=2, rows=26, bgcolor=color.new(#E0E0E0, 0), border_width=1, border_color=color.white)
table.merge_cells(m_table, 0, 0, 1, 0)
ind_inputs = 'Niteya MA Screener'
table.cell(m_table, 0, 0, text=ind_inputs, text_color=color.white, bgcolor=color.rgb(48, 29, 0))
table.cell(m_table, 0, 1, 'Sembol', text_color=color.white, bgcolor=color.new(#426bb7, 0), tooltip="Sembol kodu")
table.cell(m_table, 1, 1, 'Durum', text_color=color.white, bgcolor=color.new(#277029, 0), tooltip="Sembol durumu")
table.cell(m_table, col_value, 2, str.substring(ticker1, str.pos(ticker1, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 0) + ' (' + str.tostring(array.get(close_s, 0), '0.00') + ' - ' + str.tostring(close_g1, '0.00') + ')')
table.cell(m_table, col_value, 3, str.substring(ticker2, str.pos(ticker2, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 1) + ' (' + str.tostring(array.get(close_s, 1), '0.00') + ' - ' + str.tostring(close_g2, '0.00') + ')')
table.cell(m_table, col_value, 4, str.substring(ticker3, str.pos(ticker3, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 2) + ' (' + str.tostring(array.get(close_s, 2), '0.00') + ' - ' + str.tostring(close_g3, '0.00') + ')')
table.cell(m_table, col_value, 5, str.substring(ticker4, str.pos(ticker4, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 3) + ' (' + str.tostring(array.get(close_s, 3), '0.00') + ' - ' + str.tostring(close_g4, '0.00') + ')')
table.cell(m_table, col_value, 6, str.substring(ticker5, str.pos(ticker5, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 4) + ' (' + str.tostring(array.get(close_s, 4), '0.00') + ' - ' + str.tostring(close_g5, '0.00') + ')')
table.cell(m_table, col_value, 7, str.substring(ticker6, str.pos(ticker6, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 5) + ' (' + str.tostring(array.get(close_s, 5), '0.00') + ' - ' + str.tostring(close_g6, '0.00') + ')')
table.cell(m_table, col_value, 8, str.substring(ticker7, str.pos(ticker7, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 6) + ' (' + str.tostring(array.get(close_s, 6), '0.00') + ' - ' + str.tostring(close_g7, '0.00') + ')')
table.cell(m_table, col_value, 9, str.substring(ticker8, str.pos(ticker8, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 7) + ' (' + str.tostring(array.get(close_s, 7), '0.00') + ' - ' + str.tostring(close_g8, '0.00') + ')')
table.cell(m_table, col_value, 10, str.substring(ticker9, str.pos(ticker9, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 8) + ' (' + str.tostring(array.get(close_s, 8), '0.00') + ' - ' + str.tostring(close_g9, '0.00') + ')')
table.cell(m_table, col_value, 11, str.substring(ticker10, str.pos(ticker10, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 9) + ' (' + str.tostring(array.get(close_s, 9), '0.00') + ' - ' + str.tostring(close_g10, '0.00') + ')')
table.cell(m_table, col_value, 12, str.substring(ticker11, str.pos(ticker11, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 10) + ' (' + str.tostring(array.get(close_s, 10), '0.00') + ' - ' + str.tostring(close_g11, '0.00') + ')')
table.cell(m_table, col_value, 13, str.substring(ticker12, str.pos(ticker12, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 11) + ' (' + str.tostring(array.get(close_s, 11), '0.00') + ' - ' + str.tostring(close_g12, '0.00') + ')')
table.cell(m_table, col_value, 14, str.substring(ticker13, str.pos(ticker13, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 12) + ' (' + str.tostring(array.get(close_s, 12), '0.00') + ' - ' + str.tostring(close_g13, '0.00') + ')')
table.cell(m_table, col_value, 15, str.substring(ticker14, str.pos(ticker14, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 13) + ' (' + str.tostring(array.get(close_s, 13), '0.00') + ' - ' + str.tostring(close_g14, '0.00') + ')')
table.cell(m_table, col_value, 16, str.substring(ticker15, str.pos(ticker15, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 14) + ' (' + str.tostring(array.get(close_s, 14), '0.00') + ' - ' + str.tostring(close_g15, '0.00') + ')')
table.cell(m_table, col_value, 17, str.substring(ticker16, str.pos(ticker16, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 15) + ' (' + str.tostring(array.get(close_s, 15), '0.00') + ' - ' + str.tostring(close_g16, '0.00') + ')')
table.cell(m_table, col_value, 18, str.substring(ticker17, str.pos(ticker17, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 16) + ' (' + str.tostring(array.get(close_s, 16), '0.00') + ' - ' + str.tostring(close_g17, '0.00') + ')')
table.cell(m_table, col_value, 19, str.substring(ticker18, str.pos(ticker18, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 17) + ' (' + str.tostring(array.get(close_s, 17), '0.00') + ' - ' + str.tostring(close_g18, '0.00') + ')')
table.cell(m_table, col_value, 20, str.substring(ticker19, str.pos(ticker19, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 18) + ' (' + str.tostring(array.get(close_s, 18), '0.00') + ' - ' + str.tostring(close_g19, '0.00') + ')')
table.cell(m_table, col_value, 21, str.substring(ticker20, str.pos(ticker20, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 19) + ' (' + str.tostring(array.get(close_s, 19), '0.00') + ' - ' + str.tostring(close_g20, '0.00') + ')')
table.cell(m_table, col_value, 22, str.substring(ticker21, str.pos(ticker21, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 20) + ' (' + str.tostring(array.get(close_s, 20), '0.00') + ' - ' + str.tostring(close_g21, '0.00') + ')')
table.cell(m_table, col_value, 23, str.substring(ticker22, str.pos(ticker22, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 21) + ' (' + str.tostring(array.get(close_s, 21), '0.00') + ' - ' + str.tostring(close_g22, '0.00') + ')')
table.cell(m_table, col_value, 24, str.substring(ticker23, str.pos(ticker23, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 22) + ' (' + str.tostring(array.get(close_s, 22), '0.00') + ' - ' + str.tostring(close_g23, '0.00') + ')')
table.cell(m_table, col_value, 25, str.substring(ticker24, str.pos(ticker24, ":")+1), text_halign=text.align_left, tooltip=array.get(time_value, 23) + ' (' + str.tostring(array.get(close_s, 23), '0.00') + ' - ' + str.tostring(close_g24, '0.00') + ')')
col_value := 1
set_table_cell(m_table, col_value, 2)
set_table_cell(m_table, col_value, 3)
set_table_cell(m_table, col_value, 4)
set_table_cell(m_table, col_value, 5)
set_table_cell(m_table, col_value, 6)
set_table_cell(m_table, col_value, 7)
set_table_cell(m_table, col_value, 8)
set_table_cell(m_table, col_value, 9)
set_table_cell(m_table, col_value, 10)
set_table_cell(m_table, col_value, 11)
set_table_cell(m_table, col_value, 12)
set_table_cell(m_table, col_value, 13)
set_table_cell(m_table, col_value, 14)
set_table_cell(m_table, col_value, 15)
set_table_cell(m_table, col_value, 16)
set_table_cell(m_table, col_value, 17)
set_table_cell(m_table, col_value, 18)
set_table_cell(m_table, col_value, 19)
set_table_cell(m_table, col_value, 20)
set_table_cell(m_table, col_value, 21)
set_table_cell(m_table, col_value, 22)
set_table_cell(m_table, col_value, 23)
set_table_cell(m_table, col_value, 24)
set_table_cell(m_table, col_value, 25)
Yukarıdaki screener ile ilgili bir uygulama aşağıda grafiklerde gösterilmektedir: