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 362/363 İlkİlk ... 262312352360361362363 SonSon
Arama sonucu : 2901 madde; 2,889 - 2,896 arası.

Konu: Tradingview

  1. 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('...'overlay truemax_labels_count 100calc_bars_count 00)

    // --------------------------------------------------------------------------------------------------------------------}
    colLong color.lime
    colShort 
    color.red
    atrLength 
    input.int(5"ATR Period"minval=5maxval=50)
    stFactor input.float(1.0"Supertrend Factor"minval=1.0maxval=5.0step=0.1)
    stFactor1 input.float(2.0"Supertrend Factor"minval=1.0maxval=5.0step=0.1)
    stFactor12 input.float(3.0"Supertrend Factor"minval=1.0maxval=5.0step=0.1)
    stFactor123 input.float(4.0"Supertrend Factor"minval=1.0maxval=5.0step=0.1)
    stFactor1234 input.float(5.0"Supertrend Factor"minval=1.0maxval=5.0step=0.1)
    stPeriod input.int(5"Supertrend Period"minval=5maxval=30)

    atr ta.atr(atrLength)
    [
    supertrendstDirection] = ta.supertrend(stFactorstPeriod)
    [
    supertrend1stDirection1] = ta.supertrend(stFactor1stPeriod)
    [
    supertrend12stDirection12] = ta.supertrend(stFactor12stPeriod)
    [
    supertrend123stDirection123] = ta.supertrend(stFactor123stPeriod)
    [
    supertrend1234stDirection1234] = ta.supertrend(stFactor1234stPeriod)

    isUptrend stDirection == -1
    isDowntrend 
    stDirection == 1

    stColor 
    isUptrend colLong colShort
    plot
    (supertrend"1.0"color=stColorlinewidth=1)
    plot(supertrend1"2.0"color=stColorlinewidth=1)
    plot(supertrend12"3.0"color=stColorlinewidth=1)
    plot(supertrend123"4.0"color=stColorlinewidth=1)
    plot(supertrend1234"5.0"color=stColorlinewidth=1)

    // ============================================================================ 
    atr kanalları denemesi
    16.07.2024 - 10.12.2024

  2. PHP Code:
    //@version=6
    indicator(".."shorttitle=".."overlay=truemax_lines_count=500max_labels_count=500)

    var 
    string vanity_group "Visual Settings"

    magic_wand_toggle input.bool(true"Show Active CISD Level (Plot)"group=vanity_group)

    drama_filter input.string("Both""Triggered CISD Display"options=["Both""Bullish Only""Bearish Only""None"], group=vanity_group)

    amnesia_mode input.bool(false"Limit Displayed Historical Lines"group=vanity_group)
    short_term_memory input.int(10"Max Lines to Show"minval=1group=vanity_group)

    yell_at_me input.bool(true"Show Labels"group=vanity_group)
    girth_units input.int(4"Line Width"minval=1group=vanity_group)
    scream_volume input.string(size.normal"Label Size"options=[size.tinysize.smallsize.normalsize.large], group=vanity_group)

    hipster_font_toggle input.string("Default""Font Family"options=["Default""Monospace"], group=vanity_group)
    fashion_choice input.string("Solid""Triggered Line Style"options=["Solid""Dashed""Dotted"], group=vanity_group)

    crayon_box "Colors"
    shrek_mode input.color(color.new(color.green0), "Bullish CISD"group=crayon_box)
    blood_bath input.color(color.new(color.red0), "Bearish CISD"group=crayon_box)

    nerd_stats "Debug"
    paranoia_switch input.bool(false"Debug: Show Extreme Tracking"group=nerd_stats)

    gossip_column "HTF Trend Panel" 
    stalker_mode input.bool(true"Show Multi-Timeframe Table"group=gossip_column)
    feng_shui input.string("Bottom Right""Table Position"options=["Top Right""Middle Right""Bottom Right""Bottom Left"], group=gossip_column)
    eye_test input.string("Small""Table Size"options=["Tiny""Small""Normal""Large"], group=gossip_column)
    // ---------------------------------------------------------

    var string fancy_typeface hipster_font_toggle == "Monospace" font.family_monospace font.family_default

    decode_fashion_statement
    (outfit) =>
        switch 
    outfit
            
    "Solid"  => line.style_solid
            
    "Dashed" => line.style_dashed
            
    => line.style_dotted

    chosen_style 
    decode_fashion_statement(fashion_choice)

    var 
    int vibes 0
    var float bagholder_entry na
    var int time_machine_setting na
    var float pain_threshold na

    var label sticky_note_of_shame na
    var array<linegraveyard_of_hopes = array.new<line>()
    var array<
    labelchoir_of_screams = array.new<label>()

    consult_the_crystal_ball(int bias) =>
        
    int temporal_shift 0
        float ancient_price 
    open
        
    for 0 to 500
            int candle_attitude 
    close[i] > open[i] ? close[i] < open[i] ? -0
            
    if candle_attitude == 0
                
    continue
            
    bool mood_match candle_attitude == bias
            
    if not mood_match
                
    break
            
    temporal_shift := i
            ancient_price 
    := open[i]
        [
    ancient_pricebar_index temporal_shift]

    archaeologist_jones(int bias) =>
        
    int i 1
        bool artifact_found 
    false
        int dig_site_idx 
    0
        float artifact_value 
    na
        
    for 1 to 500
            i 
    := j
            int candle_attitude 
    close[i] > open[i] ? close[i] < open[i] ? -0
            
    if candle_attitude == 0
                
    continue
            
    bool is_correct_era candle_attitude == bias
            
    if not artifact_found
                
    if is_correct_era
                    artifact_found 
    := true
                    dig_site_idx 
    := i
                    artifact_value 
    := open[i]
            else
                if 
    not is_correct_era
                    
    break
                
    dig_site_idx := i
                artifact_value 
    := open[i]
        [
    artifact_valuebar_index dig_site_idx]

    if 
    vibes == and bar_index 10
        int first_impression 
    close open close open ? -0
        
    if first_impression == 0
            
    for 1 to 50
                first_impression 
    := close[k] > open[k] ? close[k] < open[k] ? -0
                
    if first_impression != 0
                    
    break
        if 
    first_impression != 0
            vibes 
    := first_impression
            
    [origin_priceorigin_time] = consult_the_crystal_ball(first_impression)
            
    bagholder_entry := origin_price
            time_machine_setting 
    := origin_time
            pain_threshold 
    := first_impression == high low

    int candle_personality 
    close open close open ? -0
    float fresh_hopium 
    na
    int fresh_timestamp 
    na

    if vibes == 1
        
    if high pain_threshold
            pain_threshold 
    := high
            
    if candle_personality == 1
                
    [p_pricep_idx] = consult_the_crystal_ball(1)
                
    fresh_hopium := p_price
                fresh_timestamp 
    := p_idx
            
    else
                [
    p_pricep_idx] = archaeologist_jones(1)
                
    fresh_hopium := p_price
                fresh_timestamp 
    := p_idx
            bagholder_entry 
    := fresh_hopium
            time_machine_setting 
    := fresh_timestamp

    else if vibes == -1
        
    if low pain_threshold
            pain_threshold 
    := low
            
    if candle_personality == -1
                
    [p_pricep_idx] = consult_the_crystal_ball(-1)
                
    fresh_hopium := p_price
                fresh_timestamp 
    := p_idx
            
    else
                [
    p_pricep_idx] = archaeologist_jones(-1)
                
    fresh_hopium := p_price
                fresh_timestamp 
    := p_idx
            bagholder_entry 
    := fresh_hopium
            time_machine_setting 
    := fresh_timestamp

    bool shorts_squeezed 
    vibes == -and close bagholder_entry
    bool longs_rekt 
    vibes == and close bagholder_entry

    if shorts_squeezed or longs_rekt
        bool should_i_paint_it 
    false
        
        
    if drama_filter == "Both"
            
    should_i_paint_it := true
        
    else if drama_filter == "Bullish Only"
            
    should_i_paint_it := shorts_squeezed
        
    else if drama_filter == "Bearish Only"
            
    should_i_paint_it := longs_rekt

        
    if should_i_paint_it
            color mood_ring 
    shorts_squeezed shrek_mode blood_bath
            line tragedy_line 
    line.new(time_machine_settingbagholder_entrybar_indexbagholder_entrycolor=mood_ringwidth=girth_unitsstyle=chosen_style)
            array.
    push(graveyard_of_hopestragedy_line)

            
    label loud_noise na
            
    //if yell_at_me
                //int middle_of_nowhere = math.round((time_machine_setting + bar_index) / 2)
                //string gibberish = shorts_squeezed ? "+ALL" : "-SAT"
                //color ink_color = shorts_squeezed ? shrek_mode : blood_bath
                //loud_noise := label.new(middle_of_nowhere, bagholder_entry, gibberish, style=shorts_squeezed ? label.style_label_down : label.style_label_up, color=color.new(#000000, 100), textcolor=ink_color, size=scream_volume, text_font_family = fancy_typeface)
            
            
    array.push(choir_of_screamsloud_noise)

        
    int new_emotional_state shorts_squeezed : -1
        vibes 
    := new_emotional_state
        
    [reset_pricereset_time] = consult_the_crystal_ball(new_emotional_state)
        
    bagholder_entry := reset_price
        time_machine_setting 
    := reset_time
        pain_threshold 
    := new_emotional_state == high low

    color active_crayon 
    vibes == shrek_mode blood_bath

    plot
    (magic_wand_toggle bagholder_entry na"TR"color=active_crayonlinewidth=girth_unitsstyle=plot.style_stepline)
    ///////////////////////
    ////////////////////////////

    // --------------------------------------------------------------------------------------------------------------------}
    // 📌 𝙐𝙎𝙀𝙍 𝙄𝙉𝙋𝙐𝙏𝙎
    // --------------------------------------------------------------------------------------------------------------------{

    source      input.source(close'Source')
    length      input.int(100'Period'2)
    displayExt  input.bool(true""inline "ext")
    extrapolate input.int(1'Extrapolate'0inline "ext")
    degree      input.int(4'Degree'1)
    colorUp     input.color(color.rgb(3622323), ""inline "col")
    colorDn     input.color(color.fuchsia""inline "col")


    // --------------------------------------------------------------------------------------------------------------------}
    // 📌 𝙄𝙉𝘿𝙄𝘾𝘼𝙏𝙊𝙍 𝘾𝘼𝙇𝘾𝙐𝙇𝘼𝙏𝙄𝙊𝙉𝙎
    // --------------------------------------------------------------------------------------------------------------------{

    polyreg(sourcelengthdegreeextrapolate) =>
        if 
    barstate.islast
            total 
    length extrapolate

            X_all 
    matrix.new<float>(totaldegree 10.0)
            for 
    0 to total 1
                
    for 0 to degree
                    matrix
    .set(X_allijmath.pow(ij))

            
    // y (length × 1), oldest→newest over the fit window
            
    matrix.new<float>(length10.0)
            for 
    0 to length 1
                matrix
    .set(yi0source[length i])

            
    // X_train (first `length` rows of X_all)
            
    X_tr matrix.new<float>(lengthdegree 10.0)
            for 
    0 to length 1
                
    for 0 to degree
                    matrix
    .set(X_trijmatrix.get(X_allij))

            
    // OLS via normal equations: (X'X)^(-1)b = X'y  ⇒  b = (X'X)^(-1) X'y
            
    Xt   matrix.transpose(X_tr)           // X'
            
    XtX  matrix.mult(XtX_tr)           // (X'X) 
            
    Xty  matrix.mult(Xty)             //  X'y
            
    XtX_inv matrix.inv(XtX)            // (X'X)^(-1)      
            
    b       matrix.mult(XtX_invXty//  b = (X'X)^(-1) X'y

            // Predictions for all rows (fit + extrap)
            
    preds matrix.mult(X_allmatrix.col(b,0))    
            
    preds


    dist        
    ta.highest(ta.sma(high-lowlength), length)*2
    predictions 
    polyreg(sourcelengthdegreeextrapolate)

    drawLine(offset)=>
        
        var 
    lastPred  float(na)
        var 
    color     color(na)
        var 
    labels    = array.new<label>()
        var 
    prevValue float(na)

        if 
    barstate.islast
            chartPoints  
    = array.new<chart.point>()
            
    chartPoints1 = array.new<chart.point>()

            if 
    labels.size() > 0
                
    for l in labels
                    l
    .delete()

            for [
    indexpredictionin predictions

                Directioncolor 
    prediction prevValue colorUp colorDn
                prevValue 
    := prediction
                predZone 
    index >= length

                
    if offset == 
                    marker   
    displayExt ? (predZone "•" "⬥") : (predZone "" "⬥")
                    
    txtColor predZone chart.fg_color Directioncolor
                    labels
    .push(label.new(chart.point.from_index(index bar_index index length 1price prediction+offset), markercolor color(na), textcolor txtColorstyle label.style_label_center))
                
                else if 
    predZone and displayExt
                    chartPoints
    .push(value chart.point.from_index(index bar_index index length 1price prediction+offset))
                else if 
    not predZone
                    chartPoints1
    .push(value chart.point.from_index(index bar_index index length 1price prediction+offset))

                if 
    index == length+extrapolate-and displayExt
                    lastPred 
    := prediction
                    
    if offset 0
                        style 
    Directioncolor == colorUp label.style_label_lower_left label.style_label_upper_left
                        label
    .delete(label.new(bar_index+extrapolatelastPred-offsetstr.tostring(lastPred-offset"##,###,###.###"), style styletextcolor chart.fg_colorcolor color(na))[1])
                        
    label.delete(label.new(bar_index+extrapolatelastPredstr.tostring(lastPred"##,###,###.###"), style styletextcolor chart.fg_colorcolor color(na))[1])
                        
    label.delete(label.new(bar_index+extrapolatelastPred+offsetstr.tostring(lastPred+offset"##,###,###.###"), style styletextcolor chart.fg_colorcolor color(na))[1])

            
    color := chart.fg_color
            
    //polyline.delete(polyline.new(chartPoints, line_width = 1, line_style = line.style_dashed, line_color = color)[1])
            //polyline.delete(polyline.new(chartPoints1, line_width = 1, line_style = line.style_solid, line_color = color)[1])

            
        
    lastPred


    // --------------------------------------------------------------------------------------------------------------------}
    // 📌 𝙑𝙄𝙎𝙐𝘼𝙇𝙄𝙕𝘼𝙏𝙄𝙊𝙉
    // --------------------------------------------------------------------------------------------------------------------{

    drawLine(dist)
    drawLine(0)
    drawLine(-dist)

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

    // ============================================================================

    //////////////////////////

    // Trend settings
    st_factor input.float(2title="Supertrend Factor"minval=1step=0.5group="Trend Settings"
         
    tooltip="Multiplier for the ATR to determine Supertrend bands width. Higher values create wider bands and fewer signals.")
    st_atr_period input.int(2title="Supertrend ATR Period"minval=1group="Trend Settings"
         
    tooltip="Number of bars used to calculate the ATR for Supertrend. Longer periods create smoother, less reactive bands.")
    wma_length input.int(1title="WMA Length"minval=1group="Trend Settings"
         
    tooltip="Length of the Weighted Moving Average applied to the SuperTrend. Higher values create smoother, less reactive lines.")
    ema_length input.int(1title="EMA Length"minval=1group="Trend Settings"
         
    tooltip="Length of the Exponential Moving Average applied to the WMA. Controls the final smoothness of the trend line.")

    //Continuation settings
    cont_factor input.int(3title="Confirmation count"minval=1group="Rejection Settings"
         
    tooltip="Number of consecutive bars that must consolidate at the trend line before a rejection signal is generated. Higher values require more bars to confirm a trend.")

    // Volatility settings
    shw_TP1 input.bool(truetitle="Show Take Profit Levels"group="Targets"
         
    tooltip="Toggle visibility of take profit target levels on the chart.")
    atr_period input.int(14title="Volatility (ATR) period"minval=1group="Targets"
         
    tooltip="Number of bars used to calculate the Average True Range for position sizing and targets.")
    sl_multiplier input.float(5title="Stop Loss ATR Multiplier"minval=0.1step=0.1group="Targets"
         
    tooltip="Multiplier applied to ATR to determine stop loss distance from entry. Higher values place stops further away.")
    tp1_multiplier input.float(0.5title="TP1 Multiplier"minval=0.1step=0.1tooltip="Multiple of SL distance for first take profit target."group="Targets")
    tp2_multiplier input.float(1.0title="TP2 Multiplier"minval=0.1step=0.1tooltip="Multiple of SL distance for second take profit target."group="Targets")
    tp3_multiplier input.float(1.5title="TP3 Multiplier"minval=0.1step=0.1tooltip="Multiple of SL distance for third take profit target."group="Targets")

    volatility ta.atr(atr_period)
    // Appearance settings
    green input.color(#00ffbb00, title="Bullish Color", tooltip="Color used for bullishness", group="Appearance")
    red input.color(#ff110000, title="Bearish Color", tooltip="Color used for bearishness", group="Appearance")


    pine_supertrend(factoratrPeriod) =>
        
    src hl2
        atr55 
    ta.atr(atrPeriod)
        
    upperBand src factor atr55
        lowerBand 
    src factor atr55
        prevLowerBand 
    nz(lowerBand[1])
        
    prevUpperBand nz(upperBand[1])

        
    lowerBand := lowerBand prevLowerBand or close[1] < prevLowerBand lowerBand prevLowerBand
        upperBand 
    := upperBand prevUpperBand or close[1] > prevUpperBand upperBand prevUpperBand

        
    [lowerBandupperBand]

    [
    lwrupr] = pine_supertrend(st_factorst_atr_period)
    tL ta.ema(ta.wma(math.avg(lwrupr), wma_length), ema_length)

    var 
    trend 0
    if ta.crossover(tLtL[1])
        
    trend := 1
    if ta.crossunder(tLtL[1])
        
    trend := -1
          
    var rejcount 0

    bullishrej 
    trend == and high tL and low tL
    bearishrej 
    trend == -and high tL and low tL

    if (bullishrej or bearishrej)
        
    rejcount += 1

    if ta.cross(trend0) or (not (bullishrej or bearishrej) and rejcount 0)
        
    rejcount := 0

    //plotchar((rejcount > cont_factor and trend == 1) ? tL  : na, "Bullish Rejection", "▲", location.belowbar, green, size = size.tiny)
    //plotchar((rejcount > cont_factor and trend == -1) ? tL  : na, "Bearish Rejection", "▼", location.abovebar, red, size = size.tiny)

    plot(tL"TR1"color=trend == color.new(green100) : color.new(red100))
    //////////////////////
    // Supertrend Settings
    atrLength55 input.int(1"ATR Length"minval=1group="Supertrend Settings",
         
    tooltip="Number of bars for ATR calculation. Higher = smoother, Lower = more responsive.")

    atrMult input.float(1.0"ATR Multiplier"minval=0.1group="Supertrend Settings",
         
    tooltip="Distance of bands from price. Higher = wider bands, fewer signals.")

    // Curve Settings
    radiusStrength input.float(0.1"Radius Strength"
         
    minval=0.001maxval=0.3step=0.001group="Curve Settings",
         
    tooltip="Controls curve acceleration strength.\n\n" +
                  
    "Lower = Tighter curves (responsive)\n" +
                  
    "Higher = Wider curves (smoother)")

    smoothness input.int(1"Smoothness"minval=1maxval=20group="Curve Settings",
         
    tooltip="Smoothing applied to curved band. Higher = smoother curves, less noise.")

    // Color Settings
    upColor input.color(color.rgb(7617579100), "Up Trend"group="Color Settings",
         
    tooltip="Color for uptrend band and signals.")

    dnColor input.color(color.rgb(2558282100), "Down Trend"group="Color Settings",
         
    tooltip="Color for downtrend band and signals.")

    // ============================================================================
    // Supertrend Calculation
    // ============================================================================
    atr66 ta.atr(atrLength55)
    src hl2

    upperBand 
    src + (atrMult atr66)
    lowerBand src - (atrMult atr66)

    var 
    float supertrend66 na
    var int direction 1

    // Initialize
    if na(supertrend66)
        
    supertrend66 := lowerBand
        direction 
    := 1

    // Standard supertrend logic
    float prevSupertrend supertrend66

    if direction == 1
        supertrend66 
    := close prevSupertrend upperBand math.max(lowerBandprevSupertrend)
    else
        
    supertrend66 := close prevSupertrend lowerBand math.min(upperBandprevSupertrend)

    int prevDirection direction
    if close supertrend66
        direction 
    := -1
    if close supertrend66
        direction 
    := 1

    // ============================================================================
    // Curved Radius Implementation
    // ============================================================================
    var float anchorPrice na
    var int anchorBar na
    var float velocity 0.0
    var int barCount 0

    // Detect trend change - set new anchor
    bool trendChanged direction != prevDirection

    if trendChanged
        anchorPrice 
    := supertrend66
        anchorBar 
    := bar_index
        velocity 
    := 0.0
        barCount 
    := 0

    // Increment bar counter
    barCount := barCount 1

    // Calculate curved offset using acceleration creating a parabolic curve
    if not na(anchorPrice)
        
    // Acceleration increases with each bar (quadratic growth)
        
    velocity := velocity + (radiusStrength barCount)
        
        
    // Apply velocity in direction of trend
        
    if direction == 1
            
    // Uptrend - curve upward with acceleration
            
    supertrend66 := anchorPrice velocity
        
    else
            
    // Downtrend - curve downward with acceleration  
            
    supertrend66 := anchorPrice velocity

    // Apply smoothing to create flowing curves
    curvedBand ta.sma(supertrend66smoothness)

    // ============================================================================
    // Visualization
    // ============================================================================
    trendColor direction == upColor dnColor

    // Plot the curved band
    plot(curvedBand"TR2"
         
    color=trendColor
         
    linewidth=1)

    // Fill between price and band

    ////////////////// 
    16.07.2024 - 10.12.2024

  3. 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('...'overlay truemax_labels_count 100calc_bars_count 00)

    // --------------------------------------------------------------------------------------------------------------------}
    // 📌 𝙐𝙎𝙀𝙍 𝙄𝙉𝙋𝙐𝙏𝙎
    // --------------------------------------------------------------------------------------------------------------------{

    source      input.source(close'Source')
    length      input.int(100'Period'2)
    displayExt  input.bool(true""inline "ext")
    extrapolate input.int(1'Extrapolate'0inline "ext")
    degree      input.int(4'Degree'1)
    colorUp     input.color(color.rgb(3622323), ""inline "col")
    colorDn     input.color(color.fuchsia""inline "col")


    // --------------------------------------------------------------------------------------------------------------------}
    // 📌 𝙄𝙉𝘿𝙄𝘾𝘼𝙏𝙊𝙍 𝘾𝘼𝙇𝘾𝙐𝙇𝘼𝙏𝙄𝙊𝙉𝙎
    // --------------------------------------------------------------------------------------------------------------------{

    polyreg(sourcelengthdegreeextrapolate) =>
        if 
    barstate.islast
            total 
    length extrapolate

            X_all 
    matrix.new<float>(totaldegree 10.0)
            for 
    0 to total 1
                
    for 0 to degree
                    matrix
    .set(X_allijmath.pow(ij))

            
    // y (length × 1), oldest→newest over the fit window
            
    matrix.new<float>(length10.0)
            for 
    0 to length 1
                matrix
    .set(yi0source[length i])

            
    // X_train (first `length` rows of X_all)
            
    X_tr matrix.new<float>(lengthdegree 10.0)
            for 
    0 to length 1
                
    for 0 to degree
                    matrix
    .set(X_trijmatrix.get(X_allij))

            
    // OLS via normal equations: (X'X)^(-1)b = X'y  ⇒  b = (X'X)^(-1) X'y
            
    Xt   matrix.transpose(X_tr)           // X'
            
    XtX  matrix.mult(XtX_tr)           // (X'X) 
            
    Xty  matrix.mult(Xty)             //  X'y
            
    XtX_inv matrix.inv(XtX)            // (X'X)^(-1)      
            
    b       matrix.mult(XtX_invXty//  b = (X'X)^(-1) X'y

            // Predictions for all rows (fit + extrap)
            
    preds matrix.mult(X_allmatrix.col(b,0))    
            
    preds


    dist        
    ta.highest(ta.sma(high-lowlength), length)*2
    predictions 
    polyreg(sourcelengthdegreeextrapolate)

    drawLine(offset)=>
        
        var 
    lastPred  float(na)
        var 
    color     color(na)
        var 
    labels    = array.new<label>()
        var 
    prevValue float(na)

        if 
    barstate.islast
            chartPoints  
    = array.new<chart.point>()
            
    chartPoints1 = array.new<chart.point>()

            if 
    labels.size() > 0
                
    for l in labels
                    l
    .delete()

            for [
    indexpredictionin predictions

                Directioncolor 
    prediction prevValue colorUp colorDn
                prevValue 
    := prediction
                predZone 
    index >= length

                
    if offset == 
                    marker   
    displayExt ? (predZone "•" "⬥") : (predZone "" "⬥")
                    
    txtColor predZone chart.fg_color Directioncolor
                    labels
    .push(label.new(chart.point.from_index(index bar_index index length 1price prediction+offset), markercolor color(na), textcolor txtColorstyle label.style_label_center))
                
                else if 
    predZone and displayExt
                    chartPoints
    .push(value chart.point.from_index(index bar_index index length 1price prediction+offset))
                else if 
    not predZone
                    chartPoints1
    .push(value chart.point.from_index(index bar_index index length 1price prediction+offset))

                if 
    index == length+extrapolate-and displayExt
                    lastPred 
    := prediction
                    
    if offset 0
                        style 
    Directioncolor == colorUp label.style_label_lower_left label.style_label_upper_left
                        label
    .delete(label.new(bar_index+extrapolatelastPred-offsetstr.tostring(lastPred-offset"##,###,###.###"), style styletextcolor chart.fg_colorcolor color(na))[1])
                        
    label.delete(label.new(bar_index+extrapolatelastPredstr.tostring(lastPred"##,###,###.###"), style styletextcolor chart.fg_colorcolor color(na))[1])
                        
    label.delete(label.new(bar_index+extrapolatelastPred+offsetstr.tostring(lastPred+offset"##,###,###.###"), style styletextcolor chart.fg_colorcolor color(na))[1])

            
    color := chart.fg_color
            
    //polyline.delete(polyline.new(chartPoints, line_width = 1, line_style = line.style_dashed, line_color = color)[1])
            //polyline.delete(polyline.new(chartPoints1, line_width = 1, line_style = line.style_solid, line_color = color)[1])

            
        
    lastPred


    // --------------------------------------------------------------------------------------------------------------------}
    // 📌 𝙑𝙄𝙎𝙐𝘼𝙇𝙄𝙕𝘼𝙏𝙄𝙊𝙉
    // --------------------------------------------------------------------------------------------------------------------{

    drawLine(dist)
    drawLine(0)
    drawLine(-dist)

    // --------------------------------------------------------------------------------------------------------------------}
    colLong color.rgb(0230119100)
    colShort color.rgb(2558282100)
    atrLength input.int(5"ATR Period"minval=5maxval=50)
    stFactor input.float(1.0"Supertrend Factor"minval=1.0maxval=5.0step=0.1)
    stPeriod input.int(5"Supertrend Period"minval=5maxval=30)

    atr ta.atr(atrLength)
    [
    supertrendstDirection] = ta.supertrend(stFactorstPeriod)

    isUptrend stDirection == -1
    isDowntrend 
    stDirection == 1

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


    // ============================================================================

    input(1title 'Key Vaule. \'This changes the sensitivity\'')
    input(1title 'ATR Period')
    input(truetitle 'Signals from Heikin Ashi Candles')

    xATR ta.atr(c)
    nLoss xATR
    src77 
    request.security(ticker.heikinashi(syminfo.tickerid), timeframe.periodcloselookahead barmerge.lookahead_off) : close

    xATRTrailingStop 
    0.0
    iff_1 
    src77 nz(xATRTrailingStop[1], 0) ? src77 nLoss src77 nLoss
    iff_2 
    src77 nz(xATRTrailingStop[1], 0) and src77[1] < nz(xATRTrailingStop[1], 0) ? math.min(nz(xATRTrailingStop[1]), src77 nLoss) : iff_1
    xATRTrailingStop 
    := src77 nz(xATRTrailingStop[1], 0) and src77[1] > nz(xATRTrailingStop[1], 0) ? math.max(nz(xATRTrailingStop[1]), src77 nLoss) : iff_2

    pos 
    0
    iff_3 
    src77[1] > nz(xATRTrailingStop[1], 0) and src77 nz(xATRTrailingStop[1], 0) ? -nz(pos[1], 0)
    pos := src77[1] < nz(xATRTrailingStop[1], 0) and src77 nz(xATRTrailingStop[1], 0) ? iff_3
    xcolor 
    pos == -color.red pos == color.green color.blue
    ema 
    ta.ema(src771)
    above ta.crossover(emaxATRTrailingStop)
    below ta.crossover(xATRTrailingStopema)
    buy src77 xATRTrailingStop and above
    sell 
    src77 xATRTrailingStop and below
    barbuy 
    src77 xATRTrailingStop
    barsell 
    src77 xATRTrailingStop
    barcolor
    (barbuy color.green na)
    barcolor(barsell color.red na)


    ///////////////////////////////////// 
    16.07.2024 - 10.12.2024

  4. PHP Code:
    // This work is licensed under an Attribution-ShareAlike 4.0 International License (CC BY-SA 4.0) 
    // https://creativecommons.org/licenses/by-sa/4.0/
    // © Uptrick
    //@version=6


    //    ██╗   ██╗██████╗ ████████╗██████╗ ██╗ ██████╗██╗  ██╗
    //    ██║   ██║██╔══██╗╚══██╔══╝██╔══██╗██║██╔════╝██║ ██╔╝
    //    ██║   ██║██████╔╝   ██║   ██████╔╝██║██║     █████╔╝ 
    //    ██║   ██║██╔═══╝    ██║   ██╔══██╗██║██║     ██╔═██╗ 
    //    ╚██████╔╝██║        ██║   ██║  ██║██║╚██████╗██║  ██╗
    //     ╚═════╝ ╚═╝        ╚═╝   ╚═╝  ╚═╝╚═╝ ╚═════╝╚═╝  ╚═╝

    indicator("Uptrick: Price Memory Trend"overlay=truemax_labels_count=500)

    //────────────────────────────────────────────
    // INPUTS
    //────────────────────────────────────────────
    grpA "Core Engine"
    memoryStrength input.float(0.12"Memory Strength"step=0.01group=grpA)
    memoryDecay    input.float(0.96"Memory Decay"step=0.01group=grpA)
    devLen         input.int(34"Deviation Length"minval=5group=grpA)
    bandMult       input.float(1.6"Band Multiplier"step=0.1group=grpA)

    //────────────────────────────────────────────
    // COLOR PALETTES (PRESET ONLY)
    //────────────────────────────────────────────
    grpP "Customization"

    palette input.string(
         
    "Default",
         
    "Color Palette",
         
    options = [
             
    "Default",
             
    "Emerald vs Red",
             
    "Neon Cyan vs Magenta",
             
    "Electric Lime vs Crimson",
             
    "Ice Blue vs Inferno",
             
    "Gold vs Violet"
         
    ],
         
    group grpP
    )

    // Palette definitions
    bull =
          
    palette == "Default"        #00ffea :
          
    palette == "Emerald vs Red"        color.rgb(0255170) :
          
    palette == "Neon Cyan vs Magenta"  color.rgb(0255255) :
          
    palette == "Electric Lime vs Crimson" color.rgb(1702550) :
          
    palette == "Ice Blue vs Inferno"   color.rgb(120200255) :
                          
    color.rgb(25521080)

    bear =
          
    palette == "Default"        #ff00ff :
          
    palette == "Emerald vs Red"        color.rgb(2556060) :
          
    palette == "Neon Cyan vs Magenta"  color.rgb(2550200) :
          
    palette == "Electric Lime vs Crimson" color.rgb(200040) :
          
    palette == "Ice Blue vs Inferno"   color.rgb(255800) :
                         
    color.rgb(15060255)

    neutral #85858559

    showBands input.bool(true"Show Bands"group=grpP)

    look input.string(
         
    "Bands",
         
    "Look",
         
    options = [
             
    "Bands",
             
    "Trail",
             
    "Intense"
         
    ],
         
    group grpP
    )
    //────────────────────────────────────────────
    // PRICE MEMORY BASE (UNIQUE CORE)
    //────────────────────────────────────────────
    price close

    var float memory price
    delta 
    price memory

    // Memory reacts to meaningful deviation only
    memory := memory delta memoryStrength
    memory 
    := memory memoryDecay price * (memoryDecay)

    // Final smooth base (not MA-based)
    base memory

    //────────────────────────────────────────────
    // ADAPTIVE DEVIATION BANDS (NOT ATR)
    //────────────────────────────────────────────
    dev    math.abs(price base)
    avgDev ta.ema(devdevLen)

    upper base avgDev bandMult
    lower 
    base avgDev bandMult

    //────────────────────────────────────────────
    // SIGNAL CONDITIONS
    //────────────────────────────────────────────
    bullCond ta.crossover(priceupper)
    bearCond ta.crossunder(pricelower)

    //────────────────────────────────────────────
    // NON-PYRAMIDING TREND STATE
    //────────────────────────────────────────────
    var int trendState 0  // 1 = bull, -1 = bear

    newBull bullCond and trendState != 1
    newBear 
    bearCond and trendState != -1

    if newBull
        trendState 
    := 1
    else if newBear
        trendState 
    := -1
    else
        
    trendState := nz(trendState[1], 0)

    //────────────────────────────────────────────
    // CANDLE COLORING (plotcandle ONLY)
    //────────────────────────────────────────────
    candleCol =
         
    trendState == 1  bull :
         
    trendState == -bear :
         
    neutral

    plotcandle
    (
         
    open,
         
    high,
         
    low,
         
    close,
         
    color=candleCol,
         
    wickcolor=candleCol,
         
    bordercolor=candleCol
    )

    //────────────────────────────────────────────
    // PLOTS
    //────────────────────────────────────────────
    inup plot(
         
    showBandsupper na,
         
    "Upper Band",
         
    color=trendState == -?  color.new(bear40): color.new(bear100), linewidth look != "Trail"3
    )

    inlowplot(
         
    showBands lower na,
         
    "Lower Band",
         
    color=trendState == color.new(bull40): color.new(bull100), linewidth look != "Trail"3
    )

    outup=plot(
         
    showBands and look != "Trail"?upper ta.atr(14) : na,
         
    "Upper Band",
         
    color=trendState == -?  color.new(bear40): color.new(bear100)
    )

    outlow=plot(
         
    showBands and look != "Trail"lower ta.atr(14)  : na,
         
    "Lower Band",
         
    color=trendState == color.new(bull40): color.new(bull100)
    )


    fill(inup,outup,upper ta.atr(14),upper,trendState == -color.new(bear,70):natrendState == -color.new(bear,70):na)
    fill(inlow,outlow,lower ta.atr(14),lower,trendState == color.new(bull,70):natrendState == color.new(bull,70):na)

    fill(inlow,plot(close,color=#363a4500),close,lower,trendState == 1 and look == "Intense" ? color.new(bull,100):na, trendState == 1 and look == "Intense" ? color.new(bull,80):na)
    fill(inup,plot(close,color=#363a4500),upper,close,trendState == -1 and look == "Intense" ? color.new(bear,70):na, trendState == -1 and look == "Intense" ? color.new(bull,100):na)


    //────────────────────────────────────────────
    // LABEL-STYLE SIGNALS (STATE CHANGE ONLY)
    //────────────────────────────────────────────
    bandOffset avgDev 0.25   // small visual spacing

    yUp lower bandOffset     // BELOW lower band
    yDn upper bandOffset     // ABOVE upper band


    if newBull
        label
    .new(
             
    bar_index,
             
    yUp,
             
    text "𝓤𝓹",
             
    style label.style_label_up,
             
    size size.normal,
             
    color bull,
             
    textcolor color.black,
             
    force_overlay true
         
    )

    if 
    newBear
        label
    .new(
             
    bar_index,
             
    yDn,
             
    text "𝓓𝓸𝔀𝓷",
             
    style label.style_label_down,
             
    size size.normal,
             
    color bear,
             
    textcolor color.white,
             
    force_overlay true
         
    )


    //────────────────────────────────────────────
    // ALERTS (NON-PYRAMIDING)
    //────────────────────────────────────────────
    alertcondition(newBull"Bullish Shift""Price Memory Trend → BULL")
    alertcondition(newBear"Bearish Shift""Price Memory Trend → BEAR")













    //────────────────────────────────────────────
    // INFO TABLE — FULL REWRITE (EXTENDED)
    //────────────────────────────────────────────
    grpT "Info Table"

    showTable input.bool(true"Show Info Table"group=grpT)

    tablePos input.string(
         
    "Bottom Right",
         
    "Table Position",
         
    options = ["Top Left""Top Right""Bottom Left""Bottom Right"],
         
    group grpT
    )

    textSizeOpt input.string(
         
    "Small",
         
    "Text Size",
         
    options = ["Tiny""Small""Normal""Large"],
         
    group grpT
    )

    // Resolve position
    tblPos =
         
    tablePos == "Top Left"    position.top_left :
         
    tablePos == "Top Right"   position.top_right :
         
    tablePos == "Bottom Left" position.bottom_left :
                                     
    position.bottom_right

    // Resolve text size
    tblSize =
         
    textSizeOpt == "Tiny"   size.tiny :
         
    textSizeOpt == "Small"  size.small :
         
    textSizeOpt == "Normal" size.normal :
                                   
    size.large

    //────────────────────────────────────────────
    // TABLE INIT
    //────────────────────────────────────────────
    var table infoTable table.new(
         
    tblPos,
         
    214,
         
    frame_color color.new(color.white70),
         
    frame_width 1,
         
    bgcolor #000000, border_color = #5b5b5b, border_width = 1
    )

    //────────────────────────────────────────────
    // CORE METRICS
    //────────────────────────────────────────────
    distFromBase price base
    stretch      
    avgDev != distFromBase avgDev 0.0
    absStretch   
    math.abs(stretch)

    bandWidth    upper lower
    bandWidthPct 
    base != bandWidth base 100 0.0
    posInBand    
    bandWidth != ? (price lower) / bandWidth 0.5
    // Clamp helper (Pine has no math.clamp)
    f_clamp(xlohi) =>
         
    math.min(math.max(xlo), hi)

    posPct f_clamp(posInBand 1000100)

    //────────────────────────────────────────────
    // MEMORY DYNAMICS
    //────────────────────────────────────────────
    memorySlope  base base[1]
    memoryAccel  memorySlope memorySlope[1]

    //────────────────────────────────────────────
    // TREND CONTEXT
    //────────────────────────────────────────────
    barsSinceFlip ta.barssince(newBull or newBear)

    //────────────────────────────────────────────
    // ICON STATES
    //────────────────────────────────────────────
    trendIcon =
         
    trendState == and absStretch 1.2  "🔼" :
         
    trendState == and absStretch >= 1.2 "⏫" :
         
    trendState == -and absStretch 1.2 "🔽" :
         
    trendState == -and absStretch >= 1.2"⏬" :
                                                 
    "—"

    bandIcon =
         
    price upper "🔴𝐇𝐨𝐭🔴" :
         
    price lower "🔵𝐂𝐨𝐨𝐥🔵" :
                         
    "⬛𝐂𝐚𝐥𝐦⬛"

    compressionIcon =
         
    bandWidth ta.ema(bandWidthdevLen) ? "🧊𝐭𝐢𝐠𝐡𝐭🧊" "🔥𝐰𝐢𝐝𝐞🔥"

    reversionIcon =
          
    absStretch 1.5 "⚠️𝐞𝐱𝐭𝐫𝐞𝐦𝐞⚠️" :
          
    absStretch 1.0 "↩️𝐞𝐥𝐞𝐯𝐚𝐭𝐞𝐝↩️" :
                             
    "—𝐧𝐞𝐮𝐭𝐫𝐚𝐥—"

    confidenceIcon =
          
    absStretch 1.5 "🟠🟠🟠🟠🟠" :
          
    absStretch 1.2 "🟠🟠🟠🟠" :
          
    absStretch 0.8 "🟠🟠🟠" :
          
    absStretch 0.4 "🟠🟠" :
                             
    "🟠"

    //────────────────────────────────────────────
    // COLORS
    //────────────────────────────────────────────
    trendCol =
          
    trendState == 1  bull :
          
    trendState == -bear :
                             
    color.gray

    stretchCol 
    =
          
    absStretch >= 1.2 trendCol :
          
    absStretch >= 0.8 color.new(trendCol30) :
                              
    color.gray

    //────────────────────────────────────────────
    // TABLE RENDER
    //────────────────────────────────────────────
    if barstate.islast and showTable
        
    // TITLE
        
    table.cell(
             
    infoTable00,
             
    "✨✨✨ 𝓟𝓜𝓓 ✨✨✨",
             
    text_color color.white,
             
    text_size  tblSize,
             
    bgcolor    color.new(color.black70)
        )
        
    table.merge_cells(infoTable0010)

        
    // CORE STATE
        
    table.cell(infoTable01"𝐓𝐫𝐞𝐧𝐝"text_color=color.whitetext_size=tblSize)
        
    table.cell(infoTable11trendIcontext_color=trendColtext_size=tblSize)

        
    table.cell(infoTable02"𝐁𝐚𝐧𝐝 𝐒𝐭𝐚𝐭𝐞"text_color=color.whitetext_size=tblSize)
        
    table.cell(infoTable12bandIcontext_color=trendColtext_size=tblSize)

        
    table.cell(infoTable03"𝐒𝐭𝐫𝐞𝐭𝐜𝐡"text_color=color.whitetext_size=tblSize)
        
    table.cell(infoTable13str.tostring(stretch"#.##") + "x"text_color=stretchColtext_size=tblSize)

        
    // TREND QUALITY
        
    table.cell(infoTable04"𝐓𝐫𝐞𝐧𝐝 𝐀𝐠𝐞"text_color=color.whitetext_size=tblSize)
        
    table.cell(infoTable14str.tostring(barsSinceFlip) + " bars"text_color=trendColtext_size=tblSize)

        
    table.cell(infoTable05"𝐂𝐨𝐧𝐟𝐢𝐝𝐞𝐧𝐜𝐞"text_color=color.whitetext_size=tblSize)
        
    table.cell(infoTable15confidenceIcontext_color=trendColtext_size=tblSize)

        
    // MEMORY BEHAVIOUR
        
    table.cell(infoTable06"𝐌𝐞𝐦𝐨𝐫𝐲 𝐒𝐥𝐨𝐩𝐞"text_color=color.whitetext_size=tblSize)
        
    table.cell(infoTable16str.tostring(memorySlopeformat.mintick), text_color=trendColtext_size=tblSize)

        
    table.cell(infoTable07"𝐌𝐞𝐦𝐨𝐫𝐲 𝐀𝐜𝐜𝐞𝐥"text_color=color.whitetext_size=tblSize)
        
    table.cell(infoTable17str.tostring(memoryAccelformat.mintick), text_color=trendColtext_size=tblSize)

        
    // BAND DYNAMICS
        
    table.cell(infoTable08"𝐁𝐚𝐧𝐝 𝐖𝐢𝐝𝐭𝐡"text_color=color.whitetext_size=tblSize)
        
    table.cell(infoTable18str.tostring(bandWidthPct"#.##") + "%"text_color=color.whitetext_size=tblSize)

        
    table.cell(infoTable09"𝐁𝐚𝐧𝐝 𝐏𝐨𝐬𝐢𝐭𝐢𝐨𝐧"text_color=color.whitetext_size=tblSize)
        
    table.cell(infoTable19str.tostring(posPct"#") + "%"text_color=color.whitetext_size=tblSize)

        
    table.cell(infoTable0,10"𝐂𝐨𝐦𝐩𝐫𝐞𝐬𝐬𝐢𝐨𝐧"text_color=color.whitetext_size=tblSize)
        
    table.cell(infoTable1,10compressionIcontext_color=color.whitetext_size=tblSize)

        
    // REGIME / RISK
        
    table.cell(infoTable0,11"𝐑𝐞𝐯𝐞𝐫𝐬𝐢𝐨𝐧 𝐑𝐢𝐬𝐤"text_color=color.whitetext_size=tblSize)
        
    table.cell(infoTable1,11reversionIcontext_color=color.whitetext_size=tblSize
    üzerinde çalışılacak...
    16.07.2024 - 10.12.2024

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

    //@version=6
    indicator('PSAR-Support Resistance'overlay true)
    mt input.timeframe(''title 'S/R timeframe')
    sh input.int(2title 'Shift S/R Forward/Backward')
    start input.float(title 'Start'step 0.01defval 0.)
    increment input.float(title 'Increment'step 0.01defval 0.09)
    maximum input.float(title 'Maximum'step 0.01defval 0.2)

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

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

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


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


    //co=open>h and close>h?color.rgb(6, 217, 240):open<l and close<l?color.rgb(237, 20, 143):color.rgb(242, 231, 8)
    //barcolor(color=co)


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

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

    fill(udcolor color.rgb(255828277) : color.rgb(761757978))

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

  6. 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/
    // © BOSWaves

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

    // ============================================================================
    // Inputs
    // ============================================================================

    // Supertrend Settings
    atrLength input.int(5"ATR Length"minval=1group="Supertrend Settings",
         
    tooltip="Number of bars for ATR calculation. Higher = smoother, Lower = more responsive.")

    atrMult input.float(2.0"ATR Multiplier"minval=0.1group="Supertrend Settings",
         
    tooltip="Distance of bands from price. Higher = wider bands, fewer signals.")

    // Curve Settings
    radiusStrength input.float(0.2"Radius Strength"
         
    minval=0.001maxval=0.3step=0.001group="Curve Settings",
         
    tooltip="Controls curve acceleration strength.\n\n" +
                  
    "Lower = Tighter curves (responsive)\n" +
                  
    "Higher = Wider curves (smoother)")

    smoothness input.int(5"Smoothness"minval=1maxval=20group="Curve Settings",
         
    tooltip="Smoothing applied to curved band. Higher = smoother curves, less noise.")

    // Color Settings
    upColor input.color(color.green"Up Trend"group="Color Settings",
         
    tooltip="Color for uptrend band and signals.")

    dnColor input.color(color.red"Down Trend"group="Color Settings",
         
    tooltip="Color for downtrend band and signals.")

    // ============================================================================
    // Supertrend Calculation
    // ============================================================================
    atr ta.atr(atrLength)
    src hl2

    upperBand 
    src + (atrMult atr)
    lowerBand src - (atrMult atr)

    var 
    float supertrend na
    var int direction 1

    // Initialize
    if na(supertrend)
        
    supertrend := lowerBand
        direction 
    := 1

    // Standard supertrend logic
    float prevSupertrend supertrend

    if direction == 1
        supertrend 
    := close prevSupertrend upperBand math.max(lowerBandprevSupertrend)
    else
        
    supertrend := close prevSupertrend lowerBand math.min(upperBandprevSupertrend)

    int prevDirection direction
    if close supertrend
        direction 
    := -1
    if close supertrend
        direction 
    := 1

    // ============================================================================
    // Curved Radius Implementation
    // ============================================================================
    var float anchorPrice na
    var int anchorBar na
    var float velocity 0.0
    var int barCount 0

    // Detect trend change - set new anchor
    bool trendChanged direction != prevDirection

    if trendChanged
        anchorPrice 
    := supertrend
        anchorBar 
    := bar_index
        velocity 
    := 0.0
        barCount 
    := 0

    // Increment bar counter
    barCount := barCount 1

    // Calculate curved offset using acceleration creating a parabolic curve
    if not na(anchorPrice)
        
    // Acceleration increases with each bar (quadratic growth)
        
    velocity := velocity + (radiusStrength barCount)
        
        
    // Apply velocity in direction of trend
        
    if direction == 1
            
    // Uptrend - curve upward with acceleration
            
    supertrend := anchorPrice velocity
        
    else
            
    // Downtrend - curve downward with acceleration  
            
    supertrend := anchorPrice velocity

    // Apply smoothing to create flowing curves
    curvedBand ta.sma(supertrendsmoothness)

    // ============================================================================
    // Visualization
    // ============================================================================
    trendColor direction == upColor dnColor

    // Plot the curved band
    //plot(curvedBand, "Curved Radius Band", 
         //color=trendColor, 
         //linewidth=3)

    // Fill between price and band
    basePlot plot(closedisplay=display.none)
    bandPlot plot(curvedBanddisplay=display.none)
    fill(basePlotbandPlotcolor.new(trendColor85))

    // Plot smoother outer envelope
    outerBand direction == curvedBand atr curvedBand atr
    //plot(outerBand, "Outer Band", 
         //color=color.new(trendColor, 70), 
         //linewidth=1,
         //style=plot.style_circles)

    // Plot candle coloring based on trend
    barcolor(direction == upColor dnColortitle="Trend Candle Color")

    // ============================================================================
    // Signals
    // ============================================================================
    buySignal trendChanged and direction == 1
    sellSignal 
    trendChanged and direction == -1

    //plotshape(buySignal, "Buy", shape.labelup, location.belowbar, 
              //upColor, text="B", textcolor=color.white, size=size.small)
    //plotshape(sellSignal, "Sell", shape.labeldown, location.abovebar, 
             // dnColor, text="S", textcolor=color.white, size=size.small)

    // ============================================================================
    // Alerts
    // ============================================================================
    alertcondition(buySignal"Curved Buy""Curved Radius Supertrend - Buy Signal")
    alertcondition(sellSignal"Curved Sell""Curved Radius Supertrend - Sell Signal"
    16.07.2024 - 10.12.2024

  7. birleştirme denemesi...
    PHP Code:
    //@version=6
    indicator('.'overlay truemax_lines_count 500max_boxes_count 500)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    bool signalLongOnly tBull and pL
    bool signalShortOnly 
    tBear and pS

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

    // --- 6. ALERTS ---
    alertcondition(ta.crossover(highsLo) or ta.crossunder(lowbUp), '1. GP Touch''Price entered Golden Pocket.')
    alertcondition(signalLongOnly'2. Long: 2-Candle Pattern''Long confirmed in BULLISH GP.')
    alertcondition(signalShortOnly'3. Short: 2-Candle Pattern''Short confirmed in BEARISH GP.')
    alertcondition(sfpLong'4. SFP Long (Liquidity Grab)''SFP: Liquidity grab below Low.')
    alertcondition(sfpShort'5. SFP Short (Liquidity Grab)''SFP: Liquidity grab above High.')
    /////////////////////////

    // ─────────────────────────────
    // SETTINGS
    // ─────────────────────────────
    grp_logic "Logic Settings"
    backBars      input.int(300"Bars to Apply"minval 50group grp_logictooltip "Historical bars scanned for pivots.")
    pivotSrc      input.string("High/Low""Pivot Source"options = ["High/Low""Close"], group grp_logic)
    pivotStrength input.int(10"Pivot Strength"minval 5maxval 15group grp_logictooltip "Range limited to 5-15.")
    minTouches    input.int(3"Min Pivot Confirmation"minval 2maxval 8group grp_logictooltip "Range limited to 2-8.")

    grp_style "Styling"
    resColor  input.color(color.red"Resistance Color"group grp_style)
    supColor  input.color(color.green"Support Color"group grp_style)
    transpSR  input.int(50"Zone Transparency"minval 0maxval 100group grp_style)

    // ─────────────────────────────
    // INTERNAL CONSTANTS (Hidden Settings)
    // ─────────────────────────────
    float FIXED_ATR_MULT 0.5   // Fixed Zone Width
    int   FIXED_STABILITY 5    // Fixed Stability Buffer (Bars)

    // ─────────────────────────────
    // DATA STORAGE
    // ─────────────────────────────
    float atr ta.atr(14)
    float maxThreshold atr FIXED_ATR_MULT

    float srcHigh 
    pivotSrc == "Close" close high
    float srcLow  
    pivotSrc == "Close" close low

    var float[] phPrices = array.new_float(0)
    var 
    int[]   phBarIdx = array.new_int(0)
    var 
    float[] plPrices = array.new_float(0)
    var 
    int[]   plBarIdx = array.new_int(0)

    var 
    line[] allLines = array.new_line(0)
    var 
    linefill[] allFills = array.new_linefill(0)

    // Alert States
    var int[] zoneStates = array.from(00
    var 
    float[] zoneTops = array.from(0.00.0)
    var 
    float[] zoneBots = array.from(0.00.0)

    // ─────────────────────────────
    // PIVOT COLLECTION
    // ─────────────────────────────
    ph ta.pivothigh(srcHighpivotStrengthpivotStrength)
    pl ta.pivotlow(srcLowpivotStrengthpivotStrength

    if 
    not na(ph)
        array.
    push(phPricesph)
        array.
    push(phBarIdxbar_index pivotStrength)
    if 
    not na(pl)
        array.
    push(plPricespl)
        array.
    push(plBarIdxbar_index pivotStrength)

    // ─────────────────────────────
    // FILTERING & DRAWING LOGIC
    // ─────────────────────────────
    clearDrawings() =>
        if array.
    size(allLines) > 0
            
    for l in allLines
                line
    .delete(l)
            array.
    clear(allLines)
        if array.
    size(allFills) > 0
            
    for f in allFills
                linefill
    .delete(f)
            array.
    clear(allFills)

    findClosestZone(float[] pPricesint[] pIndicescolor colbool isResistance) =>
        
    int size = array.size(pPrices)
        
    int lookbackThreshold last_bar_index backBars
        int stabilityThreshold 
    last_bar_index FIXED_STABILITY
        
        
    // Logic: Look for the zone with the smallest distance to the current price
        
    float minDistanceToPrice 1e10 
        
        
    // Variables to store the winner
        
    int   bestP1x       0
        float bestP1y       
    0.0
        float bestSlopeVal  
    0.0
        float bestMaxUp     
    0.0
        float bestMaxDown   
    0.0
        bool  foundAny      
    false

        
    if size >= minTouches
            
    for 0 to size 2
                
    if array.get(pIndicesi) < lookbackThreshold
                    
    continue
                
                
    float p1_y = array.get(pPricesi)
                
    int   p1_x = array.get(pIndicesi)
                
                for 
    1 to size 1
                    float p2_y 
    = array.get(pPricesj)
                    
    int   p2_x = array.get(pIndicesj)
                    
    float currentSlope = (p2_y p1_y) / (p2_x p1_x)
                    
                    
    int touches 0
                    bool isBroken 
    false
                    float currentMaxUp 
    0.0
                    float currentMaxDown 
    0.0
                    
                    
    for 0 to size 1
                        int pk_x 
    = array.get(pIndicesk)
                        if 
    pk_x p1_x 
                            
    continue
                            
                        
    float pk_y = array.get(pPricesk)
                        
    float expected_y p1_y currentSlope * (pk_x p1_x)
                        
    float diff pk_y expected_y
                        
                        
    if math.abs(diff) <= maxThreshold
                            touches 
    += 1
                            
    if diff currentMaxUp 
                                currentMaxUp 
    := diff
                            
    if diff currentMaxDown 
                                currentMaxDown 
    := diff
                        
                        
    // Stability Breach Logic: Only discard if breach is OLDER than fixed buffer (5 bars)
                        
    if pk_x stabilityThreshold
                            
    if isResistance and diff maxThreshold
                                isBroken 
    := true
                                
    break
                            if 
    not isResistance and diff < -maxThreshold
                                isBroken 
    := true
                                
    break

                    if 
    touches >= minTouches and not isBroken
                        
    // CALCULATE DISTANCE TO CURRENT PRICE
                        
    float current_projected_y p1_y currentSlope * (last_bar_index p1_x)
                        
    float dist math.abs(current_projected_y close)
                        
                        
    // IF this valid line is CLOSER than the previous best, keep it
                        
    if dist minDistanceToPrice
                            minDistanceToPrice 
    := dist
                            bestP1x      
    := p1_x
                            bestP1y      
    := p1_y
                            bestSlopeVal 
    := currentSlope
                            bestMaxUp    
    := currentMaxUp
                            bestMaxDown  
    := currentMaxDown
                            foundAny     
    := true

        
    if foundAny
            float endY 
    bestP1y bestSlopeVal * (last_bar_index bestP1x)
            
    l_top line.new(bestP1xbestP1y bestMaxUplast_bar_indexendY bestMaxUpcolor=color.new(col50), extend=extend.right)
            
    l_bot line.new(bestP1xbestP1y bestMaxDownlast_bar_indexendY bestMaxDowncolor=color.new(col50), extend=extend.right)
            
    fill  linefill.new(l_topl_botcolor.new(coltranspSR))
            
            array.
    push(allLinesl_top)
            array.
    push(allLinesl_bot)
            array.
    push(allFillsfill)
            
            
    int idx isResistance 1
            
    array.set(zoneTopsidxendY bestMaxUp)
            array.
    set(zoneBotsidxendY bestMaxDown)
        
    foundAny

    // Execute
    clearDrawings()
    findClosestZone(phPricesphBarIdxresColortrue)
    findClosestZone(plPricesplBarIdxsupColorfalse)

    // ─────────────────────────────
    // ALERT LOGIC
    // ─────────────────────────────
    bool alertBreakout false
    bool alertTouch    
    false

    checkAlerts
    (int idx) =>
        
    float top = array.get(zoneTopsidx)
        
    float bot = array.get(zoneBotsidx)
        
    int prevState = array.get(zoneStatesidx)
        
    bool bOut false
        bool tCh 
    false
        
    if top 0
            
    if close top
                
    if prevState == -
                    bOut 
    := true
                
    array.set(zoneStatesidx1)
            else if 
    close bot
                
    if prevState == 
                    bOut 
    := true
                
    array.set(zoneStatesidx, -1)
            if (
    high >= bot and high <= top) or (low <= top and low >= bot)
                
    tCh := true
        
    [bOuttCh]

    [
    rBrT] = checkAlerts(0)
    [
    sBsT] = checkAlerts(1)
    alertBreakout := rB or sB
    alertTouch    
    := rT or sT

    alertcondition
    (alertBreakout"Zone Breakout""Price broke the zone")
    alertcondition(alertTouch"Zone Touch""Price touched the zone")
    //////////////////////

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

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

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

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

    grp_macro "Long-Term Forecast (1 Year)"
    show_macro    input.bool(false"Show 1-Year Macro Projection"group=grp_macro)
    len_macro     input.int(21"Macro Sensitivity"minval=10group=grp_macro)
    macro_spacing input.int(50"Bars per Wave (Time)"minval=5group=grp_macro)
    color_macro   input.color(#9c27b0, "Macro Color", group=grp_macro)

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

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

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

    var 
    line[]  ghostLines  = array.new_line()
    var 
    label[] ghostLabels = array.new_label()
    var 
    table   infoTable   table.new(position.top_right420border_width 1)

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

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

    drawPred(int t1float p1int t2float p2string txtstring fibcolor colint width) =>
        
    line.new(t1p1t2p2color=colstyle=line.style_dashedwidth=width)
        array.
    push(ghostLinesl)
        
        if 
    show_grid
            l_hor 
    line.new(t2p2t2 10p2color=color.new(col50), style=line.style_dottedwidth=1)
            array.
    push(ghostLinesl_hor)

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

    fillRow(int rstring tstring ffloat pcolor c) =>
        
    pct_diff = (close) / close 100
        pct_str  
    = (pct_diff "+" "") + str.tostring(pct_diff"#.##") + "%"
        
    pct_col  pct_diff >= #089981 : #f23645 
        
        
    table.cell(infoTable0rttext_color=color.whitebgcolor=ctext_size=size.small)
        
    table.cell(infoTable1rftext_color=color.whitebgcolor=color.new(c20), text_size=size.small)
        
    table.cell(infoTable2rstr.tostring(pformat.mintick), text_color=color.whitebgcolor=color.new(color.black20), text_size=size.small)
        
    table.cell(infoTable3rpct_strtext_color=pct_colbgcolor=color.new(color.black20), text_size=size.small)

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

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

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

    phM ta.pivothigh(highlen_macrolen_macro)
    plM ta.pivotlow(lowlen_macrolen_macro)

    if 
    not na(phM)
        
    addPivotMacro(phMbar_index[len_macro], truepPricesMpBarsMpDirsM)
    if 
    not na(plM)
        
    addPivotMacro(plMbar_index[len_macro], falsepPricesMpBarsMpDirsM)

    if (
    not na(ph77) or not na(pl77)) and array.size(pPrices) > 1
        p1_val 
    = array.get(pPrices0)
        
    p1_bar = array.get(pBars0)
        
    p2_val = array.get(pPrices1)
        
    p2_bar = array.get(pBars1)
        
    line.new(p2_barp2_valp1_barp1_valcolor=color_upwidth=2)

    // 3. PREDICTIVE LOGIC & TABLE
    if barstate.islast
        
    for l in ghostLines
            line
    .delete(l)
        for 
    lb in ghostLabels
            label
    .delete(lb)
        array.
    clear(ghostLines)
        array.
    clear(ghostLabels)
        
        
    table.clear(infoTable00319)
        
        if 
    show_table
            table
    .cell(infoTable00"Wave"bgcolor=color.graytext_color=color.white)
            
    table.cell(infoTable10"Fib"bgcolor=color.graytext_color=color.white)
            
    table.cell(infoTable20"Target"bgcolor=color.graytext_color=color.white)
            
    table.cell(infoTable30"% +/-"bgcolor=color.graytext_color=color.white)
        
        
    int tbl_row 

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

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

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

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

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

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

                
    // Invalidation Line
                
    if show_inv
                    inv_col 
    color.red
                    inv_y   
    rev_start_price
                    l_inv   
    line.new(rev_start_barinv_yrev_start_bar 30inv_ycolor=inv_colwidth=2style=line.style_solid)
                    array.
    push(ghostLinesl_inv)
                    
                    
    // Add Lightning Bolt if Divergence Detected
                    
    inv_txt "INV" + (has_div and show_div " ⚡" "")
                    
    inv_txt_col has_div and show_div color.yellow inv_col
                    
                    
    if show_labels
                        lb_inv 
    label.new(rev_start_bar 30inv_ytext=inv_txtcolor=color.new(color.white100), textcolor=inv_txt_colstyle=label.style_label_leftsize=size.small)
                        array.
    push(ghostLabelslb_inv)
                    
                    if 
    show_table
                        fillRow
    (tbl_row"INVALIDATION", (has_div and show_div "DIV ⚡" "Start"), inv_ycolor.red)
                        
    tbl_row += 1

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

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

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

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

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

        
    // =========================================================
        // SCENARIO 3: MACRO
        // =========================================================
        
    if show_macro and array.size(pPricesM) > 0
            last_M_val 
    = array.get(pPricesM0)
            
    last_M_bar = array.get(pBarsM0)
            
    last_M_dir = array.get(pDirsM0)
            
            
    int M_elapsed bar_index last_M_bar
            float live_M_val 
    0.0
            int   live_M_bar 
    0
            bool  live_M_dir 
    bool(na)
            
            if 
    last_M_dir 
                lowest_val 
    1000000.0
                lowest_idx 
    0
                
    for 0 to M_elapsed
                    
    if low[i] < lowest_val
                        lowest_val 
    := low[i]
                        
    lowest_idx := bar_index[i]
                
    live_M_val := lowest_val
                live_M_bar 
    := lowest_idx
                live_M_dir 
    := false 
            
    else 
                
    highest_val 0.0
                highest_idx 
    0
                
    for 0 to M_elapsed
                    
    if high[i] > highest_val
                        highest_val 
    := high[i]
                        
    highest_idx := bar_index[i]
                
    live_M_val := highest_val
                live_M_bar 
    := highest_idx
                live_M_dir 
    := true 

            float volM 
    math.abs(last_M_val live_M_val)
            if 
    volM == 
                volM 
    := syminfo.mintick 100

            int t_step_M 
    macro_spacing
            
            
    if show_table
                table
    .cell(infoTable0tbl_row"MACRO (1Y)"bgcolor=color.graytext_color=color.white)
                
    table.merge_cells(infoTable0tbl_row3tbl_row)
                
    tbl_row += 1

            
    if not live_M_dir 
                p1 
    math.max(0.01live_M_val + (volM 0.382))
                
    t1 live_M_bar t_step_M
                drawPred
    (live_M_barlive_M_valt1p1"M(1)""Start"color_macro4)
                if 
    show_table
                    fillRow
    (tbl_row"Macro 1""Start"p1color_macro)
                    
    tbl_row += 1
                
                p2 
    math.max(0.01p1 - ((p1 live_M_val) * 0.618))
                
    t2 t1 t_step_M
                drawPred
    (t1p1t2p2"M(2)""0.618"color_macro4)
                if 
    show_table
                    fillRow
    (tbl_row"Macro 2""0.618"p2color_macro)
                    
    tbl_row += 1
                
                p3 
    math.max(0.01p2 + ((p1 live_M_val) * 1.618))
                
    t3 t2 t_step_M
                drawPred
    (t2p2t3p3"M(3)""1.618"color_macro4)
                if 
    show_table
                    fillRow
    (tbl_row"Macro 3""1.618"p3color_macro)
                    
    tbl_row += 1

                p4 
    math.max(0.01p3 - ((p3 p2) * 0.382))
                
    t4 t3 t_step_M
                drawPred
    (t3p3t4p4"M(4)""0.382"color_macro4)
                if 
    show_table
                    fillRow
    (tbl_row"Macro 4""0.382"p4color_macro)
                    
    tbl_row += 1

                p5 
    math.max(0.01p4 + (p1 live_M_val))
                
    t5 t4 t_step_M
                drawPred
    (t4p4t5p5"M(5)""1.0"color_macro4)
                if 
    show_table
                    fillRow
    (tbl_row"Macro 5""1.0"p5color_macro)
                    
    tbl_row += 1
                
            
    else 
                
    pA math.max(0.01live_M_val - (volM 0.382))
                
    tA live_M_bar t_step_M
                drawPred
    (live_M_barlive_M_valtApA"M(A)""Start"color_macro4)
                if 
    show_table
                    fillRow
    (tbl_row"Macro A""Start"pAcolor_macro)
                    
    tbl_row += 1

                pB 
    math.max(0.01pA + ((live_M_val pA) * 0.618))
                
    tB tA t_step_M
                drawPred
    (tApAtBpB"M(B)""0.618"color_macro4)
                if 
    show_table
                    fillRow
    (tbl_row"Macro B""0.618"pBcolor_macro)
                    
    tbl_row += 1

                pC 
    math.max(0.01pB - ((live_M_val pA) * 1.272))
                
    tC tB t_step_M
                drawPred
    (tBpBtCpC"M(C)""1.272"color_macro4)
                if 
    show_table
                    fillRow
    (tbl_row"Macro C""1.272"pCcolor_macro)
                    
    tbl_row += 1
    ///////////////////////////////                ///// 
    16.07.2024 - 10.12.2024

  8. PHP Code:
    //@version=6
    indicator("."shorttitle="."overlay=true,
         
    max_lines_count=400max_boxes_count=50max_labels_count=5)

    //////////////////////////////////////////////////////////////////////////İMZA///////////////////////////////////////////////////////////////////////
    var tb table.new(position.bottom_center11bgcolor #161114)
    if barstate.isfirst 
        table
    .cell(tb00' Yatırım tavsiyesi olarak KULLANILAMAZ.'text_size size.normaltext_color #f4f2ef)

    //////////////////////////////////////////////////
    // Dynamic Max based on trendcode
    int trendCodeAdaptive = switch timeframe.multiplier
        1 
    => 1
        3 
    => 1
        5 
    => 1
        10 
    => 2
        15 
    => 3
        30 
    => 5
        45 
    => 5
        60 
    => 7
        120 
    => 9
        180 
    => 9
        240 
    => 13
        300 
    => 14
        360 
    => 15
        
    => int(4)


    startPSAR 0.
    increment 
    0.1
    maximum 
    trendCodeAdaptive 0.9
    psar 
    ta.sar(startPSARincrementmaximum)

    dir psar close : -1

    psarColor 
    dir == color.rgb(2302464) : color.rgb(2302464)
    psarPlot plot(psartitle 'A'style plot.style_crosslinewidth 1color psarColor)
    // Define colors for bullish and bearish conditions
    GreenFluorescent color.rgb(02550)
    RedFluorescent color.rgb(25500)

    // Inputs for the Parabolic SAR settings
    PSAR_start input(0.04title 'PSAR Start')
    PSAR_increment input(0.04title 'PSAR Increment')
    PSAR_maximum input(0.3title 'Max Value'group 'PSAR')
    PSAR_plot_line ta.sar(PSAR_startPSAR_incrementPSAR_maximum)
    /////
    PSAR_start1 input(0.03title 'PSAR Start')
    PSAR_increment1 input(0.03title 'PSAR Increment')
    PSAR_maximum1 input(0.25title 'Max Value'group 'PSAR')
    PSAR_plot_line1 ta.sar(PSAR_start1PSAR_increment1PSAR_maximum1)
    ///////
    PSAR_start12 input(0.02title 'PSAR Start')
    PSAR_increment12 input(0.02title 'PSAR Increment')
    PSAR_maximum12 input(0.2title 'Max Value'group 'PSAR')
    PSAR_plot_line12 ta.sar(PSAR_start12PSAR_increment12PSAR_maximum12)
    /////////////////////
    PSAR_start123 input(0.title 'PSAR Start')
    PSAR_increment123 input(0.1title 'PSAR Increment')
    PSAR_maximum123 input(0.9title 'Max Value'group 'PSAR')
    PSAR_plot_line123 ta.sar(PSAR_start123PSAR_increment123PSAR_maximum123)
    // Multi-timeframe inputs for SAR
    input_tf_1 input.timeframe(title 'Timeframe 1'defval ''group 'PSAR 1'// Timeframe 1 input
    output_tf_1 request.security(ticker.new(syminfo.prefixsyminfo.ticker), input_tf_1PSAR_plot_line)

    input_tf_2 input.timeframe(title 'Timeframe 2'defval ''group 'PSAR 2'// Timeframe 2 input
    output_tf_2 request.security(ticker.new(syminfo.prefixsyminfo.ticker), input_tf_2PSAR_plot_line1)

    input_tf_3 input.timeframe(title 'Timeframe 3'defval ''group 'PSAR 3'// Timeframe 3 input
    output_tf_3 request.security(ticker.new(syminfo.prefixsyminfo.ticker), input_tf_3PSAR_plot_line12)

    input_tf_32 input.timeframe(title 'Timeframe 3'defval ''group 'PSAR 3'// Timeframe 3 input
    output_tf_32 request.security(ticker.new(syminfo.prefixsyminfo.ticker), input_tf_32PSAR_plot_line123)


    // Plot SAR lines for each timeframe with color based on current price
    plot(output_tf_2"B",style plot.style_crosscolor close output_tf_2 GreenFluorescent close output_tf_2 RedFluorescent na)
    plot(output_tf_1,"C"style plot.style_crosscolor close output_tf_1 GreenFluorescent close output_tf_1 RedFluorescent na)
    plot(output_tf_3,"D"style plot.style_crosscolor close output_tf_3 GreenFluorescent close output_tf_3 RedFluorescent na)
    plot(output_tf_32,"E"style plot.style_crosscolor close output_tf_32 GreenFluorescent close output_tf_32 RedFluorescent na)
    /////////////////////////////atr hedefleme///////////////
    i_showAtr input.bool(truetitle 'Show ATR Bands'group 'general band settings'inline '11')
    i_src input.source(close'Source'group 'general band settings'inline '11')
    i_repaints input.bool(falsetitle 'Repaints?'group 'general band settings'inline '12')
    i_showLabels input.bool(true'Show labels'group 'general band settings'inline '12')
    i_extendLines input.bool(true'Extend lines'group 'general band settings'inline '12')
    i_lineThickness input.int(2'Line thickness'minval 1group 'general band settings'inline '13')
    i_lineStyle input.string(line.style_dotted'Line style'options = [line.style_dottedline.style_solidline.style_dashed], group 'general band settings'inline '13')

    i_fixedTargets input.bool(truetitle 'Fixed targets')
    i_trackingSlLength input.int(1title 'Trailing Stop loss length'minval 0)

    i_firstMult input.float(1.5title 'First atr band mult.'group 'first band settings')
    i_firstAtrLength input.int(10title 'First atr band length'group 'first band settings')
    i_firstColor input.color(color.whitetitle 'First color'group 'first band settings')

    i_secondMult input.float(3.0title 'Second band mult.'group 'second band settings')
    i_secondAtrLength input.int(10title 'Second atr band length'group 'second band settings')
    i_secondColor input.color(color.limetitle 'Second color'group 'second band settings')

    i_viPeriod input.int(10title 'Length'minval 2group 'vortex indicator settings')
    i_applyTema input.bool(truetitle 'Apply TEMA smoothing'group 'vortex indicator settings')

    arraySize i_fixedTargets 2
    index 
    i_repaints 1

    var lineArray = array.new_line()
    var 
    labelArray = array.new_label()

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

    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
                lineId 
    = array.get(_lineArray_i)
                
    x2 line.get_x2(lineId)
                
    x1 line.get_x1(lineId)
                
    yValue line.get_y1(lineId)

                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(lineIdbar_index)



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

        if 
    i_showLabels
            label lab 
    f_drawLabel(_x2math.round(_yValue2), _colorLine)
            if array.
    size(_labelArray) == arraySize
                label
    .delete(array.shift(_labelArray))

            array.
    push(_labelArraylab)

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

        array.
    push(_arrayl)


    // Vortex indicator
    vmp math.sum(math.abs(high low[1]), i_viPeriod)
    vmm math.sum(math.abs(low high[1]), i_viPeriod)
    str math.sum(ta.atr(1), i_viPeriod)
    vip i_applyTema f_tema(vmp stri_viPeriod) : vmp str
    vim 
    i_applyTema f_tema(vmm stri_viPeriod) : vmm str

    viShort 
    ta.crossunder(vipvim)
    viLong ta.crossover(vipvim)
    longBarSince ta.barssince(viLong)
    shortBarSince ta.barssince(viShort)
    viLongBarsSince longBarSince == longBarSince index
    viShortBarsSince 
    shortBarSince == shortBarSince index

    // ATR bands
    firstAtr ta.atr(i_firstAtrLength)
    secondAtr ta.atr(i_secondAtrLength)
    firstUpBand i_src firstAtr i_firstMult
    firstDownBand 
    i_src firstAtr i_firstMult
    secondUpBand 
    i_src secondAtr i_secondMult
    secondDownBand 
    i_src secondAtr i_secondMult

    // Stop loss tracking
    isLong viLongBarsSince viShortBarsSince
    yValueTracking 
    isLong firstUpBand firstDownBand
    viBarsSince 
    isLong viShortBarsSince viLongBarsSince

    // Exit plots
    line firstExit na
    label firstExitLabel 
    na
    line secondExit 
    na
    line stopLossLine 
    na

    if viShort[index]
        
    alert('VI short'alert.freq_once_per_bar_close)
        
    f_drawLineAndLabel(bar_indexbar_indexfirstDownBandi_firstColori_lineThicknessi_lineStylelineArraylabelArray)
        if 
    i_fixedTargets
            f_drawLineAndLabel
    (bar_indexbar_indexsecondDownBandi_secondColori_lineThicknessi_lineStylelineArraylabelArray)
        
    f_drawLineAndLabel(bar_indexbar_indexfirstUpBandcolor.redi_lineThicknessi_lineStylelineArraylabelArray)

    if 
    viLong[index]
        
    alert('VI long'alert.freq_once_per_bar_close)
        
    f_drawLineAndLabel(bar_indexbar_indexfirstUpBandi_firstColori_lineThicknessi_lineStylelineArraylabelArray)
        if 
    i_fixedTargets
            f_drawLineAndLabel
    (bar_indexbar_indexsecondUpBandi_secondColori_lineThicknessi_lineStylelineArraylabelArray)
        
    f_drawLineAndLabel(bar_indexbar_indexfirstDownBandcolor.redi_lineThicknessi_lineStylelineArraylabelArray)

    f_extendArray(lineArraylabelArrayi_extendLines)

    if 
    not i_fixedTargets and array.size(lineArray) > 0
        slLabelId 
    = array.get(labelArray, array.size(labelArray) - 1)
        
    slLineId = array.get(lineArray, array.size(lineArray) - 1)
        for 
    _i viBarsSince to 0 by 1
            float slValue 
    _i viBarsSince i_trackingSlLength yValueTracking[i_trackingSlLength] : yValueTracking[viBarsSince]
            if 
    not(high[_i] > slValue and low[_i] < slValue)
                
    line.set_y1(slLineIdslValue)
                
    line.set_y2(slLineIdslValue)
                
    line.set_x1(slLineIdbar_index[i_trackingSlLength])
                
    label.set_y(slLabelIdslValue)
                
    label.set_text(slLabelId'         ' str.tostring(math.round(slValue2)))
    ////////////////////////////////////////////////////////KÖPEKBALIĞI///////////////////////////////////////////////////
    bgcolorEnabled input(truetitle 'Background ')
    barcolorEnabled input(truetitle 'Bar ')
    // KALIP KURALI//////////
    ISP32 low[2] < low[1] and low[1] < low and high[2] > high[1] and high[1] > high

    if ISP32
        
        boxlen 
    0
        future_bar_index_lines 
    bar_index 3
        future_bar_index_fill 
    bar_index boxlen

        line
    .new(x1 bar_index[2], y1 low[2], x2 future_bar_index_linesy2 low[2], color color.fuchsiawidth 4extend extend.none)
        
    line.new(x1 bar_index[2], y1 high[2], x2 future_bar_index_linesy2 high[2], color color.fuchsiawidth 4extend extend.none)
        
    //////////////////////
        
    //////////////////////////////BAR RENKLENDİR////////////////////
    f_colorNew(_color_transp) =>
        var 
    _r color.r(_color)
        var 
    _g color.g(_color)
        var 
    _b color.b(_color)
        
    color _return color.rgb(_r_g_b_transp)
        
    _return


    //automatic higher timeframe chooser
    f_autoHTF(str) =>
        
    str == '1S' or str == '5S' or str == '10S' or str == '15S' or str == '20S' or str == '30S' or str == '40S' or str == '45S' or str == '50S' '1' str == '1' or str == '2' or str == '3' or str == '4' '5' str == '5' or str == '10' '15' str == '15' or str == '20' '30' str == '30' or str == '45' or str == '50' '60' str == '60' or str == '90' or str == '100' '120' str == '120' or str == '180' '240' str == '240' 'D' str == 'D' 'W' str == 'W' '2W' 'M'
    var string ticker syminfo.tickerid
    var string tfp timeframe.period
    htf1 
    f_autoHTF(tfp)
    htf2 f_autoHTF(htf1)
    htf3 f_autoHTF(htf2)
    htf4 f_autoHTF(htf3)

    f_security(_sym_res_src_rep) =>
        
    request.security(_sym_res_src[not _rep and barstate.isrealtime 0])[_rep or barstate.isrealtime 1]

    //PSAR inputs
    grpin '⚙=====-----'
    grpout '-----=====⚙'
    grpPSAR grpin 'ÇİFT SAR:' grpout
    colorBull 
    input.color(defval color.rgb(2502502510), group grpPSARtitle 'BOĞA'
    colorBear input.color(defval #fc0707, group = grpPSAR, title = 'AYI') 
    colorWait input.color(defval color.rgb(48247), group grpPSARtitle 'BEKLE'
    psar_start input.float(defval 0.04group grpPSARtitle 'PSAR: Start'minval 0.maxval 2step 0.1)
    psar_accel input.float(defval 0.04group grpPSARtitle 'PSAR: Acceleration  Factor'minval 0.maxval 2step 0.1)
    psar_maximum input.float(defval 0.3group grpPSARtitle 'PSAR: Extreme Point'minval 0.maxval 2)

    f_psar() =>
        
    ta.sar(psar_startpsar_accelpsar_maximum)

    psar_ctf f_psar()
    psar_htf f_security(tickerhtf1f_psar(), false)

    longZone psar_ctf low and psar_htf low
    shortZone 
    psar_ctf high and psar_htf high
    waitZone 
    not longZone and not shortZone
    trendSupportColor 
    longZone colorBull shortZone colorBear colorWait
    barcolor
    (trendSupportColor)
    //////////////
    //@version=6
    init12 input.float(0.0002title 'init1ial Start'step 0.001)
    fi input.float(1title 'Increment/Start Ratio'step 0.1)
    fm input.float(10title 'Max/Start Ratio'step 0.1)
    //ac = input(true, title = 'Adaptive Coloring')
    sar09 ta.sar(init12 10init12 fi 10init12 fm 10)
    plot(sar09title 'F'style plot.style_crosscolor=color.yellowlinewidth 1)
    /////////////////////
    //@version=6
    start46 input(0.)
    increment46 input(0.1)
    maximum46 input(0.9"Max Value")
    out55 ta.sar(start46increment46maximum46)
    plot_color close out55 color.rgb(518264) : close out55 color.rgb(16977) : na

    show_header 
    input(falsetitle="Show header?"group='Table Settings')
    dashboard_position input.string("Top center"title="Position"options=["Top right",  "Top center",  "Middle right"], group='Table Settings')
    text_size input.string('Normal'title="Size"options=["Tiny""Small""Normal""Large"], group='Table Settings')
    text_color input.color(color.rgb(1168224), title="Text color"group='Table Settings')
    table_color input.color(color.purpletitle="Border color"group='Table Settings')
    uptrend_indicator "🔵"
    downtrend_indicator "🟠"

    tf11 input.timeframe("1"title="Timeframe 1")
    tf22 input.timeframe("3"title="Timeframe 2")
    tf33 input.timeframe("5"title="Timeframe 3")
    tf4 input.timeframe("10"title="Timeframe 4")
    tf5 input.timeframe("15"title="Timeframe 5")
    tf6 input.timeframe("30"title="Timeframe 6")
    tf7 input.timeframe("60"title="Timeframe 7")
    tf8 input.timeframe("120"title="Timeframe 8")
    tf9 input.timeframe("240"title="Timeframe 9")
    tf10 input.timeframe("D"title="Timeframe 10")


    var 
    table_position dashboard_position == 'Top center' position.middle_left :
      
    dashboard_position == 'Top center' position.middle_right :
      
    dashboard_position == 'Middle right' position.middle_right position.middle_right
      
    var table_text_size text_size == 'Normal' size.normal :
      
    text_size == 'Small' size.small size.normal

    var table.new(position=table_positioncolumns=3rows=20frame_color=#cdcbcb, frame_width=5, border_color=table_color, border_width=1,bgcolor =color.rgb(21, 21, 21) )

    get_trend_status(trend_value) =>
        
    is_uptrend close trend_value
        candle_now 
    is_uptrend uptrend_indicator downtrend_indicator
        candle_now

    //--------------------------------------------------------------------------------------

    sar_1 request.security(syminfo.tickeridtf11ta.sar(start46increment46maximum46))
    sar_2 request.security(syminfo.tickeridtf22ta.sar(start46increment46maximum46))
    sar_3 request.security(syminfo.tickeridtf33ta.sar(start46increment46maximum46))
    sar_4 request.security(syminfo.tickeridtf4ta.sar(start46increment46maximum46))
    sar_5 request.security(syminfo.tickeridtf5ta.sar(start46increment46maximum46))
    sar_6 request.security(syminfo.tickeridtf6ta.sar(start46increment46maximum46))
    sar_7 request.security(syminfo.tickeridtf7ta.sar(start46increment46maximum46))
    sar_8 request.security(syminfo.tickeridtf8ta.sar(start46increment46maximum46))
    sar_9 request.security(syminfo.tickeridtf9ta.sar(start46increment46maximum46))
    sar_10 request.security(syminfo.tickeridtf10ta.sar(start46increment46maximum46))


    trend_indicator_1 get_trend_status(sar_1)
    trend_indicator_2 get_trend_status(sar_2)
    trend_indicator_3 get_trend_status(sar_3)
    trend_indicator_4 get_trend_status(sar_4)
    trend_indicator_5 get_trend_status(sar_5)
    trend_indicator_6 get_trend_status(sar_6)
    trend_indicator_7 get_trend_status(sar_7)
    trend_indicator_8 get_trend_status(sar_8)
    trend_indicator_9 get_trend_status(sar_9)
    trend_indicator_10 get_trend_status(sar_10)

    if 
    tf11 == "60"
        
    tf11 := "1H"
    if tf11 == "120"
        
    tf11 := "2H"
    if tf11 == "180"
        
    tf11 := "3H"
    if tf11 == "240"
        
    tf11 := "4H"

    if tf22 == "60"
        
    tf22 := "1H"
    if tf22 == "120"
        
    tf22 := "2H"
    if tf22 == "180"
        
    tf22 := "3H"
    if tf22 == "240"
        
    tf22 := "4H"

    if tf33 == "60"
        
    tf33 := "1H"
    if tf33 == "120"
        
    tf33 := "2H"
    if tf33 == "180"
        
    tf33 := "3H"
    if tf33 == "240"
        
    tf33 := "4H"

    if tf4 == "60"
        
    tf4 := "1H"
    if tf4 == "120"
        
    tf4 := "2H"
    if tf4 == "180"
        
    tf4 := "3H"
    if tf4 == "240"
        
    tf4 := "4H"

    if tf5 == "60"
        
    tf5 := "1H"
    if tf5 == "120"
        
    tf5 := "2H"
    if tf5 == "180"
        
    tf5 := "3H"
    if tf5 == "240"
        
    tf5 := "4H"

    if tf6 == "60"
        
    tf6 := "1H"
    if tf6 == "120"
        
    tf6 := "2H"
    if tf6 == "180"
        
    tf6 := "3H"
    if tf6 == "240"
        
    tf6 := "4H"

    if tf7 == "60"
        
    tf7 := "1H"
    if tf7 == "120"
        
    tf7 := "2H"
    if tf7 == "180"
        
    tf7 := "3H"
    if tf7 == "240"
        
    tf7 := "4H"

    if tf8 == "60"
        
    tf8 := "1H"
    if tf8 == "120"
        
    tf8 := "2H"
    if tf8 == "180"
        
    tf8 := "3H"
    if tf8 == "240"
        
    tf8 := "4H"

    if tf9 == "60"
        
    tf9 := "1H"
    if tf9 == "120"
        
    tf9 := "2H"
    if tf9 == "180"
        
    tf9 := "3H"
    if tf9 == "240"
        
    tf9 := "4H"

    if tf10 == "60"
        
    tf10 := "1H"
    if tf10 == "120"
        
    tf10 := "2H"
    if tf10 == "180"
        
    tf10 := "3H"
    if tf10 == "240"
        
    tf10 := "4H"


    //---------------------------------------------------------------------------------------------
    // Update table with trend data
    //---------------------------------------------------------------------------------------------
    if (barstate.islast)
       
        
    table.cell(t01tf11text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))
        
    table.cell(t11text="●"text_color=trend_indicator_1==uptrend_indicator?color.lime:color.red,text_size size.large)
        
    table.cell(t21str.tostring(sar_1"#.##"), text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))

        
    table.cell(t02tf22text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))
        
    table.cell(t12text="●"text_color=trend_indicator_2==uptrend_indicator?color.lime:color.red,text_size size.large)
        
    table.cell(t22str.tostring(sar_2"#.##"), text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))
        
        
    table.cell(t03tf33text_color=color.whitetext_size=table_text_size,bgcolorcolor.rgb(212121))
        
    table.cell(t13text="●"text_color=trend_indicator_3==uptrend_indicator?color.lime:color.red,text_size size.large)
        
    table.cell(t23str.tostring(sar_3"#.##"), text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))

        
    table.cell(t04tf4text_color=color.whitetext_size=table_text_sizebgcolor color.rgb(212121))
        
    table.cell(t14text="●"text_color=trend_indicator_4==uptrend_indicator?color.lime:color.red,text_size size.large)
        
    table.cell(t24str.tostring(sar_4"#.##"), text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))

        
    table.cell(t05tf5text_color=color.whitetext_size=table_text_sizebgcolor color.rgb(212121))
        
    table.cell(t15text="●"text_color=trend_indicator_5==uptrend_indicator?color.lime:color.red,text_size size.large)
        
    table.cell(t25str.tostring(sar_5"#.##"), text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))

        
    table.cell(t06tf6text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))
        
    table.cell(t16text="●"text_color=trend_indicator_6==uptrend_indicator?color.lime:color.red,text_size size.large)
        
    table.cell(t26str.tostring(sar_6"#.##"), text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))

        
    table.cell(t07tf7text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))
        
    table.cell(t17text="●"text_color=trend_indicator_7==uptrend_indicator?color.lime:color.red,text_size size.large)
        
    table.cell(t27str.tostring(sar_7"#.##"), text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))

        
    table.cell(t08tf8text_color=color.whitetext_size=table_text_size,bgcolor =  color.rgb(212121))
        
    table.cell(t18text="●"text_color=trend_indicator_8==uptrend_indicator?color.lime:color.red,text_size size.large)
        
    table.cell(t28str.tostring(sar_8"#.##"), text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))

        
    table.cell(t09tf9text_color=color.whitetext_size=table_text_size,bgcolor =  color.rgb(212121))
        
    table.cell(t19text="●"text_color=trend_indicator_9==uptrend_indicator?color.lime:color.red,text_size size.large)
        
    table.cell(t29str.tostring(sar_9"#.##"), text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))

        
    table.cell(t010tf10text_color=color.whitetext_size=table_text_size,bgcolor =  color.rgb(212121))
        
    table.cell(t110text="●"text_color=trend_indicator_10==uptrend_indicator?color.lime:color.red,text_size size.large)
        
    table.cell(t210str.tostring(sar_10"#.##"), text_color=color.whitetext_size=table_text_size,bgcolor color.rgb(212121))

     
    table.cell(t,0,0,"Periyot",text_color color.white,bgcolor color.rgb(212121))
    table.cell(t,1,0,"Trend",text_color color.white,bgcolor color.rgb(212121))
    table.cell(t,2,0,"Fiyat",text_color color.white,bgcolor color.rgb(212121))

    lookback input.int(5"Line Lookback Period"minval=1)

    ////////////////////// 
    https://www.tradingview.com/x/NTVDeqj3/
    16.07.2024 - 10.12.2024

Sayfa 362/363 İlkİlk ... 262312352360361362363 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
  •