Artan

110,10 9.99 09:55
36,58 9.98 11:06
28,72 9.95 11:06
28,94 9.95 11:06
10,74 9.93 11:06
Artan Hisseler

Azalan

477,00 -10 11:06
95,40 -10 09:55
31,90 -9.99 11:06
67,80 -9.96 11:06
11,04 -9.95 11:04
Azalan Hisseler

İşlem

7.657.975.023,16 11:06
5.832.448.011,25 11:06
3.573.813.835,20 11:06
3.273.181.299,88 11:06
2.973.613.930,25 11:06
Tüm Hisseler
Sayfa 358/359 İlkİlk ... 258308348356357358359 SonSon
Arama sonucu : 2868 madde; 2,857 - 2,864 arası.

Konu: Tradingview


  1. 16.07.2024 - 10.12.2024

  2. 16.07.2024 - 10.12.2024

  3. 16.07.2024 - 10.12.2024

  4. 16.07.2024 - 10.12.2024

  5. 16.07.2024 - 10.12.2024

  6. 16.07.2024 - 10.12.2024

  7. ortaya kombine kod derlemesi.....TW de yazarların kodlarının birleşmesinden tasarlanmıştır.

    örnek resim....https://www.tradingview.com/x/4MzNIVj3/
    çizgisiz hali......https://www.tradingview.com/x/A2KMEx7G/
    bölme etiketleri olmadan..... https://www.tradingview.com/x/psLRMOlz/
    kutular kaldırılmış... bölme etiketli... https://www.tradingview.com/x/kQ8tGayN/

    denemek isteyenler için...

    PHP Code:
    //@version=6
    indicator('.'overlay truemax_lines_count 500max_boxes_count 500)

    // --- 1. VISUAL SETTINGS ---
    i_boxColor input.color(color.new(#787b86, 92), 'Range Background', group = 'Visuals')
    i_gpBullishColor input.color(color.new(#4caf50, 60), 'Bullish GP Color', group = 'Visuals')
    i_gpBearishColor input.color(color.new(#f44336, 60), 'Bearish GP Color', group = 'Visuals')
    i_liqColor input.color(color.new(#ffeb3b, 85), 'Liquidity Zones Color', group = 'Visuals')
    i_lineColor input.color(color.white'Boundary Line Color'group 'Visuals')
    i_whiteText color.white

    // Range Settings
    i_autoFit input.bool(true'Auto-Fit Box to last high and low'group 'Range Settings')
    i_lookback input.int(100'Lookback Period'minval 2group 'Range Settings')
    i_offsetR input.int(10'Box Offset Right'minval 0group 'Range Settings')

    // FVG Settings
    i_showFVG input.bool(true'Show Fair Value Gaps (FVG)'group 'FVG Settings')
    i_fvgLen input.int(10'FVG Extension (Bars)'minval 1group 'FVG Settings')
    i_bullFVGColor input.color(color.new(#4caf4f, 100), 'Bullish FVG Color', group = 'FVG Settings')
    i_bearFVGColor input.color(color.new(#f44336, 100), 'Bearish FVG Color', group = 'FVG Settings')

    i_showLabels input.bool(true'Show Price Lines & Labels'group 'Visuals')

    // --- 2. CORE CALCULATIONS ---
    int hOff ta.highestbars(highi_lookback)
    int lOff ta.lowestbars(lowi_lookback)

    float rHigh high[-hOff]
    float rLow low[-lOff]
    float rDiff rHigh rLow

    // KORREKTUR: anchorBar nutzt nun die korrekten Identifier lOff und hOff
    int anchorBar i_autoFit bar_index math.min(hOfflOff) : bar_index i_lookback

    float bUp 
    rLow rDiff 0.382
    float bLo 
    rLow rDiff 0.35
    float sUp 
    rHigh rDiff 0.35
    float sLo 
    rHigh rDiff 0.382

    // --- 3. FVG LOGIC ---
    if i_showFVG
        
    if low high[2]
            
    box.new(bar_index[1], lowbar_index i_fvgLenhigh[2], bgcolor i_bullFVGColorborder_color na)
        if 
    high low[2]
            
    box.new(bar_index[1], highbar_index i_fvgLenlow[2], bgcolor i_bearFVGColorborder_color na)

    // --- 4. VISUALS (BOXES) ---
    var box b_Range box.new(nanananaxloc xloc.bar_indexbgcolor i_boxColorborder_color color.gray)
    var 
    box b_Bullish box.new(nanananaxloc xloc.bar_indexbgcolor i_gpBullishColorborder_color natext 'LONG GİR'text_color color.whitetext_size size.small)
    var 
    box b_Bearish box.new(nanananaxloc xloc.bar_indexbgcolor i_gpBearishColorborder_color natext 'SHORT GİR'text_color color.whitetext_size size.small)
    var 
    box b_LiqTop box.new(nanananaxloc xloc.bar_indexbgcolor i_liqColorborder_color natext ' LONG KAPAT SHORT GİR'text_color i_whiteTexttext_size size.small)
    var 
    box b_LiqBot box.new(nanananaxloc xloc.bar_indexbgcolor i_liqColorborder_color natext 'SHORT KAPAT LONG GİR'text_color i_whiteTexttext_size size.small)

    var array<
    linel_levels = array.new_line()
    var array<
    labellb_prices = array.new_label()

    if 
    barstate.isfirst
        
    for 0 to 7 by 1
            
    array.push(l_levelsline.new(nanananaxloc xloc.bar_indexcolor i_lineColor))
            array.
    push(lb_priceslabel.new(nana''xloc xloc.bar_indexcolor color.new(color.black100), textcolor i_lineColorsize size.normalstyle label.style_label_left))

    if 
    barstate.islast
        int rightBar 
    bar_index i_offsetR
        box
    .set_lefttop(b_RangeanchorBarrHigh)
        
    box.set_rightbottom(b_RangerightBarrLow)
        
    box.set_lefttop(b_BullishanchorBarbUp)
        
    box.set_rightbottom(b_BullishrightBarbLo)
        
    box.set_lefttop(b_BearishanchorBarsUp)
        
    box.set_rightbottom(b_BearishrightBarsLo)
        
    box.set_lefttop(b_LiqTopanchorBarrHigh)
        
    box.set_rightbottom(b_LiqToprightBarrHigh rDiff 0.05)
        
    box.set_lefttop(b_LiqBotanchorBarrLow rDiff 0.05)
        
    box.set_rightbottom(b_LiqBotrightBarrLow)

        if 
    i_showLabels
            
    array<floatp_vals = array.from(rHighrHigh rDiff 0.05sUpsLobUpbLorLow rDiff 0.05rLow)
            for 
    0 to 7 by 1
                float v 
    = array.get(p_valsi)
                
    line.set_xy1(array.get(l_levelsi), anchorBarv)
                
    line.set_xy2(array.get(l_levelsi), rightBarv)
                
    label.set_xy(array.get(lb_pricesi), rightBarv)
                
    label.set_text(array.get(lb_pricesi), ' ' str.tostring(vformat.mintick))

    // --- 5. SIGNAL LOGIC ---
    bool sfpShort high rHigh and close rHigh
    bool sfpLong 
    low rLow and close rLow

    var bool tBear false
    var bool tBull false
    if high >= sLo and low <= sUp
        tBear 
    := true
        tBear
    if low <= bUp and high >= bLo
        tBull 
    := true
        tBull

    bool pL 
    close[2] < open[2] and close[1] > open[1] and close high[1]
    bool pS close[2] > open[2] and close[1] < open[1] and close low[1]

    bool signalLongOnly tBull and pL
    bool signalShortOnly 
    tBear and pS

    if signalShortOnly or tBear and high rHigh
        tBear 
    := false
        tBear
    if signalLongOnly or tBull and low rLow
        tBull 
    := false
        tBull

    // RANGE ALANINI BELİRLEMEK İÇİN KULLLANILIR./////////////////////

    grp_sett "General Settings"
    len        input.int(5"Short-Term Sensitivity"minval=2group=grp_sett)
    color_up   input.color(#089981, "Historical Wave Color", group=grp_sett)

    grp_cast "Short-Term Forecast"
    show_ext_bull input.bool(true"Show Bullish Extension (Up)"group=grp_cast)
    show_ext_bear input.bool(true"Show Bearish Extension (Down)"group=grp_cast)
    color_cont    input.color(#ff9800, "Extension Color", group=grp_cast)

    link_scenarios input.bool(false"Start Reversal after Extension?"group=grp_cast)

    show_reversal input.bool(true"Show Reversal"group=grp_cast)
    color_rev     input.color(#f9ed03, "Reversal Color", group=grp_cast)



    grp_vis   "Dashboard & Visuals"
    show_table  input.bool(true"Show Target Table"group=grp_vis)
    show_labels input.bool(true"Show Chart Labels"group=grp_vis)
    show_grid   input.bool(true"Show Horizontal Fib Levels"group=grp_vis)
    show_inv    input.bool(true"Show Invalidation Line"group=grp_vis)
    show_div    input.bool(true"Show RSI Divergence (DİKKAT RSI DÖNÜŞ)"group=grp_vistooltip="Highlights setups where Price and RSI disagree (Divergence), indicating a stronger reversal signal.")

    // -----------------------------------------------------------------------------
    // STORAGE
    // -----------------------------------------------------------------------------
    var float[] pPrices = array.new_float()
    var 
    int[]   pBars   = array.new_int()
    var 
    bool[]  pDirs   = array.new_bool() 
    var 
    float[] pRSI    = array.new_float() // NEW: Store RSI values

    var float[] pPricesM = array.new_float()
    var 
    int[]   pBarsM   = array.new_int()
    var 
    bool[]  pDirsM   = array.new_bool()

    var 
    line[]  ghostLines  = array.new_line()
    var 
    label[] ghostLabels = array.new_label()
    //var table   infoTable   = table.new(position.top_right, 4, 20, border_width = 1)

    // -----------------------------------------------------------------------------
    // FUNCTIONS
    // -----------------------------------------------------------------------------
    // Updated to store RSI
    addPivot(float pint bbool dfloat rfloat[] pricesint[] barsbool[] dirsfloat[] rsis) =>
        array.
    unshift(pricesp)
        array.
    unshift(barsb)
        array.
    unshift(dirsd)
        array.
    unshift(rsisr// Store RSI
        
    if array.size(prices) > 20
            
    array.pop(prices)
            array.
    pop(bars)
            array.
    pop(dirs)
            array.
    pop(rsis)

    // Overload for Macro (no RSI tracking needed yet)
    addPivotMacro(float pint bbool dfloat[] pricesint[] barsbool[] dirs) =>
        array.
    unshift(pricesp)
        array.
    unshift(barsb)
        array.
    unshift(dirsd)
        if array.
    size(prices) > 20
            
    array.pop(prices)
            array.
    pop(bars)
            array.
    pop(dirs)

    drawPred(int t1float p1int t2float p2string txtstring fibcolor colint width) =>
        
    line.new(t1p1t2p2color=colstyle=line.style_dashedwidth=width)
        array.
    push(ghostLinesl)
        
        
    //if show_grid
            //l_hor = line.new(t2, p2, t2 + 10, p2, color=color.new(col, 50), style=line.style_dotted, width=1)
            //array.push(ghostLines, l_hor)

        
    if show_labels
            lbl_text 
    txt "\n" str.tostring(p2format.mintick)
            
    lb label.new(t2p2text=lbl_textcolor=color.new(color.white100), textcolor=colstyle=label.style_label_leftsize=size.small)
            array.
    push(ghostLabelslb)

    fillRow(int rstring tstring ffloat pcolor c) =>
        
    pct_diff = (close) / close 100
        pct_str  
    = (pct_diff "+" "") + str.tostring(pct_diff"#.##") + "%"
        
    pct_col  pct_diff >= #089981 : #f23645 
        
        //table.cell(infoTable, 0, r, t, text_color=color.white, bgcolor=c, text_size=size.small)
        //table.cell(infoTable, 1, r, f, text_color=color.white, bgcolor=color.new(c, 20), text_size=size.small)
        //table.cell(infoTable, 2, r, str.tostring(p, format.mintick), text_color=color.white, bgcolor=color.new(color.black, 20), text_size=size.small)
        //table.cell(infoTable, 3, r, pct_str, text_color=pct_col, bgcolor=color.new(color.black, 20), text_size=size.small)

    // -----------------------------------------------------------------------------
    // MAIN LOGIC
    // -----------------------------------------------------------------------------
    // Calculate RSI for Divergence Checks
    my_rsi ta.rsi(close14)

    ph77 ta.pivothigh(highlenlen)
    pl77 ta.pivotlow(lowlenlen)

    if 
    not na(ph77)
        
    // Pass RSI at the time of the pivot (offset by len)
        
    addPivot(ph77bar_index[len], truemy_rsi[len], pPricespBarspDirspRSI)
    if 
    not na(pl77)
        
    addPivot(pl77bar_index[len], falsemy_rsi[len], pPricespBarspDirspRSI)

    //phM = ta.pivothigh(high, len_macro, len_macro)
    //plM = ta.pivotlow(low, len_macro, len_macro)

    //if not na(phM)
        //addPivotMacro(phM, bar_index[len_macro], true, pPricesM, pBarsM, pDirsM)
    //if not na(plM)
        //addPivotMacro(plM, bar_index[len_macro], false, pPricesM, pBarsM, pDirsM)

    //if (not na(ph77) or not na(pl77)) and array.size(pPrices) > 1
        //p1_val = array.get(pPrices, 0)
        //p1_bar = array.get(pBars, 0)
        //p2_val = array.get(pPrices, 1)
        //p2_bar = array.get(pBars, 1)
        //line.new(p2_bar, p2_val, p1_bar, p1_val, color=color_up, width=1)

    // 3. PREDICTIVE LOGIC & TABLE
    if barstate.islast
        
    for l in ghostLines
            line
    .delete(l)
        for 
    lb in ghostLabels
            label
    .delete(lb)
        array.
    clear(ghostLines)
        array.
    clear(ghostLabels)
        
        
    //table.clear(infoTable, 0, 0, 3, 19)
        
        //if show_table
            //table.cell(infoTable, 0, 0, "DALGA", bgcolor=color.gray, text_color=color.white)
            //table.cell(infoTable, 1, 0, "FİBO", bgcolor=color.gray, text_color=color.white)
            ///table.cell(infoTable, 2, 0, "HEDEF", bgcolor=color.gray, text_color=color.white)
            //table.cell(infoTable, 3, 0, "% +/-", bgcolor=color.gray, text_color=color.white)
        
        
    int tbl_row 

        
    if array.size(pPrices) > 0
            last_conf_val 
    = array.get(pPrices0)
            
    last_conf_bar = array.get(pBars0)
            
    last_conf_dir = array.get(pDirs0)
            
            
    int bars_elapsed bar_index last_conf_bar
            float live_pivot_val 
    0.0
            int   live_pivot_bar 
    0
            bool  live_pivot_dir 
    bool(na)
            
    float live_pivot_rsi 50.0 // Default
            
            
    if last_conf_dir 
                lowest_val 
    1000000.0
                lowest_idx 
    0
                
    for 0 to bars_elapsed
                    
    if low[i] < lowest_val
                        lowest_val 
    := low[i]
                        
    lowest_idx := bar_index[i]
                        
    live_pivot_rsi := my_rsi[i// Capture RSI at lowest point
                
    live_pivot_val := lowest_val
                live_pivot_bar 
    := lowest_idx
                live_pivot_dir 
    := false 
            
    else 
                
    highest_val 0.0
                highest_idx 
    0
                
    for 0 to bars_elapsed
                    
    if high[i] > highest_val
                        highest_val 
    := high[i]
                        
    highest_idx := bar_index[i]
                        
    live_pivot_rsi := my_rsi[i// Capture RSI at highest point
                
    live_pivot_val := highest_val
                live_pivot_bar 
    := highest_idx
                live_pivot_dir 
    := true 

            float vol 
    math.abs(last_conf_val live_pivot_val)
            if 
    vol == 
                vol 
    := syminfo.mintick 100

            float rev_start_price 
    live_pivot_val
            int   rev_start_bar   
    live_pivot_bar
            
            
    // =========================================================
            // SCENARIO 1: EXTENSION
            // =========================================================
            
    float pExt na
            int   tExt 
    bar_index 10
            bool  drawing_ext 
    false

            
    if not live_pivot_dir 
                
    if show_ext_bear
                    calc_price 
    live_pivot_val - (vol 0.5)
                    
    pExt := math.max(0.01calc_price)
                    
    drawPred(live_pivot_barlive_pivot_valtExtpExt"(KAPAT)""0.5"color_cont2)
                    if 
    show_table
                        fillRow
    (tbl_row"SHORT KAPAT""0.5 Vol"pExtcolor_cont)
                        
    tbl_row += 1
                    drawing_ext 
    := true
            
    else 
                if 
    show_ext_bull
                    pExt 
    := live_pivot_val + (vol 0.5)
                    
    drawPred(live_pivot_barlive_pivot_valtExtpExt"(KAPAT)""0.5"color_cont2)
                    if 
    show_table
                        fillRow
    (tbl_row"LONG KAPAT""0.5 Vol"pExtcolor_cont)
                        
    tbl_row += 1
                    drawing_ext 
    := true

            
    if link_scenarios and drawing_ext
                rev_start_price 
    := pExt
                rev_start_bar   
    := tExt

            
    // =========================================================
            // SCENARIO 2: REVERSAL + RSI DIVERGENCE CHECK
            // =========================================================
            
    if show_reversal
                int t_step 
    5
                
                
    // --- RSI DIVERGENCE LOGIC ---
                
    bool has_div false
                
    // Check if we have history
                
    if array.size(pPrices) > 1
                    
    // If Live is Low, compare to Previous Low (index 1)
                    
    if not live_pivot_dir 
                        prev_low_val 
    = array.get(pPrices1)
                        
    prev_low_rsi = array.get(pRSI1)
                        
    // BULLISH DIV: Lower Price + Higher RSI
                        
    if live_pivot_val prev_low_val and live_pivot_rsi prev_low_rsi
                            has_div 
    := true
                    
    // If Live is High, compare to Previous High (index 1)
                    
    else 
                        
    prev_high_val = array.get(pPrices1)
                        
    prev_high_rsi = array.get(pRSI1)
                        
    // BEARISH DIV: Higher Price + Lower RSI
                        
    if live_pivot_val prev_high_val and live_pivot_rsi prev_high_rsi
                            has_div 
    := true

                
    // Invalidation Line
                
    if show_inv
                    inv_col 
    color.red
                    inv_y   
    rev_start_price
                    l_inv   
    line.new(rev_start_barinv_yrev_start_bar 25inv_ycolor=inv_colwidth=1style=line.style_solid)
                    array.
    push(ghostLinesl_inv)
                    
                    
    // Add Lightning Bolt if Divergence Detected
                    
    inv_txt "DENGE" + (has_div and show_div " DİKKAT RSI DÖNÜŞ" "")
                    
    inv_txt_col has_div and show_div color.yellow inv_col
                    
                    
    if show_labels
                        lb_inv 
    label.new(rev_start_bar 30inv_ytext=inv_txtcolor=color.new(color.white100), textcolor=inv_txt_colstyle=label.style_label_leftsize=size.small)
                        array.
    push(ghostLabelslb_inv)
                    
                    
    //if show_table
                        //fillRow(tbl_row, "GEÇERSİZ", (has_div and show_div ? "RSI âÅ¡¡" : "DİKKAT"), inv_y, color.red)
                        //tbl_row += 1

                
    if not live_pivot_dir 
                    p1 
    math.max(0.01rev_start_price + (vol 0.382))
                    
    t1 rev_start_bar 
                    drawPred
    (rev_start_barrev_start_pricet1p1"(1)""0.382"color_rev2)
                    if 
    show_table
                        fillRow
    (tbl_row"1""0.382"p1color_rev)
                        
    tbl_row += 1
                    
                    p2 
    math.max(0.01p1 - ((p1 rev_start_price) * 0.618))
                    
    t2 t1 t_step
                    drawPred
    (t1p1t2p2"(2)""0.618"color_rev2)
                    if 
    show_table
                        fillRow
    (tbl_row"2""0.618"p2color_rev)
                        
    tbl_row += 1
                    
                    p3 
    math.max(0.01p2 + ((p1 rev_start_price) * 1.618))
                    
    t3 t2 t_step
                    drawPred
    (t2p2t3p3"(3)""1.618"color_rev2)
                    if 
    show_table
                        fillRow
    (tbl_row"3""1.618"p3color_rev)
                        
    tbl_row += 1

                    p4 
    math.max(0.01p3 - ((p3 p2) * 0.382))
                    
    t4 t3 t_step
                    drawPred
    (t3p3t4p4"(4)""0.382"color_rev2)
                    if 
    show_table
                        fillRow
    (tbl_row"4""0.382"p4color_rev)
                        
    tbl_row += 1

                    p5 
    math.max(0.01p4 + (p1 rev_start_price))
                    
    t5 t4 t_step
                    drawPred
    (t4p4t5p5"(5)""1.0"color_rev2)
                    if 
    show_table
                        fillRow
    (tbl_row"5""1.0"p5color_rev)
                        
    tbl_row += 1
                    
                
    else 
                    
    pA math.max(0.01rev_start_price - (vol 0.382))
                    
    tA rev_start_bar 5
                    drawPred
    (rev_start_barrev_start_pricetApA"(A)""0.382"color_rev2)
                    if 
    show_table
                        fillRow
    (tbl_row"A""0.382"pAcolor_rev)
                        
    tbl_row += 1

                    pB 
    math.max(0.01pA + ((rev_start_price pA) * 0.618))
                    
    tB tA t_step
                    drawPred
    (tApAtBpB"(B)""0.618"color_rev2)
                    if 
    show_table
                        fillRow
    (tbl_row"B""0.618"pBcolor_rev)
                        
    tbl_row += 1

                    pC 
    math.max(0.01pB - ((rev_start_price pA) * 1.272))
                    
    tC tB t_step
                    drawPred
    (tBpBtCpC"(C)""1.272"color_rev2)
                    if 
    show_table
                        fillRow
    (tbl_row"C""1.272"pCcolor_rev)
                        
    tbl_row += 1

        
    // ==============ELİOT HESAPLAMASIDIR.===========================================
    // ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ INPUTS ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬
    var GRP1 "Core Settings"
    //i_lookback      = input.int(50, "Lookback Period", minval=20, maxval=100, group=GRP1, tooltip="How far back to look for S/R levels.")
    i_pivotStrength input.int(5"Pivot Strength"minval=2maxval=8group=GRP1tooltip="Bars needed to confirm a pivot. Higher = fewer but stronger levels.")
    i_maxLevels     input.int(2"Max Levels Each Side"minval=1maxval=5group=GRP1)
    i_zoneWidth     input.float(0.25"Zone Width %"minval=0.05maxval=0.5step=0.05group=GRP1)
    i_minDistance   input.float(1.0"Min Distance Between Levels %"minval=0.2maxval=3.0step=0.1group=GRP1tooltip="Lower values allow more levels to appear")

    var 
    GRP2 "Visual Settings"

    i_supportColor  input.color(#00ff88, "Support Color", group=GRP2)
    i_resistColor   input.color(#ff3366, "Resistance Color", group=GRP2)


    // ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ PERSISTENT DRAWING ARRAYS ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬
    var array<linesupportLines = array.new_line(0)
    var array<
    lineresistLines = array.new_line(0)
    var array<
    boxsupportBoxes = array.new_box(0)
    var array<
    boxresistBoxes = array.new_box(0)
    var array<
    labelsupportLabels = array.new_label(0)
    var array<
    labelresistLabels = array.new_label(0)

    // ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ FUNCTIONS ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬

    // Clear all drawings
    clearDrawings() =>
        for 
    ln in supportLines
            line
    .delete(ln)
        array.
    clear(supportLines)
        
        for 
    ln in resistLines
            line
    .delete(ln)
        array.
    clear(resistLines)
        
        for 
    bx in supportBoxes
            box
    .delete(bx)
        array.
    clear(supportBoxes)
        
        for 
    bx in resistBoxes
            box
    .delete(bx)
        array.
    clear(resistBoxes)
        
        for 
    lb in supportLabels
            label
    .delete(lb)
        array.
    clear(supportLabels)
        
        for 
    lb in resistLabels
            label
    .delete(lb)
        array.
    clear(resistLabels)

    // Find pivot levels - with safe bounds checking to prevent historical buffer errors
    findPivots(int lookbackint strengthbool isSupport) =>
        array<
    floatlevels = array.new_float(0)
        
        
    // Safe bounds that work for all TradingView plans and replay mode
        
    int safeStrength math.min(strength8)
        
        
    // Calculate safe maximum based on available bars
        // Use bar_index to ensure we never exceed what's available
        
    int availableBars math.max(0bar_index safeStrength 1)
        
    int safeMaxLookback math.min(lookbackavailableBars50)  // Cap at 50 for performance
        
        // Only proceed if we have enough bars
        
    if bar_index >= safeStrength and safeMaxLookback >= safeStrength
            
    for safeStrength to safeMaxLookback
                
    // Safety check: ensure we won't exceed available bars
                
    int maxAccess safeStrength
                
    if maxAccess >= bar_index
                    
    break
                
                
    bool isPivot true
                float price 
    isSupport low[i] : high[i]
                
                for 
    1 to safeStrength
                    int leftIdx 
    j
                    int rightIdx 
    j
                    
                    
    // Bounds check
                    
    if leftIdx or rightIdx >= bar_index
                        isPivot 
    := false
                        
    break
                    
                    if 
    isSupport
                        
    if low[i] >= low[leftIdx] or low[i] >= low[rightIdx]
                            
    isPivot := false
                            
    break
                    else
                        if 
    high[i] <= high[leftIdx] or high[i] <= high[rightIdx]
                            
    isPivot := false
                            
    break
                
                if 
    isPivot
                    
    array.push(levelsprice)
        
        
    levels

    // Filter levels to prevent overlap
    filterLevels(array<floatlevelsfloat minDistPctint maxCountfloat currentPricebool isSupport) =>
        array<
    floatresult = array.new_float(0)
        
    int sz = array.size(levels)
        
        if 
    sz == 0
            result
        
    else
            
    // Sort: support descending (closest first), resist ascending (closest first)
            
    array.sort(levelsisSupport order.descending order.ascending)
            
            for 
    0 to sz 1
                
    if array.size(result) >= maxCount
                    
    break
                    
                
    float lvl = array.get(levelsi)
                
                
    // Skip if wrong side of price
                
    if isSupport and lvl >= currentPrice
                    
    continue
                if 
    not isSupport and lvl <= currentPrice
                    
    continue
                
                
    // Check distance from existing levels in result
                
    bool tooClose false
                int resultSize 
    = array.size(result)
                if 
    resultSize 0
                    
    for 0 to resultSize 1
                        float existing 
    = array.get(resultj)
                        if 
    math.abs(lvl existing) / existing 100 minDistPct
                            tooClose 
    := true
                            
    break
                
                if 
    not tooClose
                    
    array.push(resultlvl)
            
            
    result

    // ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ MAIN LOGIC ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬

    // Only calculate and draw on last bar
    if barstate.islast
        
    // Clear previous drawings
        
    clearDrawings()
        
        
    // Find pivot levels
        
    array<floatrawSupport findPivots(i_lookbacki_pivotStrengthtrue)
        array<
    floatrawResist findPivots(i_lookbacki_pivotStrengthfalse)
        
        
    // Filter to get clean, non-overlapping levels
        
    array<floatsupportLevels filterLevels(rawSupporti_minDistancei_maxLevelsclosetrue)
        array<
    floatresistLevels filterLevels(rawResisti_minDistancei_maxLevelsclosefalse)
        
        
    float zoneSize close * (i_zoneWidth 100)
        
    int startBar bar_index i_lookback
        int endBar 
    bar_index 15
        
        
    // Draw support levels
        
    if array.size(supportLevels) > 0
            
    for 0 to array.size(supportLevels) - 1
                float level 
    = array.get(supportLevelsi)
                
                
    // Line
                
    line ln line.new(startBarlevelendBarlevel
                                  
    color=i_supportColorwidth=1style=line.style_dashed)
                array.
    push(supportLinesln)
                
              
                
    // Label (only nearest)
                
    if == 0
                    label lb 
    label.new(endBar 2level"S: " str.tostring(levelformat.mintick),
                                        
    style=label.style_label_leftcolor=color.new(i_supportColor50),
                                        
    textcolor=color.whitesize=size.small)
                    array.
    push(supportLabelslb)
        
        
    // Draw resistance levels
        
    if array.size(resistLevels) > 0
            
    for 0 to array.size(resistLevels) - 1
                float level 
    = array.get(resistLevelsi)
                
                
    // Line
                
    line ln line.new(startBarlevelendBarlevel,
                                  
    color=i_resistColorwidth=1style=line.style_dashed)
                array.
    push(resistLinesln)
                
          
                
    // Label (only nearest)
                
    if == 0
                    label lb 
    label.new(endBar 2level"R: " str.tostring(levelformat.mintick),
                                        
    style=label.style_label_leftcolor=color.new(i_resistColor50),
                                        
    textcolor=color.whitesize=size.small)
                    array.
    push(resistLabelslb)

    // ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ TEK PİVOT ARAR Kİ RANGE İÇİNDEKİ YÖNÜ KIYAS İÇİN KULLANILIR. ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬ââ€â‚¬
    //////------------------------------------------------------------------------------
    length744 input(100)
    extend input(true'Extend To Last Bar')
    //show_labels = input(true, 'Show Labels')

    //Style

    upcol input.color(#0004ff, 'Upper Extremity Color', group = 'Style')
    midcol input.color(#ff5d00, 'Zig Zag Color', group = 'Style')
    dncol input.color(color.rgb(2222466), 'Lower Extremity Color'group 'Style')
    //------------------------------------------------------------------------------
    os 0
    src 
    close
    bar_index
    var float valtop na
    var float valbtm na

    //------------------------------------------------------------------------------
    upper ta.highest(srclength744)
    lower ta.lowest(srclength744)
    os := src[length744] > upper src[length744] < lower os[1]

    btm os == and os[1] != 1
    top 
    os == and os[1] != 0

    //------------------------------------------------------------------------------
    btm_n ta.valuewhen(btmn0)
    top_n ta.valuewhen(topn0)
    len88 math.abs(btm_n top_n)

    if 
    btm
        max_diff_up 
    0.
        max_diff_dn 
    0.
        valbtm 
    := low[length744]

        for 
    0 to len88 1 by 1
            point 
    low[length744] + / (len88 1) * (valtop low[length744])
            
    max_diff_up := math.max(math.max(src[length744 i], open[length744 i]) - pointmax_diff_up)
            
    max_diff_dn := math.max(point math.min(src[length744 i], open[length744 i]), max_diff_dn)
            
    max_diff_dn

        
    //line.new(n[len + length744], valtop, n[length744], low[length744], color = midcol)

        //if show_ext
            //line.new(n[len + length744], valtop + max_diff_up, n[length744], low[length744] + max_diff_up, color = upcol, style = line.style_dotted)
            //line.new(n[len + length744], valtop - max_diff_dn, n[length744], low[length744] - max_diff_dn, color = dncol, style = line.style_dotted)
        
    if show_labels
            label
    .new(n[length744], low[length744], str.tostring(low[length744], '#.####'), color #00000000, style = label.style_label_up, textcolor = dncol, textalign = text.align_left, size = size.large)

    if top
        max_diff_up 
    0.
        max_diff_dn 
    0.
        valtop 
    := high[length744]

        for 
    0 to len88 1 by 1
            point 
    high[length744] + / (len88 1) * (valbtm high[length744])
            
    max_diff_up := math.max(math.max(src[length744 i], open[length744 i]) - pointmax_diff_up)
            
    max_diff_dn := math.max(point math.min(src[length744 i], open[length744 i]), max_diff_dn)
            
    max_diff_dn

        
    //line.new(n[len + length744], valbtm, n[length744], high[length744], color = midcol)

        //if show_ext
           // line.new(n[len + length744], valbtm + max_diff_up, n[length744], high[length744] + max_diff_up, color = upcol, style = line.style_dotted)
            //line.new(n[len + length744], valbtm - max_diff_dn, n[length744], high[length744] - max_diff_dn, color = dncol, style = line.style_dotted)
        
    if show_labels
            label
    .new(n[length744], high[length744], str.tostring(high[length744], '#.####'), color #00000000, style = label.style_label_down, textcolor = upcol, textalign = text.align_left, size = size.large)

    if barstate.islast and extend
        max_diff_up 
    0.
        max_diff_dn 
    0.
        x1 
    0
        y1 
    0.

        
    if os == 1
            x1 
    := btm_n length744
            y1 
    := valbtm

            
    for 0 to n btm_n length744 1 by 1
                point 
    src / (btm_n length744 1) * (valbtm src)
                
    max_diff_up := math.max(math.max(src[i], open[i]) - pointmax_diff_up)
                
    max_diff_dn := math.max(point math.min(src[i], open[i]), max_diff_dn)
                
    max_diff_dn
        
    else 
            
    x1 := top_n length744
            y1 
    := valtop

            
    for 0 to n top_n length744 1 by 1
                point 
    src / (top_n length744 1) * (valtop src)
                
    max_diff_up := math.max(math.max(src[i], open[i]) - pointmax_diff_up)
                
    max_diff_dn := math.max(point math.min(src[i], open[i]), max_diff_dn)
                
    max_diff_dn

        
    //line.delete(line.new(x1, y1, n, src, color = midcol, extend = extend.right)[1])

        //if show_ext
            //line.delete(line.new(x1, y1 + max_diff_up, n, src + max_diff_up, color = upcol, style = line.style_dotted, extend = extend.right)[1])
            //line.delete(line.new(x1, y1 - max_diff_dn, n, src - max_diff_dn, color = dncol, style = line.style_dotted, extend = extend.right)[1])

    //------------------------------------------------------------------------------
    plot(btm low[length744] : top high[length744] : na'ANA'color btm dncol upcolstyle plot.style_circlesoffset = -length744)
    ///////////////EN SON TEPE V E DİP PERİYOTA GÖRE ANA TREND OLARAK BELİRLENİR.///////////////

    // ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½
    int left_bars input(1'Left Bars'group 'Pivot Settings')
    int right_bars input(2'Right Bars'group 'Pivot Settings')
    float Offset input.float(0.1step 0.01)


    // ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½
    var float phy na
    var float ply na

    atr 
    ta.atr(200)

    p_high ta.pivothigh(high atr Offsetleft_barsright_bars)
    p_low ta.pivotlow(low atr Offsetleft_barsright_bars)

    if 
    bool(p_high)
        
    phy := p_high
        phy

    if bool(p_low)
        
    ply := p_low
        ply

    // Trend 
    upperBand phy
    lowerBand 
    ply

    prevLowerBand 
    nz(lowerBand[1])
    prevUpperBand nz(upperBand[1])


    int trend na
    float Trend 
    na
    prevTrend 
    Trend[1]

    if 
    prevTrend == prevUpperBand
        trend 
    := close upperBand : -1
        trend
    else
        
    trend := close lowerBand ? -1
        trend
    Trend 
    := trend == lowerBand trend == -upperBand na


    // ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½
    //@ Signals
    color trend == color.blue trend == -color.red na
    plotchar
    (ta.crossover(trend0) ? Trend na'Buy''��'location.absolutecolor.bluesize size.small)
    plotchar(ta.crossunder(trend0) ? Trend na'Sell''��'location.absolutecolor.redsize size.small)

    // PİVOT TREND SİNYALLERİDİR.////////////
    mt input.timeframe(''title 'S/R timeframe')
    sh input.int(2title 'Shift S/R Forward/Backward')
    start input.float(title 'Start'step 0.01defval 0.)
    increment input.float(title 'Increment'step 0.01defval 0.09)
    maximum input.float(title 'Maximum'step 0.01defval 0.2)

    sar request.security(syminfo.tickeridmtta.sar(startincrementmaximum))
    plot(sarstyle plot.style_circleslinewidth 1color color.yellow)
    dir sar close : -1

    buy 
    dir == and dir[1] == -1
    sell 
    dir == -and dir[1] == 1

    //alertcondition(buy, title = 'SAR BUY', message = 'PSAR/Buy Signal')
    //alertcondition(sell, title = 'SAR SELL', message = 'PSAR/Sell Signal')
    //alertcondition(buy or sell, title = 'SAR BUY/SELL', message = 'PSAR/Buy/Sell Signal')


    ta.valuewhen(buyclose0)
    ta.valuewhen(sellclose0)
    buyalert open and close and open[1] < h
    sellalert 
    open and close and open[1] > h

    ta.valuewhen(buyclose[0], 0)
    plot(ycolor color.rgb(10187196100), linewidth 1title 'High'offset sh)

    ta.valuewhen(sellclose[0], 0)
    plot(zcolor color.rgb(2406127100), linewidth 1title 'Low'offset sh)

    //fill(u, d, color = y > z ? color.rgb(255, 82, 82, 77) : color.rgb(76, 175, 79, 78))

    plotshape(buy sar natitle 'Buy'text 'A'location location.absolutestyle shape.labelupsize size.tinycolor #06b5e5, textcolor = color.white)
    plotshape(sell sar natitle 'Sell'text 'S'location location.absolutestyle shape.labeldownsize size.tinycolor color.rgb(24911106), textcolor color.white)

    /////////////////SAR İLE BULUTLAMADIR./////////// 
    16.07.2024 - 10.12.2024

Sayfa 358/359 İlkİlk ... 258308348356357358359 SonSon

Yer İmleri

Yer İmleri

Gönderi Kuralları

  • Yeni konu açamazsınız
  • Konulara cevap yazamazsınız
  • Yazılara ek gönderemezsiniz
  • Yazılarınızı değiştiremezsiniz
  •