Untitled

 avatar
unknown
plain_text
16 days ago
39 kB
6
Indexable
//@version=5
indicator("UMUT - ATH VAH POC VAL OTE Scanner V9", overlay=true, max_boxes_count=500, max_lines_count=500)

// --- INPUTS ---
rsiLength = input.int(14, title="RSI Periyodu")
rsiSource = input.source(close, title="RSI Kaynağı")
vpLookback = input.int(200, title="Hacim Profilini Hesapla (Son X Bar)", minval=10)
showOTE = input.bool(true, title="OTE Fibonacci Kutusunu Göster")

// --- GLOBAL SERİ HESAPLAMALARI ---
vpMaxPrice = ta.highest(high, vpLookback)
vpMinPrice = ta.lowest(low, vpLookback)
swingHigh = ta.highest(high, 50)
swingLow = ta.lowest(low, 50)

// --- 1. ATH (ALL-TIME HIGH) HESAPLAMA ---
var float ath = na
if barstate.isfirst
    ath := high
    else if high > ath
        ath := high

        plot(ath, title="ATH (All-Time High)", color=color.new(color.red, 0), linewidth=2, style=plot.style_stepline)

        // --- 2. HACİM PROFİLİ (VAH, POC, VAL) HESAPLAMA ---
        var float vah = na
        var float poc = na
        var float val = na

        if bar_index > vpLookback
            float priceStep = (vpMaxPrice - vpMinPrice) / 30 

                if priceStep > 0
                        float totalVol = 0.0
                                float[] profileVols = array.new_float(30, 0.0)

                                        for bar = 0 to vpLookback - 1
                                                    float barClose = close[bar]
                                                                float barVol = volume[bar]
                                                                            totalVol := totalVol + barVol
                                                                                        
                                                                                                    for bin = 0 to 29
                                                                                                                    float binMin = vpMinPrice + (bin * priceStep)
                                                                                                                                    float binMax = binMin + priceStep
                                                                                                                                                    if barClose >= binMin and barClose <= binMax
                                                                                                                                                                        array.set(profileVols, bin, array.get(profileVols, bin) + barVol)

                                                                                                                                                                                int pocBin = 0
                                                                                                                                                                                        float maxBinVol = 0.0
                                                                                                                                                                                                for bin = 0 to 29
                                                                                                                                                                                                            if array.get(profileVols, bin) > maxBinVol
                                                                                                                                                                                                                            maxBinVol := array.get(profileVols, bin)
                                                                                                                                                                                                                                            pocBin := bin

                                                                                                                                                                                                                                                    poc := vpMinPrice + (pocBin * priceStep) + (priceStep / 2)

                                                                                                                                                                                                                                                            float targetVol = totalVol * 0.70
                                                                                                                                                                                                                                                                    float currentVol = array.get(profileVols, pocBin)
                                                                                                                                                                                                                                                                            int topBin = pocBin
                                                                                                                                                                                                                                                                                    int botBin = pocBin

                                                                                                                                                                                                                                                                                            for i = 0 to 30
                                                                                                                                                                                                                                                                                                        if currentVol >= targetVol
                                                                                                                                                                                                                                                                                                                        break
                                                                                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                                                                                                float topVol = topBin < 29 ? array.get(profileVols, topBin + 1) : 0.0
                                                                                                                                                                                                                                                                                                                                                            float botVol = botBin > 0 ? array.get(profileVols, botBin - 1) : 0.0

                                                                                                                                                                                                                                                                                                                                                                        if topVol >= botVol and topBin < 29
                                                                                                                                                                                                                                                                                                                                                                                        topBin := topBin + 1
                                                                                                                                                                                                                                                                                                                                                                                                        currentVol := currentVol + topVol
                                                                                                                                                                                                                                                                                                                                                                                                                    else if botBin > 0
                                                                                                                                                                                                                                                                                                                                                                                                                                    botBin := botBin - 1
                                                                                                                                                                                                                                                                                                                                                                                                                                                    currentVol := currentVol + botVol

                                                                                                                                                                                                                                                                                                                                                                                                                                                            vah := vpMinPrice + (topBin * priceStep)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    val := vpMinPrice + (botBin * priceStep)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    // Çizgilerin Grafiğe Basılması
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    plot(vah, title="VAH (Value Area High)", color=color.new(color.orange, 0), linewidth=2, style=plot.style_stepline)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    plot(poc, title="POC (Point of Control)", color=color.new(color.purple, 0), linewidth=3, style=plot.style_stepline)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    plot(val, title="VAL (Value Area Low)", color=color.new(color.blue, 0), linewidth=2, style=plot.style_stepline)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    // --- 3. RSI HESAPLAMA ---
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    rsiVal = ta.rsi(rsiSource, rsiLength)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    bool rsiTrigger = rsiVal >= 70

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    // --- 4. OTOMATİK FIBONACCI OTE KUTUSU ---
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    float fibDiff = swingHigh - swingLow
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    float fib618 = swingHigh - (fibDiff * 0.618)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    float fib786 = swingHigh - (fibDiff * 0.786)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    var box oteBox = na
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    if showOTE and not na(fib618) and not na(fib786)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        box.delete(oteBox)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            oteBox := box.new(left=bar_index - 30, top=fib618, right=bar_index + 5, bottom=fib786, 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         bgcolor=color.new(color.green, 85), border_color=color.new(color.green, 30),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      border_style=line.style_dotted)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      // --- 5. MUM FORMASYONLARI KONTROLÜ ---
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      isGreen = close > open
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      isRed = open > close
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      bodySize = math.abs(close - open)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      totalSize = high - low
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      upperShadow = high - math.max(open, close)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      lowerShadow = math.min(open, close) - low

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      isInOTE = (close >= fib786 and close <= fib618) or (low >= fib786 and low <= fib618)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      bool isEngulfing = isRed[1] and isGreen and close > open[1] and open <= close[1]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      bool isPinbar = lowerShadow > (bodySize * 2) and upperShadow < (totalSize * 0.2)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      bool oteSignal = isInOTE and (isEngulfing or isPinbar)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      // --- 6. EKRAN ANALİZ PANELİ (TABLO) ---
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      var table infoTable = table.new(position.top_right, 2, 6, bgcolor=color.new(color.black, 20), border_width=1, border_color=color.gray)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      if barstate.islast
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          table.cell(infoTable, 0, 0, "GÖSTERGE", text_color=color.white, bgcolor=color.gray)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              table.cell(infoTable, 1, 0, "DURUM / SEVİYE", text_color=color.white, bgcolor=color.gray)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      table.cell(infoTable, 0, 1, "RSI (14)", text_color=color.white)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          table.cell(infoTable, 1, 1, str.tostring(rsiVal, "#.##"), bgcolor=rsiTrigger ? color.red : color.green, text_color=color.white)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  table.cell(infoTable, 0, 2, "ATH Seviyesi", text_color=color.white)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      table.cell(infoTable, 1, 2, str.tostring(ath, "#.##"), text_color=color.red)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              table.cell(infoTable, 0, 3, "VAH Seviyesi", text_color=color.white)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  table.cell(infoTable, 1, 3, str.tostring(vah, "#.##"), text_color=color.orange)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      table.cell(infoTable, 0, 4, "POC Seviyesi", text_color=color.white)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          table.cell(infoTable, 1, 4, str.tostring(poc, "#.##"), text_color=color.purple)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              table.cell(infoTable, 0, 5, "VAL Seviyesi", text_color=color.white)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  table.cell(infoTable, 1, 5, str.tostring(val, "#.##"), text_color=color.blue)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // --- SİNYAL GÖRSELLEŞTİRME ---
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  bool breakoutSignal = (ta.crossover(close, vah) or ta.crossover(close, ath)) and rsiTrigger
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  plotchar(breakoutSignal, title="Breakout Sinyali", char="▲", location=location.belowbar, color=color.green, size=size.small)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  plotchar(oteSignal, title="OTE Giriş Tetikleyicisi", char="✓", location=location.belowbar, color=color.new(#50C878, 0), size=size.normal)
Editor is loading...
Leave a Comment