Artan

34,10 10 18:10
12,00 9.99 18:10
6.742,50 9.99 18:10
36,58 9.98 18:10
18,32 9.96 18:10
Artan Hisseler

Azalan

477,00 -10 18:10
7,92 -10 18:10
95,40 -10 18:10
31,90 -9.99 18:10
30,48 -9.98 18:10
Azalan Hisseler

İşlem

15.610.120.553,75 18:10
15.395.772.063,75 18:10
12.839.122.521,65 18:10
11.391.294.342,66 18:10
10.987.845.810,50 18:10
Tüm Hisseler
Sayfa 361/363 İlkİlk ... 261311351359360361362363 SonSon
Arama sonucu : 2902 madde; 2,881 - 2,888 arası.

Konu: Tradingview

  1. PHP Code:
    //@version=6
    indicator('...'overlay truemax_lines_count 500max_labels_count 500)
    ma_tt '=== Moving Average Cycle ==='
    _source close
    _p 
    input(100title 'Period'inline 'set1'group ma_tt)
    _c ta.ema(close_p) - ta.sma(close_p)
    _m 0
    sr_group 
    '=== Support Resistance ==='
    Left input.int(4title '.'minval 1group sr_group)
    Right input.int(4title '.'minval 0group sr_group)
    trading_group '=== Trading Setup ==='
    trading_setup input.string('Both'title 'Setup'options = ['Long Only''Short Only''Both''MA Cycle''RSI_MACD''Gaussian_Filter'], group trading_group)

    var 
    Long false
    Short 
    false
    if trading_setup == 'Long Only'
        
    Long := true
        Short 
    := false
        Short
    else if trading_setup == 'Short Only'
        
    Long := false
        Short 
    := true
        Short
    else if trading_setup == 'MA Cycle'
        
    if _c 0
            Long 
    := true
            Short 
    := false
            Short
        
    else
            
    Long := false
            Short 
    := true
            Short
    //else if trading_setup == 'RSI_MACD'
        //if _m > 0
            //Long := true
            //Short := false
            //Short
        //else
            //Long := false
            //Short := true
            //Short
    //else if trading_setup == 'Gaussian_Filter'
        //if _g > 0
            //Long := true
            //Short := false
            //Short
        //else
            //Long := false
            //Short := true
            //Short
    else
        
    Long := true
        Short 
    := true
        Short
        
    //Background Filling
    ///

    isFractal(x) =>
        
    ta.highestbars(xLeft Right 1) == -Right
    sF 
    isFractal(-low)
    support low
    support 
    := sF low[Right] : support[1]
    rF isFractal(high)
    resistance high
    resistance 
    := rF high[Right] : resistance[1]
    //Value & Index
    ph rF
    ph_val 
    ta.valuewhen(phresistance0)
    res ph_val
    ph_index 
    ta.valuewhen(phbar_index Right0)

    pl sF
    pl_val 
    ta.valuewhen(plsupport0)
    sup pl_val
    pl_index 
    ta.valuewhen(plbar_index Right0)
    //Long setup
    var long_sup_index 0
    long_sup_val 
    0.0
    long_res_val 
    0.0
    if pl_index ph_index
        long_sup_index 
    := pl_index
        long_sup_val 
    := pl_val
        long_res_val 
    := ph_val
        long_res_val
    else
        
    long_sup_index := long_sup_index[1]
        
    long_sup_val := long_sup_val[1]
        
    long_sup_val
    if long_sup_index == long_sup_index[1]
        
    long_res_val := long_res_val[1]
        
    long_res_val
        
    //Long Condition
    long_cond close long_sup_val and Long
    //Resistance Line
    long_res_x1 long_sup_index
    long_res_y1 
    long_cond long_res_val na
    long_res_x2 
    bar_index
    long_res_y2 
    long_res_y1
    long_res_ext 
    extend.right
    long_res_clr 
    color.new(color.red0)
    long_res_textColor color.new(color.white0)
    long_res_sty line.style_dotted
    long_res_width 
    2
    plot
    (long_cond long_res_y1 natitle 'Long Arttır'color color.new(color.red100))

    //Support Line
    long_sup_x1 long_sup_index
    long_sup_y1 
    Long long_sup_val na
    long_sup_x2 
    bar_index
    long_sup_y2 
    long_sup_y1
    long_sup_ext 
    extend.right
    long_sup_clr 
    color.new(color.blue0)
    long_sup_textColor color.new(color.white0)
    long_sup_sty line.style_dotted
    long_sup_width 
    2
    plot
    (Long long_sup_val natitle 'Long DüşünME'color color.new(color.blue100))
    //Fib50 Line
    long_fib50_x1 long_sup_index
    long_fib50_y1 
    long_cond ? (long_res_y1 long_sup_y1) * 0.5 na
    long_fib50_x2 
    bar_index
    long_fib50_y2 
    long_fib50_y1
    long_fib50_ext 
    extend.right
    long_fib50_clr 
    color.new(color.blue0)
    long_fib50_textColor color.new(color.white0)
    long_fib50_sty line.style_dotted
    long_fib50_width 
    2
    plot
    (long_cond long_fib50_y1 natitle 'Long Başla'color color.new(color.blue100))
    //Fib618 Line
    long_fib618_x1 long_sup_index
    long_fib618_y1 
    long_cond long_res_y1 - (long_res_y1 long_sup_y1) * 0.618 na
    long_fib618_x2 
    bar_index
    long_fib618_y2 
    long_fib618_y1
    long_fib618_ext 
    extend.right
    long_fib618_clr 
    color.new(color.blue0)
    long_fib618_textColor color.new(color.white0)
    long_fib618_sty line.style_dotted
    long_fib618_width 
    2

    long_tp1_x1 
    long_sup_index
    long_tp1_y1 
    long_cond long_res_y1 + (long_res_y1 long_sup_y1) * 0.382 na
    long_tp1_x2 
    bar_index
    long_tp1_y2 
    long_tp1_y1
    long_tp1_ext 
    extend.right
    long_tp1_clr 
    color.new(color.blue0)
    long_tp1_textColor color.new(color.white0)
    long_tp1_sty line.style_dotted
    long_tp1_width 
    2
    plot
    (long_cond long_tp1_y1 natitle 'Long Kapat'color color.new(color.blue100))
    //tp2
    long_tp2_x1 long_sup_index
    long_tp2_y1 
    long_cond long_res_y1 long_res_y1 long_sup_y1 na
    long_tp2_x2 
    bar_index
    long_tp2_y2 
    long_tp2_y1
    long_tp2_ext 
    extend.right
    long_tp2_clr 
    color.new(color.blue0)
    long_tp2_textColor color.new(color.white0)
    long_tp2_sty line.style_dotted
    long_tp2_width 
    2
    plot
    (long_cond long_tp2_y1 natitle 'Long Kesin Kapat'color color.new(color.blue100))

    //Short setup
    var short_res_index 0
    short_res_val 
    0.0
    short_sup_val 
    0.0
    if pl_index ph_index
        short_res_index 
    := ph_index
        short_res_val 
    := ph_val
        short_sup_val 
    := pl_val
        short_sup_val
    else
        
    short_res_index := short_res_index[1]
        
    short_res_val := short_res_val[1]
        
    short_res_val
    if short_res_index == short_res_index[1]
        
    short_sup_val := short_sup_val[1]
        
    short_sup_val
        
    //Short Condition
    short_cond close short_res_val and Short
    //Resistance Line
    short_res_x1 short_res_index
    short_res_y1 
    Short short_res_val na
    short_res_x2 
    bar_index
    short_res_y2 
    short_res_y1
    short_res_ext 
    extend.right
    short_res_clr 
    color.new(color.red0)
    short_res_textColor color.new(color.white0)
    short_res_sty line.style_dotted
    short_res_width 
    2
    plot
    (Short short_res_val natitle 'Short DüşünME'color color.new(color.red100))

    //Support Line
    short_sup_x1 short_res_index
    short_sup_y1 
    short_cond short_sup_val na
    short_sup_x2 
    bar_index
    short_sup_y2 
    short_sup_y1
    short_sup_ext 
    extend.right
    short_sup_clr 
    color.new(color.blue0)
    short_sup_textColor color.new(color.white0)
    short_sup_sty line.style_dotted
    short_sup_width 
    2
    plot
    (short_cond short_sup_y1 natitle 'Short Arttır'color color.new(color.blue100))
    //Fib50 Line
    short_fib50_x1 short_res_index
    short_fib50_y1 
    short_cond ? (short_res_y1 short_sup_y1) * 0.5 na
    short_fib50_x2 
    bar_index
    short_fib50_y2 
    short_fib50_y1
    short_fib50_ext 
    extend.right
    short_fib50_clr 
    color.new(color.red0)
    short_fib50_textColor color.new(color.white0)
    short_fib50_sty line.style_dotted
    short_fib50_width 
    2
    plot
    (short_cond short_fib50_y1 natitle 'Short Başla'color color.new(color.red100))
    //Fib618 Line
    short_fib618_x1 short_res_index
    short_fib618_y1 
    short_cond short_sup_y1 + (short_res_y1 short_sup_y1) * 0.618 na
    short_fib618_x2 
    bar_index
    short_fib618_y2 
    short_fib618_y1
    short_fib618_ext 
    extend.right
    short_fib618_clr 
    color.new(color.red0)
    short_fib618_textColor color.new(color.white0)
    short_fib618_sty line.style_dotted
    short_fib618_width 
    2

    short_tp1_x1 
    short_res_index
    short_tp1_y1 
    short_cond short_sup_y1 - (short_res_y1 short_sup_y1) * 0.382 na
    short_tp1_x2 
    bar_index
    short_tp1_y2 
    short_tp1_y1
    short_tp1_ext 
    extend.right
    short_tp1_clr 
    color.new(color.red0)
    short_tp1_textColor color.new(color.white0)
    short_tp1_sty line.style_dotted
    short_tp1_width 
    2
    plot
    (short_cond short_tp1_y1 natitle 'Short Kapat'color color.new(color.red100))
    //tp2
    short_tp2_x1 short_res_index
    short_tp2_y1 
    short_cond short_sup_y1 - (short_res_y1 short_sup_y1) : na
    short_tp2_x2 
    bar_index
    short_tp2_y2 
    short_tp2_y1
    short_tp2_ext 
    extend.right
    short_tp2_clr 
    color.new(color.red0)
    short_tp2_textColor color.new(color.white0)
    short_tp2_sty line.style_dotted
    short_tp2_width 
    2
    plot
    (short_cond short_tp2_y1 natitle 'Short Kesin Kapat'color color.new(color.red100))

    // --------------------------------------------------------------------------------------------------------------------{

    bool  trend_on input.bool(true""inline "trend"group "Trend")
    float trend_   input.float(4"Trend"step 0.01inline "trend"group "Trend")
    color col1     input.color(#26905d, "", inline = "trend", group = "Trend")
    color col2     input.color(#74286d, "",inline = "trend", group = "Trend")

    int   extend   input.int(15"Extend"group "Fibonacci"inline "1"), fill_col input.color(#2689901c, "", group = "Fibonacci", inline = "1")

    float v_236 input.float(0.236"1")*100
    float v_382 
    input.float(0.382"2")*100
    float v_618 
    input.float(0.618"3")*100
    float v_786 
    input.float(0.786"4")*100

    // UDT
    type data 
        line fib05  
    na    
        line fib0   
    na
        line fib236 
    na
        line fib382 
    na
        line fib618 
    na
        line fib786 
    na
        line fib_   
    na
        line fib_di   
    na

        label H 
    na
        label L 
    na

        label L0   
    na
        label L236 
    na
        label L382 
    na
        label L618 
    na
        label L786 
    na
        label L_   
    na


    var fib_d =  data.new()

    [
    supertrenddirection] = ta.supertrend(trend_25)

    draw_fibb(trend)=>

        var 
    float(na)
        var 
    float(na)
        var 
    hi int(na)
        var 
    li int(na)

        var 
    val_0 float(na)
        var 
    val_ float(na)

        
    atr ta.atr(200)
        
    // delete previous fibb 
        
    if trend != trend[1]
            
    line.delete(fib_d.fib_)
            
    line.delete(fib_d.fib0)
            
    line.delete(fib_d.fib05)
            
    line.delete(fib_d.fib_di)
            
    line.delete(fib_d.fib236)
            
    line.delete(fib_d.fib382)
            
    line.delete(fib_d.fib618)
            
    line.delete(fib_d.fib786)
            
    label.delete(fib_d.H)
            
    label.delete(fib_d.L)
            
    label.delete(fib_d.L0)
            
    label.delete(fib_d.L_)        
            
    label.delete(fib_d.L236)
            
    label.delete(fib_d.L382)
            
    label.delete(fib_d.L618)
            
    label.delete(fib_d.L786)


        
    // Creat Fib Lines at the bottom and the top
        
    if trend != trend[1] and trend == -1
        
            fib_d
    .fib_ := line.new(bar_indexlowbar_indexlowcolor chart.fg_colorwidth 2)
            
    fib_d.fib0 := line.new(bar_indexhigh+atr*3bar_indexhigh+atr*3color chart.fg_colorwidth 2)


        if 
    trend != trend[1] and trend == 1
        
            fib_d
    .fib_ := line.new(bar_indexhighbar_indexhighcolor chart.fg_colorwidth 2)
            
    fib_d.fib0 := line.new(bar_indexlow-atr*3bar_indexlow-atr*3color chart.fg_colorwidth 2)

            
    fib_d.fib_di := line.new(lilhihstyle line.style_dashedcolor chart.fg_color)
            

        
    // Extend fibb lines during a trend
        
    if trend == trend[1]
            
    // Update High and low of Fibb
            
            
    if low fib_d.fib_.get_y1()
                
    fib_d.fib_.set_y1(low)
                
    fib_d.fib_.set_y2(low)


            if 
    high fib_d.fib0.get_y1()
                
    fib_d.fib0.set_y1(high)
                
    fib_d.fib0.set_y2(high)


            
    //

            
    if trend == -1

                val_0   
    := fib_d.fib0.get_y1()
                
    val_    := fib_d.fib_.get_y1()

            if 
    trend == 

                val_0   
    := fib_d.fib_.get_y1()
                
    val_    := fib_d.fib0.get_y1()

            
    ///////
    // --------------------------------------------------------------------------------------------------------------------}

    draw_fibb(direction)

    color trend_on ? (direction == col2 col1) : na
    p1 
    plot(supertrend"Trend"color direction != direction[1] ? na colorstyle plot.style_linebr)

    // KAMA PARAMETERS
    // ============================================================================
    kama1_length input.int(2'KAMA 1 Length'minval 1group 'KAMA Settings')
    kama1_fast input.int(1'KAMA 1 Fast Length'minval 1group 'KAMA Settings')
    kama1_slow input.int(3'KAMA 1 Slow Length'minval 1group 'KAMA Settings')

    kama2_length input.int(3'KAMA 2 Length'minval 1group 'KAMA Settings')
    kama2_fast input.int(2'KAMA 2 Fast Length'minval 1group 'KAMA Settings')
    kama2_slow input.int(4'KAMA 2 Slow Length'minval 1group 'KAMA Settings')

    kama3_length input.int(4'KAMA 3 Length'minval 1group 'KAMA Settings')
    kama3_fast input.int(3'KAMA 3 Fast Length'minval 1group 'KAMA Settings')
    kama3_slow input.int(5'KAMA 3 Slow Length'minval 1group 'KAMA Settings')

    kama4_length input.int(5'KAMA 4 Length'minval 1group 'KAMA Settings')
    kama4_fast input.int(4'KAMA 4 Fast Length'minval 1group 'KAMA Settings')
    kama4_slow input.int(6'KAMA 4 Slow Length'minval 1group 'KAMA Settings')

    kama5_length input.int(6'KAMA 5 Length'minval 1group 'KAMA Settings')
    kama5_fast input.int(7'KAMA 5 Fast Length'minval 1group 'KAMA Settings')
    kama5_slow input.int(8'KAMA 5 Slow Length'minval 1group 'KAMA Settings')

    src874 input.source(close'Source'group 'KAMA Settings')

    // ============================================================================
    // TREND COLORING PARAMETERS
    // ============================================================================
    color color_bearish_price_state input.color(color.rgb(2243251), 'Bearish Trend'group 'Colors')
    color color_bullish_price_state input.color(#f1f6f7, 'Bullish Trend', group = 'Colors')
    color color_bullish_resistance_state input.color(color.rgb(2433352), 'Bullish Resistance'group 'Colors')
    color color_bearish_support_state input.color(color.rgb(226247252), 'Bearish Support'group 'Colors')

    float atr_multiplier_gray input.float(14'ATR Multiplier (Gray Zone)'minval 0.1group 'Ribbon Settings')
    float atr_multiplier_yellow input.float(14'ATR Multiplier (Yellow Zone)'minval 0.1group 'Ribbon Settings')


    // ============================================================================
    // KAMA CALCULATION FUNCTION
    // ============================================================================
    f_kama(float src874int lengthint fastLengthint slowLength) =>
        
    mom math.abs(ta.change(src874length))
        
    volatility math.sum(math.abs(ta.change(src874)), length)
        
    er volatility != mom volatility 0

        fastAlpha 
    / (fastLength 1)
        
    slowAlpha / (slowLength 1)
        
    alpha math.pow(er * (fastAlpha slowAlpha) + slowAlpha2)

        var 
    float kama na
        kama 
    := alpha src874 + (alpha) * nz(kama[1], src874)
        
    kama

    // ============================================================================
    // CALCULATE ALL KAMAS
    // ============================================================================
    float kama1 f_kama(src874kama1_lengthkama1_fastkama1_slow)
    float kama2 f_kama(src874kama2_lengthkama2_fastkama2_slow)
    float kama3 f_kama(src874kama3_lengthkama3_fastkama3_slow)
    float kama4 f_kama(src874kama4_lengthkama4_fastkama4_slow)
    float kama5 f_kama(src874kama5_lengthkama5_fastkama5_slow)

    // ============================================================================
    // KAMA STACK RIBBON LOGIC (Replaces SMA Stack)
    // ============================================================================
    bool is_bullish_stack kama1 kama2 and kama2 kama3 and kama3 kama4 and kama4 kama5
    bool is_bearish_stack 
    kama1 kama2 and kama2 kama3 and kama3 kama4 and kama4 kama5

    float atr_gray 
    ta.atr(14) * atr_multiplier_gray
    float atr_yellow 
    ta.atr(14) * atr_multiplier_yellow
    float kama_spread 
    math.abs(kama1 kama5)

    bool is_narrowing_gray not is_bullish_stack and not is_bearish_stack and kama_spread atr_gray
    bool is_narrowing_yellow 
    not is_bullish_stack and not is_bearish_stack and kama_spread atr_yellow

    var bool was_bullish_stack false
    var bool was_bearish_stack false

    was_bullish_stack 
    := is_bullish_stack true is_bearish_stack false was_bullish_stack
    was_bearish_stack 
    := is_bearish_stack true is_bullish_stack false was_bearish_stack

    // ============================================================================
    color kama_ribbon_color is_bearish_stack color_bearish_price_state is_narrowing_yellow and not was_bullish_stack color_bearish_support_state is_narrowing_gray and was_bullish_stack color_bullish_resistance_state is_bullish_stack color_bullish_price_state na


    // ============================================================================
    plotcandle(openhighlowclosecolor kama_ribbon_colorwickcolor kama_ribbon_colorbordercolor kama_ribbon_colortitle 'MUM')
    /////////////////////

    // Only act after candle closes
    isClosed barstate.isconfirmed

    // Your raw retracement rules
    bullRaw isClosed and close[1] < open[1] and close open and close low[1]
    bearRaw isClosed and close[1] > open[1] and close open and close high[1]

    // Small wick-based spacing
    spaceUp = (high close) * 0.35
    spaceDown 
    = (open low) * 0.35

    // Colors
    brightRed color.rgb(25500)
    brightGreen color.rgb(02550)

    // Wave locks
    var bool bullWaveLocked false
    var bool bearWaveLocked false

    // Reset locks when opposite candle prints
    if isClosed and close open
        bullWaveLocked 
    := false
        bullWaveLocked

    if isClosed and close open
        bearWaveLocked 
    := false
        bearWaveLocked

    // BEARISH WAVE (Red)
    if bullRaw and not bullWaveLocked
        label
    .new(bar_index 1high[1] + (high[1] - close[1]) * 0.35'L'style label.style_nonetextcolor brightRedsize size.large)

        
    label.new(bar_indexhigh spaceUp'o'style label.style_nonetextcolor brightRedsize size.large)

        
    bullWaveLocked := true
        bullWaveLocked

    // BULLISH WAVE (Green)
    if bearRaw and not bearWaveLocked
        label
    .new(bar_index 1low[1] - (open[1] - low[1]) * 0.35'L'style label.style_nonetextcolor brightGreensize size.large)

        
    label.new(bar_indexlow spaceDown'o'style label.style_nonetextcolor brightGreensize size.large)

        
    bearWaveLocked := true
        bearWaveLocked
    ///////////////////////// 
    16.07.2024 - 10.12.2024

  2. PHP Code:
    // Predicta Futures - Next Candle Predictor
    // Version 2.1 (UI/UX Improved)
    // by Predicta Futures

    //@version=6
    indicator("."overlay=truemax_boxes_count=100max_lines_count=100max_labels_count=100)

    // ============================================================================
    // INPUT SETTINGS
    // ============================================================================

    grp_main "Main Settings"
    atrLength input.int(5"ATR Period"minval=5maxval=50group=grp_main)
    stFactor input.float(1.0"Supertrend Factor"minval=1.0maxval=5.0step=0.1group=grp_main)
    stPeriod input.int(5"Supertrend Period"minval=5maxval=30group=grp_main)

    grp_confluence "Confluence Settings"
    minConfluence input.int(2"Minimum Confluence Score"minval=2maxval=6group=grp_confluence)
    minVolumeRatio input.float(0.8"Minimum Volume Ratio"minval=0.5maxval=2.0step=0.1group=grp_confluence)

    grp_vis "Visual Settings"
    showTable input.bool(true"Show Analysis Table"group=grp_vis)
    showProjection input.bool(true"Show Prediction Candles"group=grp_vis)

    // ============================================================================
    // COLORS
    // ============================================================================

    colLong #089981
    colShort #f23645
    colFTBackground #FCD0AF
    colBg #1e222d
    colBgDark #131722
    colBlack #000000
    colText #ffffff
    colGray #787b86
    colYellow #f0b90b

    // ============================================================================
    // TECHNICAL CALCULATIONS
    // ============================================================================

    atr ta.atr(atrLength)
    [
    supertrendstDirection] = ta.supertrend(stFactorstPeriod)
    ema8 ta.ema(close2)
    ema21 ta.ema(close5)
    ema50 ta.ema(close9)
    rsi ta.rsi(close14)
    [
    macdLinesignalLinemacdHist] = ta.macd(close12269)
    volSma ta.sma(volume20)
    volRatio nz(volume volSma1.0)
    avgBody ta.sma(math.abs(close open), 5)

    isUptrend stDirection == -1
    isDowntrend 
    stDirection == 1

    // Stochastic
    stochK ta.stoch(closehighlow14)
    stochD ta.sma(stochK3)

    // ADX
    adxLen 14
    [diPlusdiMinusadxValue] = ta.dmi(adxLenadxLen)

    // Bollinger Width
    bbMid ta.sma(close20)
    bbStd ta.stdev(close20)
    bbWidth = (bbMid bbStd - (bbMid bbStd)) / bbMid

    // ============================================================================
    // DYNAMIC THRESHOLD (ADX Based)
    // ============================================================================

    dynamicThreshold adxValue 25 60 adxValue 20 65 70

    // ============================================================================
    // SCORING SYSTEM
    // ============================================================================

    macdScoreLong macdLine signalLine and macdHist 100 macdLine signalLine 70 macdHist 50 20
    rsiScoreLong 
    rsi 30 100 rsi 40 80 rsi 50 60 rsi 60 40 20
    stochScoreLong 
    stochK stochD and stochK 20 100 stochK stochD 70 30
    volScore 
    volRatio 2.0 100 volRatio 1.5 80 volRatio 1.0 60 40
    adxScore 
    adxValue 30 100 adxValue 25 80 adxValue 20 60 40
    trendScoreLong 
    isUptrend and ema8 ema21 and ema21 ema50 100 isUptrend and ema8 ema21 80 isUptrend 60 0

    macdScoreShort 
    macdLine signalLine and macdHist 100 macdLine signalLine 70 macdHist 50 20
    rsiScoreShort 
    rsi 70 100 rsi 60 80 rsi 50 60 rsi 40 40 20
    stochScoreShort 
    stochK stochD and stochK 80 100 stochK stochD 70 30
    trendScoreShort 
    isDowntrend and ema8 ema21 and ema21 ema50 100 isDowntrend and ema8 ema21 80 isDowntrend 60 0

    longScore 
    math.round((macdScoreLong 0.20 rsiScoreLong 0.15 stochScoreLong 0.15 volScore 0.15 trendScoreLong 0.25 adxScore 0.10))
    shortScore math.round((macdScoreShort 0.20 rsiScoreShort 0.15 stochScoreShort 0.15 volScore 0.15 trendScoreShort 0.25 adxScore 0.10))

    totalRaw longScore shortScore
    longPct 
    totalRaw math.round(longScore totalRaw 100) : 50
    shortPct 
    100 longPct

    // ============================================================================
    // CONFLUENCE SCORE (0-6)
    // ============================================================================

    confluenceLong 0
    confluenceLong 
    += isUptrend 0
    confluenceLong 
    += ema8 ema21 0
    confluenceLong 
    += macdLine signalLine 0
    confluenceLong 
    += stochK stochD 0
    confluenceLong 
    += volRatio >= minVolumeRatio 0
    confluenceLong 
    += adxValue 20 0

    confluenceShort 
    0
    confluenceShort 
    += isDowntrend 0
    confluenceShort 
    += ema8 ema21 0
    confluenceShort 
    += macdLine signalLine 0
    confluenceShort 
    += stochK stochD 0
    confluenceShort 
    += volRatio >= minVolumeRatio 0
    confluenceShort 
    += adxValue 20 0

    volumeOk 
    volRatio >= minVolumeRatio

    // ============================================================================
    // PERFECT TIME
    // ============================================================================

    longPerfect isUptrend and longPct >= dynamicThreshold and confluenceLong >= minConfluence and volumeOk
    shortPerfect 
    isDowntrend and shortPct >= dynamicThreshold and confluenceShort >= minConfluence and volumeOk

    // ============================================================================
    // HELPER FUNCTIONS - ASCII LOADING BAR
    // ============================================================================

    getAsciiBar(score) =>
        
    filled math.round(score 10)
        
    filled := math.max(0math.min(10filled))
        
    "[" str.repeat("â–ˆ"filled) + str.repeat("â–‘"10 filled) + "]"

    getMacdText(isLongParam) =>
        if 
    isLongParam
            macdLine 
    signalLine and macdHist "BOGA " macdLine signalLine "BOGA" "AYI"
        
    else
            
    macdLine signalLine and macdHist "AYI " macdLine signalLine "AYI" "BOGA"

    getRsiText() =>
        
    "(" str.tostring(math.round(rsi)) + ")"

    getStochText(isLongParam) =>
        if 
    isLongParam
            stochK 
    20 "SATIS" stochK stochD "BOGA" "AYI"
        
    else
            
    stochK 80 "ALIS" stochK stochD "AYI" "BOGA"

    getVolText() =>
        
    str.tostring(math.round(volRatio1)) + "x"

    getTrendText(isLongParam) =>
        if 
    isLongParam
            isUptrend 
    and ema8 ema21 "YUKSELIS" isUptrend "+" "-"
        
    else
            
    isDowntrend and ema8 ema21 "DUSUS" isDowntrend "-" "+"

    getAdxText() =>
        
    str.tostring(math.round(adxValue))

    // ============================================================================
    // ANALYSIS TABLE - IMPROVED UI
    // ============================================================================

    var table analysisTable table.new(position.bottom_center5050bgcolor=colBgDarkborder_width=0frame_width=2frame_color=colGray)

    if 
    barstate.islast and showTable
        
    // ===== LONG SECTION =====
        
    table.cell(analysisTable00"BOGA "text_color=colTextbgcolor=colLongtext_size=size.normaltext_halign=text.align_left)
        
    table.cell(analysisTable10"OLASILIK " str.tostring(longPct) + "%"text_color=colTextbgcolor=colLongtext_size=size.normaltext_halign=text.align_right)
        
        
    // MACD
        
    table.cell(analysisTable01"MACD"text_color=colTextbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    macdBarColorL macdScoreLong >= 70 colLong colGray
        table
    .cell(analysisTable11getAsciiBar(macdScoreLong) + " " getMacdText(true), text_color=macdBarColorLbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // RSI
        
    table.cell(analysisTable02"RSI"text_color=colTextbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    rsiBarColorL rsiScoreLong >= 60 colLong colGray
        table
    .cell(analysisTable12getAsciiBar(rsiScoreLong) + " " getRsiText(), text_color=rsiBarColorLbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // STOCH
        
    table.cell(analysisTable03"STCH"text_color=colTextbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    stochBarColorL stochScoreLong >= 70 colLong colGray
        table
    .cell(analysisTable13getAsciiBar(stochScoreLong) + " " getStochText(true), text_color=stochBarColorLbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // VOLUME
        
    table.cell(analysisTable04"HACIM"text_color=colTextbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    volBarColor volScore >= 60 colLong colGray
        table
    .cell(analysisTable14getAsciiBar(volScore) + " " getVolText(), text_color=volBarColorbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // TREND
        
    table.cell(analysisTable05"TREND"text_color=colTextbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    trendBarColorL trendScoreLong >= 60 colLong colGray
        table
    .cell(analysisTable15getAsciiBar(trendScoreLong) + " " getTrendText(true), text_color=trendBarColorLbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // ADX
        
    table.cell(analysisTable06"ADX"text_color=colTextbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    adxBarColor adxScore >= 60 colLong colGray
        table
    .cell(analysisTable16getAsciiBar(adxScore) + " " getAdxText(), text_color=adxBarColorbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // CONFLUENCE
        
    confLongColor confluenceLong >= minConfluence colLong colGray
        table
    .cell(analysisTable07"SONUC"text_color=colYellowbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    table.cell(analysisTable17str.tostring(confluenceLong) + " / 6"text_color=confLongColorbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // LONG STATUS
        
    longStatusText longPerfect "YAP" "BEKLE"
        
    longStatusColor longPerfect colLong colGray
        table
    .cell(analysisTable08"BOGA"text_color=colLongbgcolor=colBlacktext_size=size.normaltext_halign=text.align_center)
        
    table.cell(analysisTable18longStatusTexttext_color=longStatusColorbgcolor=colBlacktext_size=size.normaltext_halign=text.align_center)
        
        
    // ===== SHORT SECTION =====
        
    table.cell(analysisTable09"AYI "text_color=colTextbgcolor=colShorttext_size=size.normaltext_halign=text.align_left)
        
    table.cell(analysisTable19"OLASILIK " str.tostring(shortPct) + "%"text_color=colTextbgcolor=colShorttext_size=size.normaltext_halign=text.align_right)
        
        
    // MACD
        
    table.cell(analysisTable010"MACD"text_color=colTextbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    macdBarColorS macdScoreShort >= 70 colShort colGray
        table
    .cell(analysisTable110getAsciiBar(macdScoreShort) + " " getMacdText(false), text_color=macdBarColorSbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // RSI
        
    table.cell(analysisTable011"RSI"text_color=colTextbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    rsiBarColorS rsiScoreShort >= 60 colShort colGray
        table
    .cell(analysisTable111getAsciiBar(rsiScoreShort) + " " getRsiText(), text_color=rsiBarColorSbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // STOCH
        
    table.cell(analysisTable012"STCH"text_color=colTextbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    stochBarColorS stochScoreShort >= 70 colShort colGray
        table
    .cell(analysisTable112getAsciiBar(stochScoreShort) + " " getStochText(false), text_color=stochBarColorSbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // VOLUME
        
    table.cell(analysisTable013"HACIM"text_color=colTextbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    table.cell(analysisTable113getAsciiBar(volScore) + " " getVolText(), text_color=volBarColorbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // TREND
        
    table.cell(analysisTable014"TREND"text_color=colTextbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    trendBarColorS trendScoreShort >= 60 colShort colGray
        table
    .cell(analysisTable114getAsciiBar(trendScoreShort) + " " getTrendText(false), text_color=trendBarColorSbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // ADX
        
    table.cell(analysisTable015"ADX"text_color=colTextbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    adxBarColorS adxScore >= 60 colShort colGray
        table
    .cell(analysisTable115getAsciiBar(adxScore) + " " getAdxText(), text_color=adxBarColorSbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // CONFLUENCE
        
    confShortColor confluenceShort >= minConfluence colShort colGray
        table
    .cell(analysisTable016"SONUC"text_color=colYellowbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
    table.cell(analysisTable116str.tostring(confluenceShort) + " / 6"text_color=confShortColorbgcolor=colBgtext_size=size.smalltext_halign=text.align_left)
        
        
    // SHORT STATUS
        
    shortStatusText shortPerfect "YAP" "BEKLE"
        
    shortStatusColor shortPerfect colShort colGray
        table
    .cell(analysisTable017"AYI"text_color=colShortbgcolor=colBlacktext_size=size.normaltext_halign=text.align_center)
        
    table.cell(analysisTable117shortStatusTexttext_color=shortStatusColorbgcolor=colBlacktext_size=size.normaltext_halign=text.align_center)

    // ============================================================================
    // SUPERTREND LINE (No Fill - Clean Look)
    // ============================================================================

    stColor isUptrend colLong colShort
    plot
    (supertrend"STOP"color=stColorlinewidth=1)

    // ============================================================================
    // PROJECTION CANDLES
    // ============================================================================

    var line projDashLine na
    var box projZoneBox na
    var box longProjBody na
    var line longProjWickUp na
    var line longProjWickDown na
    var label longProjLabel na
    var box shortProjBody na
    var line shortProjWickUp na
    var line shortProjWickDown na
    var label shortProjLabel na

    if barstate.islast and showProjection
        line
    .delete(projDashLine)
        
    box.delete(projZoneBox)
        
    box.delete(longProjBody)
        
    line.delete(longProjWickUp)
        
    line.delete(longProjWickDown)
        
    label.delete(longProjLabel)
        
    box.delete(shortProjBody)
        
    line.delete(shortProjWickUp)
        
    line.delete(shortProjWickDown)
        
    label.delete(shortProjLabel)
        
        
    zoneTop ta.highest(high30) + atr 1.5
        zoneBottom 
    ta.lowest(low30) - atr 1.5
        
        projDashLine 
    := line.new(bar_index 1zoneTopbar_index 1zoneBottomcolor=colGraywidth=1style=line.style_dashed)
        
    projZoneBox := box.new(bar_index 1zoneTopbar_index 8zoneBottombgcolor=color.new(colFTBackground70), border_color=color.new(colFTBackground50), border_width=1)
        
        
    maxHeight atr * (bbWidth)
        
    longHeight maxHeight * (longPct 100)
        
    shortHeight maxHeight * (shortPct 100)
        
    wickLen avgBody 0.4
        
        longProjBody 
    := box.new(bar_index 3close longHeightbar_index 4closebgcolor=colLongborder_color=colLongborder_width=1)
        
    longProjWickUp := line.new(bar_index 3close longHeightbar_index 3close longHeight wickLencolor=colLongwidth=2)
        
    longProjWickDown := line.new(bar_index 3closebar_index 3close wickLencolor=colLongwidth=2)
        
    longProjLabel := label.new(bar_index 3close longHeight wickLen atr 0.15"L " str.tostring(longPct) + "%"style=label.style_label_downcolor=colLongtextcolor=colTextsize=size.normal)
        
        
    shortProjBody := box.new(bar_index 5closebar_index 6close shortHeightbgcolor=colShortborder_color=colShortborder_width=1)
        
    shortProjWickUp := line.new(bar_index 5closebar_index 5close wickLencolor=colShortwidth=2)
        
    shortProjWickDown := line.new(bar_index 5close shortHeightbar_index 5close shortHeight wickLencolor=colShortwidth=2)
        
    shortProjLabel := label.new(bar_index 5close shortHeight wickLen atr 0.15"S " str.tostring(shortPct) + "%"style=label.style_label_upcolor=colShorttextcolor=colTextsize=size.normal)

    // ============================================================================
    // BUY / SELL SIGNALS WITH LABELS
    // ============================================================================

    bullSignal ta.crossover(ema8ema21) and isUptrend
    bearSignal 
    ta.crossunder(ema8ema21) and isDowntrend

    plotshape
    (bullSignal"BUY Signal"shape.labeluplocation.belowbarcolLongtext="AL"textcolor=color.whitesize=size.small)
    plotshape(bearSignal"SELL Signal"shape.labeldownlocation.abovebarcolShorttext="SAT"textcolor=color.whitesize=size.small)

    // ============================================================================
    // ALERTS
    // ============================================================================

    alertcondition(longPerfect"LONG Perfect Time""LONG Perfect Time detected")
    alertcondition(shortPerfect"SHORT Perfect Time""SHORT Perfect Time detected")
    alertcondition(bullSignal"BUY Signal""BUY Signal detected")
    alertcondition(bearSignal"SELL Signal""SELL Signal detected")
    //////////////////////////////////////////////////
    // â”€â”€â”€ INPUTS â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
    string GRP_CALC "Calculation Settings"
    int rsiLength       input.int(14"RSI Length"minval 5maxval 30group GRP_CALC)
    int macdFast        input.int(12"MACD Fast"minval 5maxval 30group GRP_CALC)
    int macdSlow        input.int(26"MACD Slow"minval 10maxval 50group GRP_CALC)
    int macdSignal      input.int(9"MACD Signal"minval 3maxval 20group GRP_CALC)
    int adxLength       input.int(14"ADX Length"minval 5maxval 30group GRP_CALC)
    int maLength        input.int(50"MA Length"minval 20maxval 200group GRP_CALC)

    string GRP_MTF "Multi-Timeframe"
    bool useMTF         input.bool(true"Enable Multi-Timeframe"group GRP_MTF)
    string tf2          input.timeframe("60""Timeframe 2"group GRP_MTF)
    string tf3          input.timeframe("240""Timeframe 3"group GRP_MTF)
    string tf4          input.timeframe("D""Timeframe 4"group GRP_MTF)

    string GRP_VIS "Visual Settings"
    color bullColor     input.color(#00E676, "Bullish Color", group = GRP_VIS)
    color bearColor     input.color(#FF5252, "Bearish Color", group = GRP_VIS)
    color neutralColor  input.color(#9E9E9E, "Neutral Color", group = GRP_VIS)
    bool showMA         input.bool(true"Show Trend MA"group GRP_VIS)
    bool showDashboard  input.bool(true"Show Dashboard"group GRP_VIS)
    string dashPos      input.string("Top Right""Dashboard Position"
         
    options = ["Top Right""Top Left""Bottom Right""Bottom Left"], group GRP_VIS)

    // â”€â”€â”€ FUNCTIONS â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
    // Calculate ADX
    calcADX(int len) =>
        
    float trueRange math.max(high lowmath.max(math.abs(high close[1]), math.abs(low close[1])))
        
    float atr ta.rma(trueRangelen)
        
    float upMove high high[1]
        
    float downMove low[1] - low
        float plusDM 
    upMove downMove and upMove upMove 0
        float minusDM 
    downMove upMove and downMove downMove 0
        float plusDI 
    100 ta.rma(plusDMlen) / atr
        float minusDI 
    100 ta.rma(minusDMlen) / atr
        float dx 
    math.abs(plusDI minusDI) / (plusDI minusDI) * 100
        float adx 
    ta.rma(dxlen)
        [
    adxplusDIminusDI]

    // Calculate all indicators for a given timeframe
    calcTrendScore() =>
        
    // RSI Score (-1 to 1)
        
    float rsi ta.rsi(closersiLength)
        
    float rsiScore = (rsi 50) / 50
        
        
    // MACD Score (-1 to 1)
        
    [macdLinesignalLinehistLine] = ta.macd(closemacdFastmacdSlowmacdSignal)
        
    float macdNorm ta.stdev(macdLine100)
        
    float macdScore macdNorm != math.max(-1math.min(1macdLine / (macdNorm 2))) : 0
        
        
    // ADX Score (0 to 1 for strength, direction from DI)
        
    [adxplusDIminusDI] = calcADX(adxLength)
        
    float adxStrength math.min(adx 501)
        
    float adxDir plusDI minusDI : -1
        float adxScore 
    adxStrength adxDir
        
        
    // MA Score (-1 to 1)
        
    float ma ta.sma(closemaLength)
        
    float maScore close ma : -1
        float maStrength 
    math.abs(close ma) / ma 10
        float maScoreWeighted 
    math.max(-1math.min(1maScore math.min(maStrength1)))
        
        
    // Composite Score
        
    float composite = (rsiScore 0.25 macdScore 0.25 adxScore 0.25 maScoreWeighted 0.25)
        
        [
    rsiScoremacdScoreadxScoremaScoreWeightedcompositersiadxplusDI minusDI]

    // â”€â”€â”€ CURRENT TIMEFRAME CALCULATIONS â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
    [rsiScore1macdScore1adxScore1maScore1composite1rsi1adx1bullDI1] = calcTrendScore()

    // â”€â”€â”€ MULTI-TIMEFRAME CALCULATIONS â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
    [rsiScore2macdScore2adxScore2maScore2composite2rsi2adx2bullDI2] = request.security(syminfo.tickeridtf2calcTrendScore(), lookahead barmerge.lookahead_off)
    [
    rsiScore3macdScore3adxScore3maScore3composite3rsi3adx3bullDI3] = request.security(syminfo.tickeridtf3calcTrendScore(), lookahead barmerge.lookahead_off)
    [
    rsiScore4macdScore4adxScore4maScore4composite4rsi4adx4bullDI4] = request.security(syminfo.tickeridtf4calcTrendScore(), lookahead barmerge.lookahead_off)

    // Overall Multi-Timeframe Score
    float mtfScore useMTF ? (composite1 0.4 composite2 0.25 composite3 0.2 composite4 0.15) : composite1

    // Trend Direction and Strength
    bool isBullish mtfScore 0.2
    bool isBearish 
    mtfScore < -0.2
    float trendStrength 
    math.abs(mtfScore)

    // â”€â”€â”€ COLORING â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
    color trendColor mtfScore 0.2 bullColor mtfScore < -0.2 bearColor neutralColor
    color maColor 
    close ta.sma(closemaLength) ? bullColor bearColor

    // Score to color helper
    scoreToColor(float score) =>
        
    color result neutralColor
        
    if score 0.5
            result 
    := bullColor
        
    else if score 0.2
            result 
    := color.new(bullColor40)
        else if 
    score < -0.5
            result 
    := bearColor
        
    else if score < -0.2
            result 
    := color.new(bearColor40)
        
    result

    // â”€â”€â”€ PLOTTING â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
    // Trend MA
    float trendMA ta.sma(closemaLength)
    //plot(showMA ? trendMA : na, "Trend MA", maColor, 2)

    // Trend background
    //bgcolor(color.new(trendColor, 95), title = "Trend Background")

    // Trend change markers
    bool trendUp mtfScore 0.2 and mtfScore[1] <= 0.2
    bool trendDn 
    mtfScore < -0.2 and mtfScore[1] >= -0.2

    //plotshape(trendUp, "Bullish Shift", shape.triangleup, location.belowbar, bullColor, size = size.small, text = "BULL")
    //plotshape(trendDn, "Bearish Shift", shape.triangledown, location.abovebar, bearColor, size = size.small, text = "BEAR")

    // â”€â”€â”€ DASHBOARD â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
    if showDashboard and barstate.islast
        
    // Position mapping
        
    string tablePos = switch dashPos
            
    "Top Right"    => position.top_right
            
    "Top Left"     => position.top_left
            
    "Bottom Right" => position.bottom_right
            
    "Bottom Left"  => position.bottom_left
            
    => position.top_right
        
        
    var table dash table.new(tablePos66,
             
    bgcolor color.new(#1E1E1E, 5),
             
    frame_width 1,
             
    frame_color color.new(color.white70),
             
    border_width 1,
             
    border_color color.new(color.white85))
        
        
    // Header Row
        
    table.cell(dash00"Trend "text_color color.whitetext_size size.smallbgcolor color.new(#2962FF, 30))
        
    table.cell(dash10"RSI"text_color color.whitetext_size size.tinybgcolor color.new(#2962FF, 30))
        
    table.cell(dash20"MACD"text_color color.whitetext_size size.tinybgcolor color.new(#2962FF, 30))
        
    table.cell(dash30"ADX"text_color color.whitetext_size size.tinybgcolor color.new(#2962FF, 30))
        
    table.cell(dash40"MA"text_color color.whitetext_size size.tinybgcolor color.new(#2962FF, 30))
        
    table.cell(dash50"SONUC"text_color color.whitetext_size size.tinybgcolor color.new(#2962FF, 30))
        
        // Current Timeframe Row
        
    string tfLabel timeframe.period
        table
    .cell(dash01tfLabeltext_color color.whitetext_size size.tiny)
        
    table.cell(dash11str.tostring(rsi1"#"), text_color color.whitetext_size size.tinybgcolor scoreToColor(rsiScore1))
        
    table.cell(dash21macdScore1 "+" "-"text_color color.whitetext_size size.tinybgcolor scoreToColor(macdScore1))
        
    table.cell(dash31str.tostring(adx1"#"), text_color color.whitetext_size size.tinybgcolor scoreToColor(adxScore1))
        
    table.cell(dash41maScore1 "+" "-"text_color color.whitetext_size size.tinybgcolor scoreToColor(maScore1))
        
    table.cell(dash51str.tostring(composite1 100"#") + "%"text_color color.whitetext_size size.tinybgcolor scoreToColor(composite1))
        
        if 
    useMTF
            
    // TF2 Row
            
    table.cell(dash02tf2text_color color.whitetext_size size.tiny)
            
    table.cell(dash12str.tostring(rsi2"#"), text_color color.whitetext_size size.tinybgcolor scoreToColor(rsiScore2))
            
    table.cell(dash22macdScore2 "+" "-"text_color color.whitetext_size size.tinybgcolor scoreToColor(macdScore2))
            
    table.cell(dash32str.tostring(adx2"#"), text_color color.whitetext_size size.tinybgcolor scoreToColor(adxScore2))
            
    table.cell(dash42maScore2 "+" "-"text_color color.whitetext_size size.tinybgcolor scoreToColor(maScore2))
            
    table.cell(dash52str.tostring(composite2 100"#") + "%"text_color color.whitetext_size size.tinybgcolor scoreToColor(composite2))
            
            
    // TF3 Row
            
    table.cell(dash03tf3text_color color.whitetext_size size.tiny)
            
    table.cell(dash13str.tostring(rsi3"#"), text_color color.whitetext_size size.tinybgcolor scoreToColor(rsiScore3))
            
    table.cell(dash23macdScore3 "+" "-"text_color color.whitetext_size size.tinybgcolor scoreToColor(macdScore3))
            
    table.cell(dash33str.tostring(adx3"#"), text_color color.whitetext_size size.tinybgcolor scoreToColor(adxScore3))
            
    table.cell(dash43maScore3 "+" "-"text_color color.whitetext_size size.tinybgcolor scoreToColor(maScore3))
            
    table.cell(dash53str.tostring(composite3 100"#") + "%"text_color color.whitetext_size size.tinybgcolor scoreToColor(composite3))
            
            
    // TF4 Row
            
    table.cell(dash04tf4text_color color.whitetext_size size.tiny)
            
    table.cell(dash14str.tostring(rsi4"#"), text_color color.whitetext_size size.tinybgcolor scoreToColor(rsiScore4))
            
    table.cell(dash24macdScore4 "+" "-"text_color color.whitetext_size size.tinybgcolor scoreToColor(macdScore4))
            
    table.cell(dash34str.tostring(adx4"#"), text_color color.whitetext_size size.tinybgcolor scoreToColor(adxScore4))
            
    table.cell(dash44maScore4 "+" "-"text_color color.whitetext_size size.tinybgcolor scoreToColor(maScore4))
            
    table.cell(dash54str.tostring(composite4 100"#") + "%"text_color color.whitetext_size size.tinybgcolor scoreToColor(composite4))
        
        
    // Overall Score Row
        
    string overallText mtfScore 0.5 "+++BOGA" mtfScore 0.2 "BOGA" 
             
    mtfScore < -0.5 "---AYI" mtfScore < -0.2 "AYI" "NOTR"
        
    table.cell(dash05"SINYAL"text_color color.whitetext_size size.tinybgcolor color.new(trendColor30))
        
    table.merge_cells(dash1545)
        
    table.cell(dash15overallTexttext_color color.whitetext_size size.smallbgcolor color.new(trendColor30))
        
    table.cell(dash55str.tostring(mtfScore 100"#") + "%"text_color color.whitetext_size size.smallbgcolor color.new(trendColor30))

    // â”€â”€â”€ ALERTS â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
    alertcondition(trendUp"TSM Bullish Shift""Trend Strength Matrix shifted BULLISH on {{ticker}}")
    alertcondition(trendDn"TSM Bearish Shift""Trend Strength Matrix shifted BEARISH on {{ticker}}")
    alertcondition(mtfScore 0.5 and mtfScore[1] <= 0.5"TSM Strong Bull""Strong bullish trend confirmed on {{ticker}}")
    alertcondition(mtfScore < -0.5 and mtfScore[1] >= -0.5"TSM Strong Bear""Strong bearish trend confirmed on {{ticker}}")
    ///////////////////////////////////// 
    scalping
    16.07.2024 - 10.12.2024

  3. background renklendirme sar zone ile
    PHP Code:
    // © OmegaTools

    //@version=6
    indicator('Parabolic SAR Zone'overlay true)

    start88 input.float(0.'Starting value')
    inc88 input.float(0.01'Increment')
    max88 input.float(0.09'Max Value')
    width input.float(5.00'Zone width')

    atrs ta.atr(100) * width
    sarone 
    ta.sar(start88inc88max88)
    sarzone = if close sarone
        sarone 
    atrs
    else if close sarone
        sarone 
    atrs
    sartwo 
    ta.sar(start88 2inc88 2max88 2)

    p1 plot(sarone'Gir'color close sarone #2962ff00 : #e91e6200, style = plot.style_circles)
    p3 plot(sarzone'Çık'color close sarone #2962ff00 : #e91e6200, style = plot.style_circles)
    fill(p1p3color close sarone color.new(#2962ff, 80) : color.new(#e91e63, 80))

    //plot(sartwo, 'Second SAR', color = close > sartwo ? color.new(#2962ff, 50) : color.new(#e91e63, 50), style = plot.style_linebr) 
    16.07.2024 - 10.12.2024

  4. yapay zeka ile yazdırılmış bir örnek...
    PHP Code:
    //@version=6
    indicator('.'overlay truemax_lines_count 500max_labels_count 500)
    /////////////////
    // 1. PSAR (Fiyata EN YAKIN / En Agresif)
    // Artış oranı çok yüksek (0.05) olduğu için fiyata hemen yapışır.
    start1 0.0 // İsteğiniz üzerine SIFIR
    inc1 input.float(0.05title '1. Artış (En Yakın)'step 0.01group '1. En Yakın PSAR')
    max1 input.float(0.50title '1. Limit'step 0.05group '1. En Yakın PSAR')

    // 2. PSAR (Orta Yakınlık)
    start2 0.01 // İsteğiniz üzerine SIFIR
    inc2 input.float(0.1title '2. Artış (Orta)'step 0.01group '2. Orta PSAR')
    max2 input.float(0.99title '2. Limit'step 0.05group '2. Orta PSAR')

    // 3. PSAR (Nispeten Daha Uzak ama Standarttan Yakın)
    start3 0. // İsteğiniz üzerine SIFIR
    inc3 input.float(0.1title '3. Artış (Uzak)'step 0.01group '3. Uzak PSAR')
    max3 input.float(0.99title '3. Limit'step 0.05group '3. Uzak PSAR')

    // 4. PSAR (Nispeten Daha Uzak ama Standarttan Yakın)
    start33 0. // İsteğiniz üzerine SIFIR
    inc33 input.float(0.01title '3. Artış (Uzak)'step 0.01group '3. Uzak PSAR')
    max33 input.float(0.99title '3. Limit'step 0.05group '3. Uzak PSAR')

    // --- HESAPLAMALAR ---
    psar1 ta.sar(start1inc1max1)
    psar2 ta.sar(start2inc2max2)
    psar3 ta.sar(start3inc3max3)

    psar33 ta.sar(start33inc33max33)

    /////
    // Define colors for bullish and bearish conditions
    GreenFluorescent color.rgb(02550)
    RedFluorescent color.rgb(25500)

    plot(psar1"3",style plot.style_crosscolor close psar1 GreenFluorescent close psar1 RedFluorescent na)
    plot(psar2,"1"style plot.style_crosscolor close psar2 GreenFluorescent close psar2 RedFluorescent na)
    plot(psar3,"2"style plot.style_crosscolor close psar3 GreenFluorescent close psar3 RedFluorescent na)
    plot(psar33,"4"style plot.style_crosscolor close psar33 GreenFluorescent close psar33 RedFluorescent na)
    ///////////////////////////
    h=(psar1+psar2+psar3+psar33)/4
    plot
    (h,"0"style plot.style_steplinecolor close color.yellow close color.fuchsia na)
    ///////////////////////// 
    16.07.2024 - 10.12.2024

  5. PHP Code:
    // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © ChartPrime

    //@version=6
    indicator('Pivot Trend [ChartPrime]'overlay true)

    // 𝙐𝙎𝙀𝙍 𝙄𝙉𝙋𝙐𝙏𝙎
    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)

    // 🅢 🅑 
    pivot için... sadece sinyalli örnek
    16.07.2024 - 10.12.2024

  6. PHP Code:
    //@version=6
    indicator(title '..'shorttitle '.'overlay trueformat format.priceprecision 4)

    i_period input.int(100title 'Length'minval 2group 'general setting'inline '11')
    i_showLabels input.bool(truetitle 'Show labels'group 'general setting'inline '11')

    i_lineCount input.int(3'Line count'group 'line setting'inline '12')
    i_extendLines input.bool(true'Extend lines'group 'line setting'inline '12')
    i_lineThickness input.int(1'Line thickness'minval 1group 'line setting'inline '13')
    i_lineStyle input.string(line.style_dotted'Line style'options = [line.style_dottedline.style_solidline.style_dashed], group 'line setting'inline '13')
    i_crossoverColor input.color(color.yellow'Crossover color'group 'line setting'inline '14')
    i_crossunderColor input.color(color.aqua'Bottom color'group 'line setting'inline '14')

    var 
    lineArray = array.new_line()

    var 
    labelArray = array.new_label()

    f_drawLine(_x1_x2_yValue_lineColor_lineThickness_lineStyle) =>
        
    line.new(x1 _x1y1 _yValuex2 _x2y2 _yValuecolor _lineColorstyle _lineStylewidth _lineThickness)

    f_drawLabel(_x_y_textColor) =>
        
    label.new(_x_y'         ' str.tostring(_y), xloc.bar_indexyloc.price#00000000, label.style_none, _textColor)

    f_extendArray(_lineArray_labelArray_extendLines) =>
        if array.
    size(_lineArray) > 0
            
    for _i = array.size(_lineArray) - 1 to 0 by 1

                x2 
    line.get_x2(array.get(_lineArray_i))
                
    yValue line.get_y1(array.get(_lineArray_i))

                if 
    _extendLines or bar_index == x2 and not(high yValue and low yValue)
                    if 
    i_showLabels
                        label
    .set_x(array.get(_labelArray_i), bar_index)
                    
    line.set_x2(array.get(_lineArray_i), bar_index)


    f_drawLineAndLabel(_x1_x2_yValue_colorLine_lineCount_lineThickness_lineStyle_array_labelArray) =>
        
    line l f_drawLine(_x1_x2_yValue_colorLine_lineThickness_lineStyle)

        if 
    i_showLabels
            label lab 
    f_drawLabel(_x2_yValue_colorLine)
            if array.
    size(_labelArray) == _lineCount
                label
    .delete(array.shift(_labelArray))

            array.
    push(_labelArraylab)

        if array.
    size(_array) == _lineCount
            line
    .delete(array.shift(_array))

        array.
    push(_arrayl)

    f_tema(_source_lenght) =>
        
    ema01 ta.ema(_source_lenght)
        
    ema02 ta.ema(ema01_lenght)
        
    ema03 ta.ema(ema02_lenght)
        
    output * (ema01 ema02) + ema03
        output

    vmp 
    math.sum(math.abs(high low[1]), i_period)
    vmm math.sum(math.abs(low high[1]), i_period)
    str math.sum(ta.atr(1), i_period)
    vip f_tema(vmp stri_period)
    vim f_tema(vmm stri_period)


    hasCrossedUnder ta.crossunder(vipvim)
    hasCrossedOver ta.crossover(vipvim)


    if 
    hasCrossedUnder

        float yValue 
    low
        int x1 
    bar_index
        int x2 
    bar_index

        alert
    ('Has crossunder'alert.freq_once_per_bar_close)
        
    f_drawLineAndLabel(x1x2yValuei_crossunderColori_lineCounti_lineThicknessi_lineStylelineArraylabelArray)

    if 
    hasCrossedOver

        float yValue 
    high
        int x1 
    bar_index
        int x2 
    bar_index

        alert
    ('Has crossover'alert.freq_once_per_bar_close)
        
    f_drawLineAndLabel(x1x2yValuei_crossoverColori_lineCounti_lineThicknessi_lineStylelineArraylabelArray)

    f_extendArray(lineArraylabelArrayi_extendLines)
    ///////////////////////// 
    16.07.2024 - 10.12.2024

  7. atrli kanallı scalping deneme örneği....
    PHP Code:
    // This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © BackQuant

    //@version=6
    indicator("."overlay=true)

    // Constants
    const string calc   "Core Calculation Settings" 
    const string thres  "Signals Settings"
    const string ui     "Plotting and Coloring"
    const color  GREEN  #eeff00
    const color  RED    #001eff

    // Inputs
    int   calc_p        input.int(3"Average True Range Period"group=calc)
    float atr_factor    input.float(0.3"Factor"step 0.1group=calc)
    int   start         input.int(1"For Loop Start"inline="FL"group=calc)
    int   end           input.int(4"End",maxval 50inline="FL"group=calc)

    bool  show_refs     input.bool(false"Show Reference Lines"group=thres)
    bool  showls        input.bool(true"Show Long and Short Signals On Chart?"group=thres)
    int   thresL        input.int(3"Long Threshold"group=thresinline=thres)
    int   thresS        input.int(-3"Short Threshold"group=thresinline=thres)

    color longcol       input.color(GREEN"Long Color"group=ui)
    color shortcol      input.color(RED"Short Color"group=ui)
    int   lineW         input.int(4"Line Width"group=ui)
    bool  onchart       input.bool(true"Show On Chart?"group=ui)
    bool  paintCandles  input.bool(false"Paint Candles to Trend?"group=ui)
    bool  bgCol         input.bool(false"Background Color?"group=ui)

    method transp(color xint t) =>
        
    color.new(xt)

    // Types
    type tCalc
        float atr
        float band
        float trail
        float up
        float dn
        float score

    type tCond
        bool longCond
        bool shortCond

    type tState
        int signal

    var tCalc  c  tCalc.new(nananananana)
    var 
    tCond  cd tCond.new(falsefalse)
    var 
    tState st tState.new(1)
    var 
    color coloring na 
    float scoreS 
    0.0

    // Core calcs 
    c.atr  := ta.atr(calc_p)
    c.band := c.atr atr_factor

    var float trailS na
    trailS 
    := close
    trailS 
    := nz(trailS[1], trailS)

    c.up := close c.band
    c
    .dn := close c.band

    if c.dn trailS
        trailS 
    := c.dn
    if c.up trailS
        trailS 
    := c.up

    c
    .trail := trailS

    for start to end by 1
        scoreS 
    += (trailS trailS[i] ? : -1)
        
    scoreS

    c
    .score := scoreS

    cd
    .longCond  := c.score thresL
    cd
    .shortCond := ta.crossunder(c.scorethresS)


    if 
    cd.longCond and not cd.shortCond
        st
    .signal := 1
        coloring 
    := longcol
    else if cd.shortCond
        st
    .signal := -1
        coloring 
    := shortcol

    //plot(c.score, "", coloring, lineW)
    plot(c.trail"ATR"coloringlineWplot.style_circlesfalseforce_overlay truedisplay onchart?display.all:display.none)

    if 
    barstate.islast and show_refs
        line
    .new(x1=last_bar_indexx2=bar_index 1y1=thresLy2=thresLcolor=chart.fg_color.transp(50), style=line.style_dashedextend=extend.right)
        
    line.new(x1=last_bar_indexx2=bar_index 1y1=thresSy2=thresScolor=chart.fg_color.transp(50), style=line.style_dashedextend=extend.right)

    // Long and Short Signals 
    //plotcandle(open, high, low, close, "Mum",
         //coloring, coloring, true,
         //bordercolor=coloring,
         //display=paintCandles ? display.all : display.none, force_overlay=true)

    //bgcolor(bgCol?coloring.transp(80):na, force_overlay=true)

    int sigS st.signal
    plotshape
    (sigS == and sigS[1] == -1"Long Signal"shape.triangleuplocation.belowbarlongcol0"𝕃"longcoltruesize.smalldisplay=showls display.all display.noneforce_overlay=true)
    plotshape(sigS == -and sigS[1] == 1"Short Signal"shape.triangledownlocation.abovebarshortcol0"𝕊"shortcoltruesize.smalldisplay=showls display.all display.noneforce_overlay=true)
    /////////////////////////////////////////////////////////////// © BackQuant ///////////////////////////////////////////////////////////////

    // PMI_LA Indicator Parameters
    sm input(4title 'PMI_LA Smoothing Period')
    cd99 input(0.4title 'PMI_LA Constant D')
    cd1 input(-0.6title 'PMI_LA Constant D')
    cd12 input(1.4title 'PMI_LA Constant D')
    ebc input(falsetitle 'PMI_LA Color Bars')
    ribm input(falsetitle 'PMI_LA Ribbon Mode')

    // Buy Sell Indicator Parameters
    input(2title 'BSI Multiplier')
    c99 input(30title 'BSI ATR Period')
    input(falsetitle 'BSI Heikin Ashi Candles')

    // PMI_LA Calculation
    var float i1 na
    var float i2 na
    var float i3 na
    var float i4 na
    var float i5 na
    var float i6 na
    var float bfr na
    var float bfr1 na
    var float bfr12 na
    var color bfrC na
    var color bfrC1 na
    var color bfrC12 na
    var float di na
    var float c1 na
    var float c2 na
    var float c3 na
    var float c33 na
    var float c333 na
    var float c4 na
    var float c44 na
    var float c444 na
    var float c5 na
    var float c55 na
    var float c555 na

    src_pmi 
    close
    di 
    := (sm 1.0) / 2.0 1.0
    c1 
    := / (di 1.0)
    c2 := c1
    c3 
    := 3.0 * (cd99 cd99 cd99 cd99 cd99)
    c33 := 3.0 * (cd1 cd1cd1 cd1 cd1)
    c333 := 3.0 * (cd12 cd12cd12 cd12 cd12)
    c4 := -3.0 * (2.0 cd99 cd99 cd99 cd99 cd99 cd99)
    c44 := -3.0 * (2.0 cd1 cd1 cd1 cd1 cd1 cd1)
    c444 := -3.0 * (2.0 cd12 cd12 cd12 cd12 cd12 cd12)
    c5 := 3.0 cd99 1.0 cd99 cd99 cd99 3.0 cd99 cd99
    c55 
    := 3.0 cd1 1.0 cd1 cd1 cd1 3.0 cd1 cd1
    c555 
    := 3.0 cd12 1.0 cd12 cd12 cd12 3.0 cd12 cd12
    i1 
    := c1 src_pmi c2 nz(i1[1])
    i2 := c1 i1 c2 nz(i2[1])
    i3 := c1 i2 c2 nz(i3[1])
    i4 := c1 i3 c2 nz(i4[1])
    i5 := c1 i4 c2 nz(i5[1])
    i6 := c1 i5 c2 nz(i6[1])
    bfr := -cd99 cd99 cd99 i6 c3 i5 c4 i4 c5 i3
    bfr1 
    := -cd1 cd1 cd1 i6 c33 i5 c44 i4 c55 i3
    bfr12 
    := -cd12 cd12 cd12 i6 c333 i5 c444 i4 c555 i3
    bfrC 
    := bfr nz(bfr[1]) ? color.green bfr nz(bfr[1]) ? color.red color.blue
    bfrC1 
    := bfr1 nz(bfr1[1]) ? color.green bfr1 nz(bfr1[1]) ? color.red color.blue
    bfrC12 
    := bfr12 nz(bfr12[1]) ? color.green bfr12 nz(bfr12[1]) ? color.red color.blue

    // Buy Sell Indicator Calculation
    xATR ta.atr(c99)
    nLoss xATR
    src_bsi 
    request.security(ticker.heikinashi(syminfo.tickerid), timeframe.periodcloselookahead barmerge.lookahead_off) : close
    var float xATRTrailingStop na
    iff_1 
    src_bsi nz(xATRTrailingStop[1], 0) ? src_bsi nLoss src_bsi nLoss
    iff_2 
    src_bsi nz(xATRTrailingStop[1], 0) and src_bsi[1] < nz(xATRTrailingStop[1], 0) ? math.min(nz(xATRTrailingStop[1]), src_bsi nLoss) : iff_1
    xATRTrailingStop 
    := src_bsi nz(xATRTrailingStop[1], 0) and src_bsi[1] > nz(xATRTrailingStop[1], 0) ? math.max(nz(xATRTrailingStop[1]), src_bsi nLoss) : iff_2
    var int pos na
    pos 
    := src_bsi[1] < nz(xATRTrailingStop[1], 0) and src_bsi nz(xATRTrailingStop[1], 0) ? src_bsi[1] > nz(xATRTrailingStop[1], 0) and src_bsi nz(xATRTrailingStop[1], 0) ? -nz(pos[1], 0)

    xcolor pos == -color.red pos == color.green color.blue
    ema 
    ta.ema(src_bsi1)
    above ta.crossover(emaxATRTrailingStop)
    below ta.crossover(xATRTrailingStopema)
    buy src_bsi xATRTrailingStop and above
    sell 
    src_bsi xATRTrailingStop and below

    // Plotting
    plot(ribm na bfrtitle '111'linewidth 4color bfrCstyle=plot.style_circles)
    plot(ribm na bfr1title '222'linewidth 4color bfrC1style=plot.style_circles)
    plot(ribm na bfr12title '000'linewidth 4color bfrC12style=plot.style_circles)
    //bgcolor(ribm ? bfrC : na)

    //plotshape(buy, title = 'Buy', text = 'Buy', style = shape.labelup, location = location.belowbar, color = color.new(color.green, 0), textcolor = color.new(color.black, 0), size = size.tiny)
    //plotshape(sell, title = 'Sell', text = 'Sell', style = shape.labeldown, location = location.abovebar, color = color.new(color.red, 0), textcolor = color.new(color.black, 0), size = size.tiny)

    //barcolor(buy ? color.green : sell ? color.red : na)

    //alertcondition(buy, 'Purra Long', 'Purra Long')
    //alertcondition(sell, 'Purra Short', 'Purra Short') 
    16.07.2024 - 10.12.2024

  8. güzel bir pattern tarama kodu... yedekte kalsın.... üzerinde sadeleme yapılsın....
    https://www.tradingview.com/x/Uk5jMEIU/ diğerlerine benzemiyor.... hesaplamalar farklı.... vakit bulunca düzenlemek lazım.

    PHP Code:
    //@version=6
    // The_lurker Fawaz Al-Enezi Ùواز Ø§Ù„عنزي

    indicator("Smart Wedge Pattern [The_lurker]"overlay=truemax_lines_count=500max_labels_count=500max_polylines_count=100max_boxes_count=100)

    // LANGUAGE SETTINGS | Ø¥Ø¹Ø¯Ø§Ø¯Ø§Øª Ø§Ù„لغة

    string g_lang "�� Language | Ø§Ù„لغة"
    string i_lang input.string("English""Interface Language | Ù„غة Ø§Ù„واجهة"options=["English""العربية"], group=g_langtooltip="Select display language\nاختر Ù„غة Ø§Ù„عرض")
    bool isAr i_lang == "العربية"

    // PATTERN SELECTION | Ø§Ø®ØªÙŠØ§Ø± Ø§Ù„أنماط

    string g_patterns "�� Pattern Selection | Ø§Ø®ØªÙŠØ§Ø± Ø§Ù„أنماط"
    bool i_show_falling input.bool(true"Falling Wedge | Ø§Ù„وتد Ø§Ù„هابط"group=g_patternstooltip="Bullish reversal pattern\nنموذج Ø§Ù†Ø¹ÙƒØ§Ø³ÙŠ ØµØ¹ÙˆØ¯ÙŠ")
    bool i_show_rising  input.bool(true"Rising Wedge | Ø§Ù„وتد Ø§Ù„صاعد"group=g_patternstooltip="Bearish reversal pattern\nنموذج Ø§Ù†Ø¹ÙƒØ§Ø³ÙŠ Ù‡Ø¨ÙˆØ·ÙŠ")

    // PIVOT SYSTEM | Ù†Ø¸Ø§Ù… Ø§Ù„Ù…Ø*اور

    string g_pivot "�� Pivot System | Ù†Ø¸Ø§Ù… Ø§Ù„Ù…Ø*اور"
    int i_pivot_min  input.int(5"Min Left Bars | Ø§Ù„Ø*د Ø§Ù„أدنى"minval=3maxval=15group=g_pivottooltip="Minimum bars for pivot detection\nالØ*د Ø§Ù„أدنى Ù„شموع Ø§ÙƒØªØ´Ø§Ù Ø§Ù„Ù…Ø*ور")
    int i_pivot_max  input.int(15"Max Left Bars | Ø§Ù„Ø*د Ø§Ù„أقصى"minval=10maxval=30group=g_pivottooltip="Maximum bars for pivot detection\nالØ*د Ø§Ù„أقصى Ù„شموع Ø§ÙƒØªØ´Ø§Ù Ø§Ù„Ù…Ø*ور")
    int i_right_bars input.int(2"Right Confirm | Ø´Ù…وع Ø§Ù„تأكيد"minval=1maxval=5group=g_pivottooltip="Bars to confirm pivot\nعدد Ø§Ù„شموع Ù„تأكيد Ø§Ù„Ù…Ø*ور")

    // DETECTION RULES | Ù‚واعد Ø§Ù„كشÙ

    string g_rules "✓ Detection Rules | Ù‚واعد Ø§Ù„كشÙ"
    int   i_min_bars    input.int(5"Min Bars Between Points | Ø£Ù‚Ù„ Ù…Ø³Ø§ÙØ© Ø¨ÙŠÙ† Ø§Ù„نقاط"minval=2maxval=20group=g_rulestooltip="Minimum bars between P1-P2-P3-P4\nالØ*د Ø§Ù„أدنى Ù„لشموع Ø¨ÙŠÙ† Ø§Ù„نقاط")
    int   i_min_width   input.int(20"Min Pattern Width | Ø¹Ø±Ø¶ Ø§Ù„نموذج Ø§Ù„أدنى"minval=10maxval=100group=g_rulestooltip="Minimum width from P1 to P4\nالØ*د Ø§Ù„أدنى Ù„عرض Ø§Ù„نموذج")
    int   i_max_width   input.int(200"Max Pattern Width | Ø¹Ø±Ø¶ Ø§Ù„نموذج Ø§Ù„أقصى"minval=50maxval=300group=g_rulestooltip="Maximum width from P1 to P4\nالØ*د Ø§Ù„أقصى Ù„عرض Ø§Ù„نموذج")
    int   i_lookback    input.int(100"Lookback Bars | Ø´Ù…وع Ø§Ù„مراجعة"minval=50maxval=300group=g_rulestooltip="How far back to search for pivots\nعدد Ø§Ù„شموع Ù„لبØ*Ø« Ø¹Ù† Ø§Ù„Ù…Ø*اور")
    float i_convergence input.float(0.75"Convergence Ratio | Ù†Ø³Ø¨Ø© Ø§Ù„تقارب"minval=0.5maxval=0.95step=0.05group=g_rulestooltip="Max ratio of end gap to start gap\nأقصى Ù†Ø³Ø¨Ø© Ù„Ù„ÙØ¬ÙˆØ© Ø§Ù„نهائية Ù…Ù† Ø§Ù„بداية")
    int   i_max_wait    input.int(50"Max Wait Bars | Ø£Ù‚صى Ø§Ù†ØªØ¸Ø§Ø± Ù„لكسر"minval=10maxval=200group=g_rulestooltip="Cancel pattern if no breakout\nإلغاء Ø§Ù„نموذج Ø¥Ø°Ø§ Ù„Ù… ÙŠØ*دث ÙƒØ³Ø±")
    bool  i_strict_channel input.bool(false"Strict Channel | Ù‚ناة ØµØ§Ø±Ù…Ø©"group=g_rulestooltip="ON = check high/low (reject wicks)\nOFF = check close only\nÙ…ÙØ¹Ù‘Ù„ = ÙØ*ص Ø§Ù„قمة/القاع\nمعطّل = ÙØ*ص Ø§Ù„إغلاق Ùقط")
    float i_tolerance   input.float(0.1"Channel Tolerance % | Ù†Ø³Ø¨Ø© Ø§Ù„تسامØ*"minval=0.0maxval=1.0step=0.05group=g_rulestooltip="Allow small breaches in strict mode\nالسماØ* Ø¨ØªØ¬Ø§ÙˆØ²Ø§Øª ØµØºÙŠØ±Ø© ÙÙŠ Ø§Ù„وضع Ø§Ù„صارم")

    // PRIOR TREND FILTER | Ùلتر Ø§Ù„اتجاه Ø§Ù„سابق

    string g_trend "�� Prior Trend Filter | Ùلتر Ø§Ù„اتجاه Ø§Ù„سابق"
    bool  i_use_trend      input.bool(true"Enable | ØªÙعيل"group=g_trendtooltip="Require trend before pattern\nيتطلب Ø§ØªØ¬Ø§Ù‡ Ù‚بل Ø§Ù„نموذج")
    int   i_trend_len      input.int(30"Trend Length | Ø·ÙˆÙ„ Ø§Ù„اتجاه"minval=10maxval=100group=g_trendtooltip="Bars to measure prior trend\nعدد Ø§Ù„شموع Ù„قياس Ø§Ù„اتجاه Ø§Ù„سابق")
    float i_trend_strength input.float(0.5"Min Strength | Ø§Ù„Ø*د Ø§Ù„أدنى Ù„لقوة"minval=0.1maxval=2.0step=0.1group=g_trendtooltip="ATR multiplier for trend strength\nمضاع٠ATR Ù„قوة Ø§Ù„اتجاه")

    // QUALITY FILTER | Ùلتر Ø§Ù„جودة

    string g_quality "â* Quality Filter | Ùلتر Ø§Ù„جودة"
    bool  i_use_quality  input.bool(true"Enable | ØªÙعيل"group=g_qualitytooltip="Filter patterns by quality score\nتصÙية Ø§Ù„أنماط Ø*سب Ø¯Ø±Ø¬Ø© Ø§Ù„جودة")
    float i_min_quality  input.float(50.0"Min Score | Ø§Ù„Ø*د Ø§Ù„أدنى"minval=20maxval=90step=5group=g_qualitytooltip="Minimum quality score 0-100\nالØ*د Ø§Ù„أدنى Ù„درجة Ø§Ù„جودة")
    bool  i_show_quality input.bool(true"Show on Chart | Ø¹Ø±Ø¶ Ø¹Ù„Ù‰ Ø§Ù„رسم"group=g_qualitytooltip="Display quality percentage\nعرض Ù†Ø³Ø¨Ø© Ø§Ù„جودة Ø¹Ù„Ù‰ Ø§Ù„رسم")

    // TARGET SETTINGS | Ø¥Ø¹Ø¯Ø§Ø¯Ø§Øª Ø§Ù„أهداÙ

    string g_target "�� Target Settings | Ø¥Ø¹Ø¯Ø§Ø¯Ø§Øª Ø§Ù„أهداÙ"
    string i_target_mode input.string("Conservative""Target Mode | ÙˆØ¶Ø¹ Ø§Ù„هدÙ"options=["Conservative""Balanced""Aggressive"], group=g_targettooltip="Conservative=0.618, Balanced=1.0, Aggressive=1.618\nÙ…Ø*Ø§ÙØ¸=0.618ØŒ Ù…توازن=1.0ØŒ Ø¹Ø¯ÙˆØ§Ù†ÙŠ=1.618")
    float i_success_ratio input.float(0.5"Success Ratio | Ù†Ø³Ø¨Ø© Ø§Ù„نجاØ*"minval=0.1maxval=1.0step=0.1group=g_targettooltip="Min move ratio for success\nالØ*د Ø§Ù„أدنى Ù„نسبة Ø§Ù„Ø*ركة Ù„لنجاØ*")

    // 3D EFFECTS | Ø§Ù„تأثيرات Ø«Ù„اثية Ø§Ù„أبعاد

    string g_3d "�� 3D Effects | Ø§Ù„تأثيرات Ø«Ù„اثية Ø§Ù„أبعاد"
    bool  i_enable_3d       input.bool(true"Enable 3D | ØªÙعيل 3D"group=g_3dtooltip="Enable 3D rendering effect\nØªÙØ¹ÙŠÙ„ ØªØ£Ø«ÙŠØ± Ø§Ù„رسم Ø«Ù„اثي Ø§Ù„أبعاد")
    int   i_depth_bars      input.int(2"Depth Bars | Ø¹Ù…Ù‚ Ø§Ù„شموع"minval=1maxval=5group=g_3dtooltip="3D depth in bars\nعمق 3D Ø¨Ø§Ù„شموع")
    float i_depth_percent   input.float(3.0"Height % | Ù†Ø³Ø¨Ø© Ø§Ù„Ø§Ø±ØªÙØ§Ø¹"minval=1.0maxval=10.0step=0.5group=g_3dtooltip="3D height as % of pattern\nØ§Ø±ØªÙØ§Ø¹ 3D ÙƒÙ†Ø³Ø¨Ø© Ù…Ù† Ø§Ù„نموذج")
    int   i_3d_transp       input.int(55"Transparency | Ø§Ù„Ø´ÙØ§Ùية"minval=30maxval=80group=g_3dtooltip="Base transparency for 3D\nØ§Ù„Ø´ÙØ§Ùية Ø§Ù„أساسية Ù„لـ 3D")
    float i_target_zone_pct input.float(2.0"Target Zone % | Ù†Ø³Ø¨Ø© Ù…نطقة Ø§Ù„هدÙ"minval=1.0maxval=10.0step=0.5group=g_3dtooltip="Target zone height %\nنسبة Ø§Ø±ØªÙاع Ù…نطقة Ø§Ù„هدÙ")
    int   i_target_3d_depth input.int(2"Target 3D Depth | Ø¹Ù…Ù‚ Ø§Ù„هدÙ"minval=1maxval=5group=g_3dtooltip="3D depth for target zone\nعمق 3D Ù„منطقة Ø§Ù„هدÙ")

    // DISPLAY OPTIONS | Ø®ÙŠØ§Ø±Ø§Øª Ø§Ù„عرض

    string g_display "�� Display | Ø§Ù„عرض"
    bool i_show_old      input.bool(false"Previous Patterns | Ø§Ù„أنماط Ø§Ù„سابقة"group=g_displaytooltip="Show completed patterns history\nعرض ØªØ§Ø±ÙŠØ® Ø§Ù„أنماط Ø§Ù„مكتملة")
    bool i_show_old_tgt  input.bool(false"Historical Targets | Ø§Ù„أهدا٠التاريخية"group=g_displaytooltip="Show targets for old patterns\nعرض Ø£Ù‡Ø¯Ø§Ù Ø§Ù„أنماط Ø§Ù„سابقة")
    bool i_show_points   input.bool(false"Point Labels | ØªØ³Ù…يات Ø§Ù„نقاط"group=g_displaytooltip="Show 1-2-3-4 labels\nعرض ØªØ³Ù…يات 1-2-3-4")
    bool i_show_legs     input.bool(false"Pattern Legs | Ø£Ø±Ø¬Ù„ Ø§Ù„نموذج"group=g_displaytooltip="Show connecting lines\nعرض Ø§Ù„خطوط Ø§Ù„واصلة")
    bool i_log_scale     input.bool(true"Logarithmic Scale | Ù…قياس Ù„وغاريتمي"group=g_displaytooltip="Use log scale for calculations\nاستخدام Ø§Ù„مقياس Ø§Ù„لوغاريتمي")

    // COLORS | Ø§Ù„ألوان

    string g_colors "�� Colors | Ø§Ù„ألوان"
    color i_falling_color   input.color(color.new(#4CAF50, 0), "Falling Wedge | Ø§Ù„وتد Ø§Ù„هابط", group=g_colors, tooltip="Color for bullish pattern\nلون Ø§Ù„نموذج Ø§Ù„صعودي")
    color i_rising_color    input.color(color.new(#F44336, 0), "Rising Wedge | Ø§Ù„وتد Ø§Ù„صاعد", group=g_colors, tooltip="Color for bearish pattern\nلون Ø§Ù„نموذج Ø§Ù„هبوطي")
    color i_target_color    input.color(color.new(#2196F3, 0), "Target Zone | Ù…نطقة Ø§Ù„هدÙ", group=g_colors, tooltip="Color for target area\nلون Ù…نطقة Ø§Ù„هدÙ")
    color i_achieved_color  input.color(color.new(#FFD700, 0), "Target Hit | ØªØ*قق Ø§Ù„هدÙ", group=g_colors, tooltip="Color when target reached\nلون Ø¹Ù†Ø¯ ØªØ*قق Ø§Ù„هدÙ")
    color i_quality_high    input.color(color.new(#4CAF50, 0), "Quality High | Ø¬ÙˆØ¯Ø© Ø¹Ø§Ù„ية", group=g_colors, tooltip="Quality >= 70%\nالجودة >= 70%")
    color i_quality_med     input.color(color.new(#FF9800, 0), "Quality Medium | Ø¬ÙˆØ¯Ø© Ù…توسطة", group=g_colors, tooltip="Quality 50-70%\nالجودة 50-70%")
    color i_quality_low     input.color(color.new(#F44336, 0), "Quality Low | Ø¬ÙˆØ¯Ø© Ù…Ù†Ø®ÙØ¶Ø©", group=g_colors, tooltip="Quality < 50%\nالجودة < 50%")
    color i_text_color      input.color(color.new(#FFFFFF, 0), "Text Color | Ù„ون Ø§Ù„نص", group=g_colors, tooltip="Label text color\nلون Ù†Øµ Ø§Ù„تسميات")

    // DATA TYPES | Ø£Ù†ÙˆØ§Ø¹ Ø§Ù„بيانات

    type Pivot
        bool   is_high
        float  price
        int    bar_idx

    type WedgeData
        bool     is_falling
        Pivot    p1
        Pivot    p2
        Pivot    p3
        Pivot    p4
        int      u1_bar
        float    u1_price
        int      u2_bar
        float    u2_price
        int      l1_bar
        float    l1_price
        int      l2_bar
        float    l2_price
        float    quality
        float    max_height
        float    height
        bool     broken
        bool     cancelled
        bool     target_hit
        bool     success_hit
        int      breakout_bar
        float    breakout_price
        float    target_price
        float    success_level
        int      achieved_bar
        line     line_upper
        line     line_lower
        line     line_sec_upper
        line     line_sec_lower
        line     leg2
        line     leg3
        polyline poly_top_face
        polyline poly_side_face
        polyline poly_bottom_edge
        polyline fill_main
        polyline fill_secondary
        box      target_box
        polyline target_top_face
        polyline target_side_face
        line     line_target_v
        label    lbl_target_price
        label    lbl_p1
        label    lbl_p2
        label    lbl_p3
        label    lbl_p4
        label    lbl_quality
        label    lbl_name

    var float atr_fast na
    var float atr_slow na
    var float atr_14 na

    atr_fast 
    := ta.atr(10)
    atr_slow := ta.atr(50)
    atr_14   := ta.atr(14)

    // ADX CALCULATION | Ø*ساب ADX

    calc_adx(int len) =>
        
    float up ta.change(high)
        
    float dn = -ta.change(low)
        
    float plus_dm na(up) ? na : (up dn and up up 0)
        
    float minus_dm na(dn) ? na : (dn up and dn dn 0)
        
    float tr_rma ta.rma(ta.trlen)
        
    float plus_di fixnan(100 ta.rma(plus_dmlen) / tr_rma)
        
    float minus_di fixnan(100 ta.rma(minus_dmlen) / tr_rma)
        
    float dx math.abs(plus_di minus_di) / math.max(plus_di minus_di1) * 100
        ta
    .rma(dxlen)
    float adx_val calc_adx(14)

    // ADAPTIVE PIVOT SYSTEM | Ù†Ø¸Ø§Ù… Ø§Ù„Ù…Ø*اور Ø§Ù„تكيÙÙŠ

    calc_adaptive_pivot() =>
        
    float vol_score math.min(nz(atr_fast atr_slow1.0), 2.0) / 2.0
        float trend_score 
    math.min(adx_val 501.0)
        
    float atr_std ta.stdev(atr_fast20)
        
    float atr_mean ta.sma(atr_fast20)
        
    float stability_score math.min(nz(atr_std atr_mean0.5) * 21.0)
        
    float atr_pct ta.percentile_nearest_rank(atr_fast10050)
        
    float context_norm math.min(nz(atr_fast atr_pct1.0), 2.0) / 2.0
        float avg_range 
    ta.sma(high low10)
        
    float range_score math.min(nz((high low) / avg_range1.0), 2.0) / 2.0
        float final_score 
    = (vol_score 0.30) + (trend_score 0.25) + (stability_score 0.20) + (context_norm 0.15) + (range_score 0.10)
        
    math.max(i_pivot_minmath.min(i_pivot_maxi_pivot_min int((i_pivot_max i_pivot_min) * final_score)))

    // CORE FUNCTIONS | Ø§Ù„دوال Ø§Ù„أساسية

    calc_price(float p1int b1float p2int b2int target) =>
        if 
    b2 == b1 or p1 <= or p2 <= 0
            p2
        
    else if i_log_scale
            p2 
    math.exp((math.log(p2) - math.log(p1)) / (b2 b1) * (target b2))
        else
            
    p2 + (p2 p1) / (b2 b1) * (target b2)

    get_trend_data(int lookback_len) =>
        array<
    floattrend_vals = array.new<float>()
        for 
    0 to lookback_len
            int off_start 
    i_trend_len
            
    if off_start bar_index
                float price_start 
    close[off_start]
                
    float price_end close[i]
                
    float atr_at_i atr_14[i]
                
    float normalized atr_at_i ? (price_end price_start) / atr_at_i 0.0
                trend_vals
    .push(normalized)
            else
                
    trend_vals.push(0.0)
        
    trend_vals

    calc_max_height
    (int u1bfloat u1pint u2bfloat u2pint l1bfloat l1pint l2bfloat l2pint start_barint end_bar) =>
        
    float max_h 0.0
        
    for start_bar to end_bar by 5
            float u_at_b 
    calc_price(u1pu1bu2pu2bb)
            
    float l_at_b calc_price(l1pl1bl2pl2bb)
            
    float h math.abs(u_at_b l_at_b)
            if 
    max_h
                max_h 
    := h
        max_h

    calc_quality
    (float convfloat slope_ratioint widthfloat trend_strfloat max_hfloat atr) =>
        
    float conv_score = (conv) * 100
        float slope_score 
    math.max(0100 math.abs(slope_ratio 1) * 50)
        
    float width_score width >= 40 and width <= 100 100.0 width 40 width 40 100 math.max(0100 - (width 100) / 2)
        
    float trend_score math.min(math.abs(trend_str) / 21.0) * 100
        float height_score 
    math.min(max_h / (atr 3), 1.0) * 100
        
    (conv_score 0.30) + (slope_score 0.25) + (width_score 0.20) + (trend_score 0.15) + (height_score 0.10)

    get_target_mult() =>
        switch 
    i_target_mode
            
    "Conservative" => 0.618
            
    "Balanced" => 1.0
            
    => 1.618

    // 3D HELPER FUNCTIONS | Ø¯ÙˆØ§Ù„ Ù…ساعدة Ù„لـ 3D

    create_3d_face(array<chart.pointpointscolor edge_colcolor fill_col) =>
        
    polyline.new(pointsclosed=trueline_color=edge_colfill_color=fill_colline_width=1)

    method draw_wedge_3d(WedgeData thisint end_barcolor col) =>
        
    line.delete(this.line_upper)
        
    line.delete(this.line_lower)
        
    line.delete(this.line_sec_upper)
        
    line.delete(this.line_sec_lower)
        
    polyline.delete(this.poly_top_face)
        
    polyline.delete(this.poly_side_face)
        
    polyline.delete(this.poly_bottom_edge)
        
    polyline.delete(this.fill_main)
        
    polyline.delete(this.fill_secondary)
        
        
    float upper_end calc_price(this.u1_pricethis.u1_barthis.u2_pricethis.u2_barend_bar)
        
    float lower_end calc_price(this.l1_pricethis.l1_barthis.l2_pricethis.l2_barend_bar)
        
        if 
    upper_end lower_end and lower_end 0
            float depth_3d 
    this.max_height * (i_depth_percent 100)
            
    int transp i_3d_transp
            
            color line_col 
    color.new(col20)
            
    color fill_col color.new(coltransp 20)
            
    color edge_col color.new(coltransp 10)
            
    color face_col color.new(coltransp 10)
            
            
    this.line_upper := line.new(this.u1_barthis.u1_pricethis.u2_barthis.u2_pricecolor=line_colwidth=2)
            
    this.line_lower := line.new(this.l1_barthis.l1_pricethis.l2_barthis.l2_pricecolor=line_colwidth=2)
            
    this.line_sec_upper := line.new(this.u2_barthis.u2_priceend_barupper_endcolor=line_colwidth=2style=line.style_dotted)
            
    this.line_sec_lower := line.new(this.l2_barthis.l2_priceend_barlower_endcolor=line_colwidth=2style=line.style_dotted)
            
            if 
    i_enable_3d
                this
    .poly_top_face := create_3d_face(array.from(chart.point.from_index(this.u1_barthis.u1_price), chart.point.from_index(this.u1_bar i_depth_barsthis.u1_price depth_3d), chart.point.from_index(end_bar i_depth_barsupper_end depth_3d), chart.point.from_index(end_barupper_end)), edge_colface_col)
                
    this.poly_side_face := create_3d_face(array.from(chart.point.from_index(end_barupper_end), chart.point.from_index(end_bar i_depth_barsupper_end depth_3d), chart.point.from_index(end_bar i_depth_barslower_end depth_3d), chart.point.from_index(end_barlower_end)), edge_colface_col)
                
    this.poly_bottom_edge := create_3d_face(array.from(chart.point.from_index(this.l1_barthis.l1_price), chart.point.from_index(this.l1_bar i_depth_barsthis.l1_price depth_3d), chart.point.from_index(end_bar i_depth_barslower_end depth_3d), chart.point.from_index(end_barlower_end)), edge_colface_col)
            
            
    this.fill_main := polyline.new(array.from(chart.point.from_index(this.p1.bar_idxthis.p1.price), chart.point.from_index(this.p2.bar_idxthis.p2.price), chart.point.from_index(this.p4.bar_idxthis.p4.price), chart.point.from_index(this.p3.bar_idxthis.p3.price)), closed=truefill_color=fill_colline_color=na)
            
    this.fill_secondary := polyline.new(array.from(chart.point.from_index(this.u2_barthis.u2_price), chart.point.from_index(this.l2_barthis.l2_price), chart.point.from_index(end_barlower_end), chart.point.from_index(end_barupper_end)), closed=truefill_color=fill_colline_color=na)
        
    this

    // DRAW TARGET 3D | Ø±Ø³Ù… Ø§Ù„هد٠ثلاثي Ø§Ù„أبعاد

    method draw_target_3d(WedgeData thiscolor col) =>
        
    box.delete(this.target_box)
        
    polyline.delete(this.target_top_face)
        
    polyline.delete(this.target_side_face)
        
    line.delete(this.line_target_v)
        
    label.delete(this.lbl_target_price)
        
        if 
    this.broken and not na(this.breakout_bar) and not na(this.target_price)
            
    float zone_height this.height * (i_target_zone_pct 100)
            
    float zone_top this.target_price zone_height 2
            float zone_bottom 
    this.target_price zone_height 2
            int zone_right 
    this.target_hit this.achieved_bar bar_index
            float depth_3d 
    zone_height 0.5
            
            color current_col 
    this.target_hit i_achieved_color col
            int transp 
    this.target_hit 65 75
            
            this
    .target_box := box.new(this.breakout_barzone_topzone_rightzone_bottomborder_color=color.new(current_col30), border_width=1border_style=line.style_solidbgcolor=color.new(current_coltransp))
            
            if 
    i_enable_3d
                this
    .target_top_face := create_3d_face(array.from(chart.point.from_index(this.breakout_barzone_top), chart.point.from_index(this.breakout_bar i_target_3d_depthzone_top depth_3d), chart.point.from_index(zone_right i_target_3d_depthzone_top depth_3d), chart.point.from_index(zone_rightzone_top)), color.new(current_col40), color.new(current_coltransp 5))
                
    this.target_side_face := create_3d_face(array.from(chart.point.from_index(zone_rightzone_top), chart.point.from_index(zone_right i_target_3d_depthzone_top depth_3d), chart.point.from_index(zone_right i_target_3d_depthzone_bottom depth_3d), chart.point.from_index(zone_rightzone_bottom)), color.new(current_col40), color.new(current_coltransp 3))
            
            
    this.line_target_v := line.new(this.breakout_barthis.breakout_pricethis.breakout_barthis.target_pricecolor=current_colstyle=line.style_dottedwidth=2)
            
            
    string price_txt str.tostring(this.target_priceformat.mintick)
            
    string status_txt this.target_hit " âœ“" ""
            
    this.lbl_target_price := label.new(zone_right 2this.target_priceprice_txt status_txtcolor=color.new(current_col100), textcolor=current_colstyle=label.style_label_leftsize=size.small)
        
    this

    // DRAW LEGS | Ø±Ø³Ù… Ø§Ù„أرجل

    method draw_legs(WedgeData thiscolor col) =>
        
    line.delete(this.leg2)
        
    line.delete(this.leg3)
        if 
    i_show_legs
            this
    .leg2 := line.new(this.p2.bar_idxthis.p2.pricethis.p3.bar_idxthis.p3.pricecolor=color.new(col40), width=1style=line.style_dotted)
            
    this.leg3 := line.new(this.p3.bar_idxthis.p3.pricethis.p4.bar_idxthis.p4.pricecolor=color.new(col40), width=1style=line.style_dotted)
        
    this

    // DRAW POINTS & LABELS | Ø±Ø³Ù… Ø§Ù„نقاط ÙˆØ§Ù„تسميات

    method draw_points(WedgeData thiscolor col) =>
        
    label.delete(this.lbl_p1)
        
    label.delete(this.lbl_p2)
        
    label.delete(this.lbl_p3)
        
    label.delete(this.lbl_p4)
        
    label.delete(this.lbl_quality)
        
    label.delete(this.lbl_name)
        
        if 
    i_show_points
            color trans 
    color.new(col100)
            
    this.lbl_p1 := label.new(this.p1.bar_idxthis.p1.price"1"style=this.is_falling label.style_label_down label.style_label_upcolor=transtextcolor=colsize=size.normal)
            
    this.lbl_p2 := label.new(this.p2.bar_idxthis.p2.price"2"style=this.is_falling label.style_label_up label.style_label_downcolor=transtextcolor=colsize=size.normal)
            
    this.lbl_p3 := label.new(this.p3.bar_idxthis.p3.price"3"style=this.is_falling label.style_label_down label.style_label_upcolor=transtextcolor=colsize=size.normal)
            
    this.lbl_p4 := label.new(this.p4.bar_idxthis.p4.price"4"style=this.is_falling label.style_label_up label.style_label_downcolor=transtextcolor=colsize=size.normal)
        
        if 
    i_show_quality and i_use_quality
            color q_col 
    this.quality >= 70 i_quality_high this.quality >= 50 i_quality_med i_quality_low
            int mid_bar 
    = (this.p1.bar_idx this.p4.bar_idx) / 2
            float mid_price 
    = (this.p1.price this.p4.price) / 2
            this
    .lbl_quality := label.new(mid_barmid_price 0.997str.tostring(this.quality"#") + "%"color=color.new(q_col30), textcolor=i_text_colorstyle=label.style_label_centersize=size.small)
        
        
    string name this.is_falling ? (isAr "هابط" "Falling") : (isAr "صاعد" "Rising")
        
    int mid_bar = (this.u1_bar this.p4.bar_idx) / 2
        float upper_mid 
    calc_price(this.u1_pricethis.u1_barthis.u2_pricethis.u2_barmid_bar)
        
    float lower_mid calc_price(this.l1_pricethis.l1_barthis.l2_pricethis.l2_barmid_bar)
        
    float mid_price = (upper_mid lower_mid) / 2
        this
    .lbl_name := label.new(mid_barmid_pricenamecolor=color.new(col100), textcolor=color.new(i_text_color30), style=label.style_nonesize=size.large)
        
    this

    // DELETE ALL | Ø*ذ٠الكل

    method delete_all(WedgeData this) =>
        if 
    not na(this)
            
    line.delete(this.line_upper)
            
    line.delete(this.line_lower)
            
    line.delete(this.line_sec_upper)
            
    line.delete(this.line_sec_lower)
            
    line.delete(this.leg2)
            
    line.delete(this.leg3)
            
    line.delete(this.line_target_v)
            
    polyline.delete(this.poly_top_face)
            
    polyline.delete(this.poly_side_face)
            
    polyline.delete(this.poly_bottom_edge)
            
    polyline.delete(this.fill_main)
            
    polyline.delete(this.fill_secondary)
            
    polyline.delete(this.target_top_face)
            
    polyline.delete(this.target_side_face)
            
    box.delete(this.target_box)
            
    label.delete(this.lbl_p1)
            
    label.delete(this.lbl_p2)
            
    label.delete(this.lbl_p3)
            
    label.delete(this.lbl_p4)
            
    label.delete(this.lbl_quality)
            
    label.delete(this.lbl_name)
            
    label.delete(this.lbl_target_price)

    method delete_targets(WedgeData this) =>
        if 
    not na(this)
            
    line.delete(this.line_target_v)
            
    polyline.delete(this.target_top_face)
            
    polyline.delete(this.target_side_face)
            
    box.delete(this.target_box)
            
    label.delete(this.lbl_target_price)
            
    this.line_target_v := na
            this
    .target_top_face := na
            this
    .target_side_face := na
            this
    .target_box := na
            this
    .lbl_target_price := na

    // GLOBAL VARIABLES | Ø§Ù„متغيرات Ø§Ù„عامة

    var array<Pivotpivots = array.new<Pivot>()
    var array<
    WedgeDatapatterns = array.new<WedgeData>()
    var 
    WedgeData active_fall na
    var WedgeData active_rise na
    var WedgeData last_broken_fall na
    var WedgeData last_broken_rise na
    var bool fall_brk false
    var bool rise_brk false

    int eff_left 
    calc_adaptive_pivot()
    array<
    floattrend_data get_trend_data(i_lookback)

    // COLLECT PIVOTS | Ø¬Ù…ع Ø§Ù„Ù…Ø*اور

    float ph ta.pivothigh(higheff_lefti_right_bars)
    float pl ta.pivotlow(loweff_lefti_right_bars)
    int pbar bar_index i_right_bars

    if not na(ph)
        
    pivots.push(Pivot.new(truephpbar))
    if 
    not na(pl)
        
    pivots.push(Pivot.new(falseplpbar))

    while 
    pivots.size() > and bar_index pivots.first().bar_idx i_lookback
        pivots
    .shift()

    // VALIDATION FUNCTIONS | Ø¯ÙˆØ§Ù„ Ø§Ù„تØ*قق

    is_extreme_fast(int sint efloat refbool check_high, array<Pivotarr) =>
        
    bool ok true
        int n 
    arr.size()
        for 
    0 to n 1
            Pivot p 
    arr.get(i)
            if 
    p.bar_idx <= or p.bar_idx >= e
                
    continue
            if 
    p.is_high == check_high
                
    if (check_high and p.price ref) or (not check_high and p.price ref)
                    
    ok := false
                    
    break
        
    ok

    check_channel
    (int u1bfloat u1pint u2bfloat u2pint l1bfloat l1pint l2bfloat l2pint start_bint end_b) =>
        
    bool ok true
        
    for start_b to end_b
            int off 
    bar_index b
            
    if off >= and off bar_index
                float u 
    calc_price(u1pu1bu2pu2bb)
                
    float l calc_price(l1pl1bl2pl2bb)
                if 
    close[off] > or close[off] < l
                    ok 
    := false
                    
    break
        
    ok

    check_channel_strict
    (int u1bfloat u1pint u2bfloat u2pint l1bfloat l1pint l2bfloat l2pint start_bint end_b) =>
        
    bool ok true
        float d 
    i_tolerance 100.0
        
    for start_b to end_b
            int off 
    bar_index b
            
    if off >= and off bar_index and not na(high[off]) and not na(low[off])
                
    float u calc_price(u1pu1bu2pu2bb)
                
    float l calc_price(l1pl1bl2pl2bb)
                if 
    high[off] > * (d) or low[off] < * (d)
                    
    ok := false
                    
    break
        
    ok

    check_after_p4
    (int u1bfloat u1pint u2bfloat u2pint l1bfloat l1pint l2bfloat l2pint p4_barfloat p4_pricebool is_fall) =>
        
    bool ok true
        
    if p4_bar bar_index
            
    for p4_bar 1 to bar_index
                int off 
    bar_index b
                
    if off >= and off bar_index and not na(close[off])
                    
    float u calc_price(u1pu1bu2pu2bb)
                    
    float l calc_price(l1pl1bl2pl2bb)
                    if 
    is_fall
                        
    if close[off] < or close[off] < p4_price
                            ok 
    := false
                            
    break
                    else
                        if 
    close[off] > or close[off] > p4_price
                            ok 
    := false
                            
    break
        
    ok

    check_trend_from_data
    (int p1_barbool need_bullish, array<floatdata) =>
        if 
    not i_use_trend
            true
        
    else
            
    int off_p1 bar_index p1_bar
            
    if off_p1 >= and off_p1 data.size()
                
    float trend_val data.get(off_p1)
                
    need_bullish trend_val >= i_trend_strength trend_val <= -i_trend_strength
            
    else
                
    false

    // FIND WEDGE | Ø§Ù„بØ*Ø« Ø¹Ù† Ø§Ù„وتد

    find_wedge(bool is_fall, array<floatt_data) =>
        
    WedgeData result na
        float best_quality 
    0.0
        int n 
    pivots.size()
        
        if 
    >= 4
            
    array<inthighs = array.new<int>()
            array<
    intlows = array.new<int>()
            for 
    0 to n 1
                
    if pivots.get(i).is_high
                    highs
    .push(i)
                else
                    
    lows.push(i)
            
            array<
    intp1_p3_arr is_fall highs lows
            
    array<intp2_p4_arr is_fall lows highs
            
            int n13 
    p1_p3_arr.size()
            
    int n24 p2_p4_arr.size()
            
            if 
    n13 >= and n24 >= 2
                
    for i4_idx n24 1 to 1
                    int i4 
    p2_p4_arr.get(i4_idx)
                    
    Pivot p4 pivots.get(i4)
                    
                    for 
    i3_idx n13 1 to 1
                        int i3 
    p1_p3_arr.get(i3_idx)
                        if 
    i3 >= i4
                            
    continue
                        
    Pivot p3 pivots.get(i3)
                        if 
    p4.bar_idx p3.bar_idx i_min_bars
                            
    continue
                        
                        for 
    i2_idx i4_idx 1 to 0
                            int i2 
    p2_p4_arr.get(i2_idx)
                            if 
    i2 >= i3
                                
    continue
                            
    Pivot p2 pivots.get(i2)
                            if 
    p3.bar_idx p2.bar_idx i_min_bars
                                
    continue
                            if 
    is_fall p2.price <= p4.price p2.price >= p4.price
                                
    continue
                            
                            for 
    i1_idx i3_idx 1 to 0
                                int i1 
    p1_p3_arr.get(i1_idx)
                                if 
    i1 >= i2
                                    
    continue
                                
    Pivot p1 pivots.get(i1)
                                if 
    p2.bar_idx p1.bar_idx i_min_bars
                                    
    continue
                                if 
    is_fall p1.price <= p3.price p1.price >= p3.price
                                    
    continue
                                
                                
    int width p4.bar_idx p1.bar_idx
                                
    if width i_min_width or width i_max_width
                                    
    continue
                                
                                if 
    not check_trend_from_data(p1.bar_idxis_fallt_data)
                                    continue
                                
                                
    int u1b is_fall p1.bar_idx p2.bar_idx
                                float u1p 
    is_fall p1.price p2.price
                                int u2b 
    is_fall p3.bar_idx p4.bar_idx
                                float u2p 
    is_fall p3.price p4.price
                                int l1b 
    is_fall p2.bar_idx p1.bar_idx
                                float l1p 
    is_fall p2.price p1.price
                                int l2b 
    is_fall p4.bar_idx p3.bar_idx
                                float l2p 
    is_fall p4.price p3.price
                                
                                float u_sl 
    = (u2p u1p) / (u2b u1b)
                                
    float l_sl = (l2p l1p) / (l2b l1b)
                                
                                if (
    is_fall and (u_sl >= or l_sl >= or u_sl >= l_sl)) or (not is_fall and (u_sl <= or l_sl <= or l_sl <= u_sl))
                                    continue
                                
                                
    float gap_s is_fall p1.price - (l1p l_sl * (p1.bar_idx l1b)) : (u1p u_sl * (p1.bar_idx u1b)) - p1.price
                                float gap_e 
    is_fall ? (u1p u_sl * (p4.bar_idx u1b)) - p4.price p4.price - (l1p l_sl * (p4.bar_idx l1b))
                                
                                if 
    gap_s <= or gap_e <= or gap_e >= gap_s
                                    
    continue
                                
                                
    float conv gap_e gap_s
                                
    if conv >= i_convergence
                                    
    continue
                                
                                if 
    not is_extreme_fast(p1.bar_idxp4.bar_idxis_fall p1.price p4.pricetruepivots)
                                    continue
                                if 
    not is_extreme_fast(p1.bar_idxp4.bar_idxis_fall p4.price p1.pricefalsepivots)
                                    continue
                                
                                
    bool channel_ok i_strict_channel check_channel_strict(u1bu1pu2bu2pl1bl1pl2bl2pp1.bar_idxp4.bar_idx) : check_channel(u1bu1pu2bu2pl1bl1pl2bl2pp1.bar_idxp4.bar_idx)
                                if 
    not channel_ok
                                    
    continue
                                
                                if 
    not check_after_p4(u1bu1pu2bu2pl1bl1pl2bl2pp4.bar_idxp4.priceis_fall)
                                    continue
                                
                                
    float max_h calc_max_height(u1bu1pu2bu2pl1bl1pl2bl2pp1.bar_idxp4.bar_idx)
                                
    int off_p1 bar_index p1.bar_idx
                                float trend_str 
    off_p1 >= and off_p1 t_data.size() ? t_data.get(off_p1) : 0.0
                                float slope_ratio 
    math.abs(u_sl) > math.abs(l_sl u_sl) : 1.0
                                float quality 
    calc_quality(convslope_ratiowidthtrend_strmax_hatr_14)
                                
                                if 
    i_use_quality and quality i_min_quality
                                    
    continue
                                
                                if 
    quality best_quality
                                    best_quality 
    := quality
                                    float pat_height 
    math.abs(p1.price p4.price)
                                    
    result := WedgeData.new(is_fallp1p2p3p4u1bu1pu2bu2pl1bl1pl2bl2pqualitymax_hpat_heightfalsefalsefalsefalsenanananananananananananananananananananananananananana)
        
    result

    // PROCESS PATTERN | Ù…عالجة Ø§Ù„نمط

    process(WedgeData activeWedgeData new_patcolor colbool is_fall) =>
        
    WedgeData result active
        WedgeData to_archive 
    na
        
    if not na(new_pat)
            
    bool dom not na(active) and (new_pat.p4.bar_idx == active.p4.bar_idx or (not (new_pat.p4.bar_idx active.p1.bar_idx or new_pat.p1.bar_idx active.p4.bar_idx) and new_pat.p4.bar_idx new_pat.p1.bar_idx <= active.p4.bar_idx active.p1.bar_idx))
            if 
    not dom
                
    if not na(active)
                    
    bool overlap not (new_pat.p4.bar_idx active.p1.bar_idx or new_pat.p1.bar_idx active.p4.bar_idx)
                    if 
    not overlap and active.broken
                        to_archive 
    := active
                    
    else
                        
    active.delete_all()
                
    result := new_pat
                result
    .draw_wedge_3d(bar_indexcol).draw_legs(col).draw_points(col)
        [
    resultto_archive]

    // PATTERN LIFECYCLE | Ø¯ÙˆØ±Ø© Ø*ياة Ø§Ù„نمط

    lifecycle(WedgeData patcolor col) =>
        
    WedgeData result pat
        bool brk_sig 
    false
        
    if not na(pat) and not pat.broken and not pat.cancelled
            int bars 
    bar_index pat.p4.bar_idx
            float u 
    calc_price(pat.u1_pricepat.u1_barpat.u2_pricepat.u2_barbar_index)
            
    float l calc_price(pat.l1_pricepat.l1_barpat.l2_pricepat.l2_barbar_index)
            
            
    bool brk pat.is_falling close close l
            bool cancel_line 
    pat.is_falling close close u
            bool cancel_p4 
    pat.is_falling close pat.p4.price close pat.p4.price
            bool cancel 
    cancel_line or cancel_p4 or bars i_max_wait
            
            
    if brk and barstate.isconfirmed
                pat
    .broken := true
                pat
    .breakout_bar := bar_index
                pat
    .breakout_price := pat.is_falling l
                pat
    .success_level := pat.is_falling pat.breakout_price pat.height i_success_ratio pat.breakout_price pat.height i_success_ratio
                pat
    .target_price := pat.is_falling pat.breakout_price pat.height get_target_mult() : pat.breakout_price pat.height get_target_mult()
                
    pat.draw_wedge_3d(bar_indexcol).draw_target_3d(i_target_color)
                
    brk_sig := true
            
    else if cancel and barstate.isconfirmed
                pat
    .cancelled := true
                pat
    .delete_all()
                
    result := na
            
    else
                
    pat.draw_wedge_3d(bar_indexcol)
        
        if 
    not na(pat) and pat.broken and not pat.success_hit
            bool success_condition 
    pat.is_falling high >= pat.success_level low <= pat.success_level
            
    if success_condition
                pat
    .success_hit := true
        
        
    if not na(pat) and pat.broken and not pat.target_hit
            float zone_top 
    pat.target_price pat.height * (i_target_zone_pct 100) / 2
            float zone_bottom 
    pat.target_price pat.height * (i_target_zone_pct 100) / 2
            bool hit 
    pat.is_falling high >= zone_bottom low <= zone_top
            
    if hit
                pat
    .target_hit := true
                pat
    .achieved_bar := bar_index
            pat
    .draw_target_3d(pat.target_hit i_achieved_color i_target_color)
        
        [
    resultbrk_sig]

    // MAIN EXECUTION | Ø§Ù„تنÙيذ Ø§Ù„رئيسي

    fall_brk := false
    rise_brk 
    := false

    if i_show_falling
        
    [upd_fallarch_fall] = process(active_fallfind_wedge(truetrend_data), i_falling_colortrue)
        
    active_fall := upd_fall
        
        
    if not na(arch_fall)
            if 
    not na(last_broken_fall)
                if 
    i_show_old
                    
    if not i_show_old_tgt
                        last_broken_fall
    .delete_targets()
                    
    patterns.push(last_broken_fall)
                else
                    
    last_broken_fall.delete_all()
            
    last_broken_fall := arch_fall
        
        
    [upd2sig] = lifecycle(active_falli_falling_color)
        
    active_fall := upd2
        fall_brk 
    := sig
        
        
    if not na(last_broken_fall) and last_broken_fall.broken and not last_broken_fall.target_hit
            float zone_top 
    last_broken_fall.target_price last_broken_fall.height * (i_target_zone_pct 100) / 2
            float zone_bottom 
    last_broken_fall.target_price last_broken_fall.height * (i_target_zone_pct 100) / 2
            bool hit 
    high >= zone_bottom
            
    if hit
                last_broken_fall
    .target_hit := true
                last_broken_fall
    .achieved_bar := bar_index
            last_broken_fall
    .draw_target_3d(last_broken_fall.target_hit i_achieved_color i_target_color)

    if 
    i_show_rising
        
    [upd_risearch_rise] = process(active_risefind_wedge(falsetrend_data), i_rising_colorfalse)
        
    active_rise := upd_rise
        
        
    if not na(arch_rise)
            if 
    not na(last_broken_rise)
                if 
    i_show_old
                    
    if not i_show_old_tgt
                        last_broken_rise
    .delete_targets()
                    
    patterns.push(last_broken_rise)
                else
                    
    last_broken_rise.delete_all()
            
    last_broken_rise := arch_rise
        
        
    [upd2sig] = lifecycle(active_risei_rising_color)
        
    active_rise := upd2
        rise_brk 
    := sig
        
        
    if not na(last_broken_rise) and last_broken_rise.broken and not last_broken_rise.target_hit
            float zone_top 
    last_broken_rise.target_price last_broken_rise.height * (i_target_zone_pct 100) / 2
            float zone_bottom 
    last_broken_rise.target_price last_broken_rise.height * (i_target_zone_pct 100) / 2
            bool hit 
    low <= zone_top
            
    if hit
                last_broken_rise
    .target_hit := true
                last_broken_rise
    .achieved_bar := bar_index
            last_broken_rise
    .draw_target_3d(last_broken_rise.target_hit i_achieved_color i_target_color)

    if 
    patterns.size() > 40
        patterns
    .shift().delete_all()

    // ALERTS | Ø§Ù„تنبيهات

    alertcondition(fall_brk"Falling Wedge Breakout""�� Bullish Breakout - Falling Wedge | ÙƒØ³Ø± ØµØ¹ÙˆØ¯ÙŠ - ÙˆØªØ¯ Ù‡Ø§Ø¨Ø· {{ticker}} {{interval}}")
    alertcondition(rise_brk"Rising Wedge Breakout""�� Bearish Breakout - Rising Wedge | ÙƒØ³Ø± Ù‡Ø¨ÙˆØ·ÙŠ - ÙˆØªØ¯ ØµØ§Ø¹Ø¯ {{ticker}} {{interval}}")
    alertcondition(fall_brk or rise_brk"Any Wedge Breakout""âš¡ Wedge Breakout | ÙƒØ³Ø± ÙˆØªØ¯ {{ticker}} {{interval}}"
    https://www.tradingview.com/x/Pd1rmyzW/ hepsini aktif edip bakınca... hesaplama sadece pattern taramıyor... trendle yapıyor...
    gerçekten güzel...
    16.07.2024 - 10.12.2024

Sayfa 361/363 İlkİlk ... 261311351359360361362363 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
  •