EMA7>EMA200 (Son 3 Bar) | gunebakan

gunebakan avatar
gunebakan
Plain Text
09/09/2025 6:26 PM
10.4 KB
56
Indexable
Never
//@version=5
indicator("EMA7>EMA200 (Son 3 Bar) | gunebakan", overlay = true, max_lines_count = 500, max_labels_count = 500, dynamic_requests = true)

// ----- GİRDİLER -----
len_fast = input.int(7, title="Hızlı EMA Periyodu")
len_slow = input.int(200, title="Yavaş EMA Periyodu")
bars_to_check = input.int(3, title="Kontrol Edilecek Bar Sayısı", minval=1)
table_text_size = input.string("small", title="Tablo Boyutu", options=["auto", "huge", "large", "normal", "small", "tiny"])

// Koin girdi alanları
symbol01 = input.string("BINANCE:BTCUSDT", title="Koin 1")
symbol02 = input.string("BINANCE:ETHUSDT", title="Koin 2")
symbol03 = input.string("BINANCE:XRPUSDT", title="Koin 3")
symbol04 = input.string("BINANCE:BNBUSDT", title="Koin 4")
symbol05 = input.string("BINANCE:SOLUSDT", title="Koin 5")
symbol06 = input.string("BINANCE:DOGEUSDT", title="Koin 6")
symbol07 = input.string("BINANCE:TRXUSDT", title="Koin 7")
symbol08 = input.string("BINANCE:ADAUSDT", title="Koin 8")
symbol09 = input.string("KUCOIN:HYPEUSDT", title="Koin 9")
symbol10 = input.string("BINANCE:LINKUSDT", title="Koin 10")
symbol11 = input.string("BYBIT:USDEUSDT", title="Koin 11")
symbol12 = input.string("BINANCE:SUIUSDT", title="Koin 12")
symbol13 = input.string("BINANCE:XLMUSDT", title="Koin 13")
symbol14 = input.string("BINANCE:BCHUSDT", title="Koin 14")
symbol15 = input.string("BINANCE:AVAXUSDT", title="Koin 15")
symbol16 = input.string("BINANCE:HBARUSDT", title="Koin 16")
symbol17 = input.string("BINANCE:DOTUSDT", title="Koin 17")
symbol18 = input.string("BINANCE:LTCUSDT", title="Koin 18")
symbol19 = input.string("COINBASE:CROUSDT", title="Koin 19")
symbol20 = input.string("BINANCE:ATOMUSDT", title="Koin 20")
symbol21 = input.string("BINANCE:ALGOUSDT", title="Koin 21")
symbol22 = input.string("GATEIO:KASUSDT", title="Koin 22")
symbol23 = input.string("BINANCE:RENDERUSDT", title="Koin 23")
symbol24 = input.string("BINANCE:VETUSDT", title="Koin 24")
symbol25 = input.string("KUCOIN:KCSUSDT", title="Koin 25")
symbol26 = input.string("BINANCE:SEIUSDT", title="Koin 26")
symbol27 = input.string("", title="Koin 27")
symbol28 = input.string("BINANCE:ICPUSDT", title="Koin 28")
symbol29 = input.string("BINANCE:NEARUSDT", title="Koin 29")
symbol30 = input.string("BINANCE:APTUSDT", title="Koin 30")
symbol31 = input.string("BINANCE:UNIUSDT", title="Koin 31")
symbol32 = input.string("BINANCE:ARBUSDT", title="Koin 32")
symbol33 = input.string("BINANCE:OPUSDT", title="Koin 33")
symbol34 = input.string("BINANCE:FILUSDT", title="Koin 34")
symbol35 = input.string("BINANCE:INJUSDT", title="Koin 35")
symbol36 = input.string("BINANCE:AAVEUSDT", title="Koin 36")
symbol37 = input.string("BINANCE:XTZUSDT", title="Koin 37")
symbol38 = input.string("BINANCE:EGLDUSDT", title="Koin 38")
symbol39 = input.string("BINANCE:SANDUSDT", title="Koin 39")
symbol40 = input.string("BINANCE:MANAUSDT", title="Koin 40")

// ----- HESAPLAMA FONKSİYONU -----
f_checkCondition(symbol) =>
    if symbol == ""
        false
    else
        [ema_fast, ema_slow] = request.security(symbol, timeframe.period, [ta.ema(close, len_fast), ta.ema(close, len_slow)])
        
        condition_met = true
        for i = 0 to bars_to_check - 1
            if (ema_fast[i] <= ema_slow[i])
                condition_met := false
                break
        condition_met

// ----- SEMBOL LİSTESI -----
var string[] symbols = array.from(symbol01, symbol02, symbol03, symbol04, symbol05, symbol06, symbol07, symbol08, 
                                  symbol09, symbol10, symbol11, symbol12, symbol13, symbol14, symbol15, symbol16,
                                  symbol17, symbol18, symbol19, symbol20, symbol21, symbol22, symbol23, symbol24,
                                  symbol25, symbol26, symbol27, symbol28, symbol29, symbol30, symbol31, symbol32,
                                  symbol33, symbol34, symbol35, symbol36, symbol37, symbol38, symbol39, symbol40)

// ----- HESAPLAMA BÖLÜMÜ -----
c01 = f_checkCondition(symbol01)
c02 = f_checkCondition(symbol02)
c03 = f_checkCondition(symbol03)
c04 = f_checkCondition(symbol04)
c05 = f_checkCondition(symbol05)
c06 = f_checkCondition(symbol06)
c07 = f_checkCondition(symbol07)
c08 = f_checkCondition(symbol08)
c09 = f_checkCondition(symbol09)
c10 = f_checkCondition(symbol10)
c11 = f_checkCondition(symbol11)
c12 = f_checkCondition(symbol12)
c13 = f_checkCondition(symbol13)
c14 = f_checkCondition(symbol14)
c15 = f_checkCondition(symbol15)
c16 = f_checkCondition(symbol16)
c17 = f_checkCondition(symbol17)
c18 = f_checkCondition(symbol18)
c19 = f_checkCondition(symbol19)
c20 = f_checkCondition(symbol20)
c21 = f_checkCondition(symbol21)
c22 = f_checkCondition(symbol22)
c23 = f_checkCondition(symbol23)
c24 = f_checkCondition(symbol24)
c25 = f_checkCondition(symbol25)
c26 = f_checkCondition(symbol26)
c27 = f_checkCondition(symbol27)
c28 = f_checkCondition(symbol28)
c29 = f_checkCondition(symbol29)
c30 = f_checkCondition(symbol30)
c31 = f_checkCondition(symbol31)
c32 = f_checkCondition(symbol32)
c33 = f_checkCondition(symbol33)
c34 = f_checkCondition(symbol34)
c35 = f_checkCondition(symbol35)
c36 = f_checkCondition(symbol36)
c37 = f_checkCondition(symbol37)
c38 = f_checkCondition(symbol38)
c39 = f_checkCondition(symbol39)
c40 = f_checkCondition(symbol40)

// Tüm sonuçları dizide toplama
var bool[] results = array.new_bool(40)
array.set(results, 0, c01)
array.set(results, 1, c02)
array.set(results, 2, c03)
array.set(results, 3, c04)
array.set(results, 4, c05)
array.set(results, 5, c06)
array.set(results, 6, c07)
array.set(results, 7, c08)
array.set(results, 8, c09)
array.set(results, 9, c10)
array.set(results, 10, c11)
array.set(results, 11, c12)
array.set(results, 12, c13)
array.set(results, 13, c14)
array.set(results, 14, c15)
array.set(results, 15, c16)
array.set(results, 16, c17)
array.set(results, 17, c18)
array.set(results, 18, c19)
array.set(results, 19, c20)
array.set(results, 20, c21)
array.set(results, 21, c22)
array.set(results, 22, c23)
array.set(results, 23, c24)
array.set(results, 24, c25)
array.set(results, 25, c26)
array.set(results, 26, c27)
array.set(results, 27, c28)
array.set(results, 28, c29)
array.set(results, 29, c30)
array.set(results, 30, c31)
array.set(results, 31, c32)
array.set(results, 32, c33)
array.set(results, 33, c34)
array.set(results, 34, c35)
array.set(results, 35, c36)
array.set(results, 36, c37)
array.set(results, 37, c38)
array.set(results, 38, c39)
array.set(results, 39, c40)

// ----- YAN YANA TEK TABLO OLUŞTURMA -----
if (barstate.islast)
    // Aktif sembolleri filtrele
    active_symbols = array.new<string>()
    active_results = array.new<bool>()
    
    for i = 0 to array.size(symbols) - 1
        current_symbol = array.get(symbols, i)
        if current_symbol != ""
            array.push(active_symbols, current_symbol)
            array.push(active_results, array.get(results, i))
    
    total_active = array.size(active_symbols)
    max_rows = math.ceil(total_active / 2.0)
    
    // Tablo boyutunu belirle
    size_value = table_text_size == "auto" ? size.auto : 
                 table_text_size == "huge" ? size.huge :
                 table_text_size == "large" ? size.large :
                 table_text_size == "normal" ? size.normal :
                 table_text_size == "small" ? size.small : size.tiny
    
    if total_active > 0
        // 4 sütunlu tablo: Koin1 | Durum1 | Koin2 | Durum2
        var table mainTable = table.new(position.top_right, 4, max_rows + 1, border_width = 1)
        
        // Başlık satırı
        table.cell(mainTable, 0, 0, "COINBASE", bgcolor = color.new(color.blue, 50), text_color = color.white, text_size=size_value)
        table.cell(mainTable, 1, 0, "EMA7>200", bgcolor = color.new(color.blue, 50), text_color = color.white, text_size=size_value)
        table.cell(mainTable, 2, 0, "COIN", bgcolor = color.new(color.purple, 50), text_color = color.white, text_size=size_value)
        table.cell(mainTable, 3, 0, "EMA7>200", bgcolor = color.new(color.purple, 50), text_color = color.white, text_size=size_value)

        // Veriyi doldur
        for row = 0 to max_rows - 1
            // Sol grup (ilk 20)
            left_index = row
            if left_index < total_active
                current_symbol = array.get(active_symbols, left_index)
                isConditionMet = array.get(active_results, left_index)
                string status_text = isConditionMet ? "🟢" : "🔴"
                
                symbol_parts = str.split(current_symbol, ":")
                string symbol_name = array.size(symbol_parts) > 1 ? array.get(symbol_parts, 1) : current_symbol

                table.cell(mainTable, 0, row + 1, symbol_name, bgcolor = color.new(color.gray, 80), text_color = color.white, text_size=size_value)
                table.cell(mainTable, 1, row + 1, status_text, bgcolor = color.new(color.gray, 90), text_color = color.white, text_size=size_value)
            else
                table.cell(mainTable, 0, row + 1, "", bgcolor = color.new(color.gray, 95), text_color = color.white, text_size=size_value)
                table.cell(mainTable, 1, row + 1, "", bgcolor = color.new(color.gray, 95), text_color = color.white, text_size=size_value)
            
            // Sağ grup (ikinci 20)
            right_index = row + 20
            if right_index < total_active
                current_symbol = array.get(active_symbols, right_index)
                isConditionMet = array.get(active_results, right_index)
                string status_text = isConditionMet ? "🟢" : "🔴"
                
                symbol_parts = str.split(current_symbol, ":")
                string symbol_name = array.size(symbol_parts) > 1 ? array.get(symbol_parts, 1) : current_symbol

                table.cell(mainTable, 2, row + 1, symbol_name, bgcolor = color.new(color.gray, 80), text_color = color.white, text_size=size_value)
                table.cell(mainTable, 3, row + 1, status_text, bgcolor = color.new(color.gray, 90), text_color = color.white, text_size=size_value)
            else
                table.cell(mainTable, 2, row + 1, "", bgcolor = color.new(color.gray, 95), text_color = color.white, text_size=size_value)
                table.cell(mainTable, 3, row + 1, "", bgcolor = color.new(color.gray, 95), text_color = color.white, text_size=size_value)
Editor is loading...
Leave a Comment