Untitled

 avatar
unknown
plain_text
a month ago
9.7 kB
5
Indexable
// Kullanıcıdan tutar girdisi al
quantity = input.float(title="Yatırılacak Tutar (TL)", defval=10000, minval=1)

// Portföy alım-satım koşulu (örneğin, bir sinyal veya strateji koşulu)
portfoyBuysell = ta.crossover(mainForce, lifeLine)  // Örnek bir koşul

// Alım miktarını hesapla
var float defaultEntryQty = na
if quantity > 0 and portfoyBuysell and quantity > close
    defaultEntryQty := math.floor(quantity / close)

ADET = str.tostring(defaultEntryQty)
APIKEY = input.string(title="API Anahtarı", defval="", tooltip="Osmanlı Yatırım API anahtarınızı girin")

al =  kosul yaz
sat = kosul yaz
Sinyal = al ? close : sat ? -1 * close : 0

// Sembol listesi
sembol1 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S1")
sembol2 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S2")
sembol3 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S3")
sembol4 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S4")
sembol5 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S5")
sembol6 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S6")
sembol7 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S7")
sembol8 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S8")
sembol9 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S9")
sembol10 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S10")
sembol11 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S11")
sembol12 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S12")
sembol13 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S13")
sembol14 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S14")
sembol15 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S15")
sembol16 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S16")
sembol17 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S17")
sembol18 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S18")
sembol19 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S19")
sembol20 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S20")
sembol21 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S21")
sembol22 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S22")
sembol23 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S23")
sembol24 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S24")
sembol25 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S25")
sembol26 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S26")
sembol27 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S27")
sembol28 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S28")
sembol29 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S29")
sembol30 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S30")
sembol31 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S31")
sembol32 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S32")
sembol33 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S33")
sembol34 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S34")
sembol35 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S35")
sembol36 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S36")
sembol37 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S37")
sembol38 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S38")
sembol39 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S39")
sembol40 = input.symbol(defval = "", title = "Symbol", group = "SCANNER",inline = "S40")

// Her sembol için fiyat bilgisini önceden hesapla
symbolPrice1 = request.security(sembol1, timeframe.period, close)
symbolPrice2 = request.security(sembol2, timeframe.period, close)
symbolPrice3 = request.security(sembol3, timeframe.period, close)
symbolPrice4 = request.security(sembol4, timeframe.period, close)
symbolPrice5 = request.security(sembol5, timeframe.period, close)
symbolPrice6 = request.security(sembol6, timeframe.period, close)
symbolPrice7 = request.security(sembol7, timeframe.period, close)
symbolPrice8 = request.security(sembol8, timeframe.period, close)
symbolPrice9 = request.security(sembol9, timeframe.period, close)
symbolPrice10 = request.security(sembol10, timeframe.period, close)
symbolPrice11 = request.security(sembol11, timeframe.period, close)
symbolPrice12 = request.security(sembol12, timeframe.period, close)
symbolPrice13 = request.security(sembol13, timeframe.period, close)
symbolPrice14 = request.security(sembol14, timeframe.period, close)
symbolPrice15 = request.security(sembol15, timeframe.period, close)
symbolPrice16 = request.security(sembol16, timeframe.period, close)
symbolPrice17 = request.security(sembol17, timeframe.period, close)
symbolPrice18 = request.security(sembol18, timeframe.period, close)
symbolPrice19 = request.security(sembol19, timeframe.period, close)
symbolPrice20 = request.security(sembol20, timeframe.period, close)
symbolPrice21 = request.security(sembol21, timeframe.period, close)
symbolPrice22 = request.security(sembol22, timeframe.period, close)
symbolPrice23 = request.security(sembol23, timeframe.period, close)
symbolPrice24 = request.security(sembol24, timeframe.period, close)
symbolPrice25 = request.security(sembol25, timeframe.period, close)
symbolPrice26 = request.security(sembol26, timeframe.period, close)
symbolPrice27 = request.security(sembol27, timeframe.period, close)
symbolPrice28 = request.security(sembol28, timeframe.period, close)
symbolPrice29 = request.security(sembol29, timeframe.period, close)
symbolPrice30 = request.security(sembol30, timeframe.period, close)
symbolPrice31 = request.security(sembol31, timeframe.period, close)
symbolPrice32 = request.security(sembol32, timeframe.period, close)
symbolPrice33 = request.security(sembol33, timeframe.period, close)
symbolPrice34 = request.security(sembol34, timeframe.period, close)
symbolPrice35 = request.security(sembol35, timeframe.period, close)
symbolPrice36 = request.security(sembol36, timeframe.period, close)


// Sinyali tetikleyen fonksiyon
alarmTetikle(sembol, sinyal, symbolPrice) =>
    durum = request.security(sembol, timeframe.period, sinyal)
    mesaj = durum > 0 ? "buy" : durum < 0 ? "sell" : ""  // Alım veya satım durumu
    if durum != 0 and str.length(sembol) > 1
        // Alım miktarını hesapla
        entryQty = math.floor(quantity / symbolPrice)
        // Osmanlı Yatırım için JSON formatında emir mesajı oluştur
        alarmMesajiJSON = '{"name": "osmanlı yatırım sinyali",' +
                          '"symbol": "' + syminfo.ticker(sembol) + '",' +
                          '"orderSide": "' + mesaj + '",' +
                          '"orderType": "mkt",' +
                          '"price": "0",' +
                          '"quantity": "' + str.tostring(entryQty) + '",' +
                          '"timeInForce": "ioc",' +
                          '"apiKey": "' + APIKEY + '",' +
                          '"goodInOffHours": "0"}'
        
        // Osmanlı Yatırım sistemine emir gönderme
        alert(message = alarmMesajiJSON, freq = alert.freq_once_per_bar_close)

// Her sembol için alarmTetikle fonksiyonunu çağır
alarmTetikle(sembol1, Sinyal, symbolPrice1)
alarmTetikle(sembol2, Sinyal, symbolPrice2)
alarmTetikle(sembol3, Sinyal, symbolPrice3)
alarmTetikle(sembol4, Sinyal, symbolPrice4)
alarmTetikle(sembol5, Sinyal, symbolPrice5)
alarmTetikle(sembol6, Sinyal, symbolPrice6)
alarmTetikle(sembol7, Sinyal, symbolPrice7)
alarmTetikle(sembol8, Sinyal, symbolPrice8)
alarmTetikle(sembol9, Sinyal, symbolPrice9)
alarmTetikle(sembol10, Sinyal, symbolPrice10)
alarmTetikle(sembol11, Sinyal, symbolPrice11)
alarmTetikle(sembol12, Sinyal, symbolPrice12)
alarmTetikle(sembol13, Sinyal, symbolPrice13)
alarmTetikle(sembol14, Sinyal, symbolPrice14)
alarmTetikle(sembol15, Sinyal, symbolPrice15)
alarmTetikle(sembol16, Sinyal, symbolPrice16)
alarmTetikle(sembol17, Sinyal, symbolPrice17)
alarmTetikle(sembol18, Sinyal, symbolPrice18)
alarmTetikle(sembol19, Sinyal, symbolPrice19)
alarmTetikle(sembol20, Sinyal, symbolPrice20)
alarmTetikle(sembol21, Sinyal, symbolPrice21)
alarmTetikle(sembol22, Sinyal, symbolPrice22)
alarmTetikle(sembol23, Sinyal, symbolPrice23)
alarmTetikle(sembol24, Sinyal, symbolPrice24)
alarmTetikle(sembol25, Sinyal, symbolPrice25)
alarmTetikle(sembol26, Sinyal, symbolPrice26)
alarmTetikle(sembol27, Sinyal, symbolPrice27)
alarmTetikle(sembol28, Sinyal, symbolPrice28)
alarmTetikle(sembol29, Sinyal, symbolPrice29)
alarmTetikle(sembol30, Sinyal, symbolPrice30)
alarmTetikle(sembol31, Sinyal, symbolPrice31)
alarmTetikle(sembol32, Sinyal, symbolPrice32)
alarmTetikle(sembol33, Sinyal, symbolPrice33)
alarmTetikle(sembol34, Sinyal, symbolPrice34)
alarmTetikle(sembol35, Sinyal, symbolPrice35)
alarmTetikle(sembol36, Sinyal, symbolPrice36)
Leave a Comment