Sayfa 285/286 İlkİlk ... 185235275283284285286 SonSon
Arama sonucu : 2284 madde; 2,273 - 2,280 arası.

Konu: Tradingview

  1. https://tr.tradingview.com/script/ITCgiV4j/
    Super Oscilador by Rouro
    PHP Code:
    //@version=5
    indicator("Super Oscilador by Rouro"overlay=false)

    // === INPUTS DE INDICADORES ===
    rsiPeriod      input.int(14,   title="RSI - Periodo")
    stochKPeriod   input.int(14,   title="Stochastic %K - Periodo")
    cciPeriod      input.int(20,   title="CCI - Periodo")
    rocPeriod      input.int(10,   title="ROC - Periodo")
    willrPeriod    input.int(14,   title="Williams %R - Periodo")

    rsiOver        input.int(70,   title="RSI - Sobrecompra")
    rsiUnder       input.int(30,   title="RSI - Sobreventa")
    stochOver      input.int(80,   title="Stochastic - Sobrecompra")
    stochUnder     input.int(20,   title="Stochastic - Sobreventa")
    cciOver        input.int(100,  title="CCI - Sobrecompra")
    cciUnder       input.int(-100title="CCI - Sobreventa")

    // ROC manual (por si no se usa ATR)
    rocManualOver  input.float(0.5,  title="ROC % Sobrecompra (manual)")
    rocManualUnder input.float(-0.5title="ROC % Sobreventa (manual)")

    // Selector de método dinámico
    useATR         input.bool(true,  title="Usar ATR para ROC dinámico")
    atrPeriod      input.int(14,     title="ATR - Periodo para ROC")
    atrFactor      input.float(1.0,  title="Factor ATR → umbral ROC")

    willrOver      input.int(-20,   title="Williams %R - Sobrecompra")
    willrUnder     input.int(-80,   title="Williams %R - Sobreventa")

    // OPCIONES VISUALES
    mostrarLineaBase input.bool(falsetitle="Mostrar línea base")
    emaSuavizado     input.int(5,     title="Periodo de suavizado EMA")
    nivelInferior    input.float(-0.8title="Nivel Inferior (Sobreventa)")
    nivelSuperior    input.float0.8title="Nivel Superior (Sobrecompra)")

    // === CÁLCULO DE INDICADORES ===
    rsiVal    ta.rsi(closersiPeriod)
    stochVal  ta.stoch(highlowclosestochKPeriod)
    cciVal    ta.cci(closecciPeriod)
    rocVal    ta.roc(closerocPeriod)  // ROC en %  
    den       ta.highest(highwillrPeriod) - ta.lowest(lowwillrPeriod)
    willrVal  den != ? -100 * (ta.highest(highwillrPeriod) - close) / den na

    // === CÁLCULO ROC dinámico vía ATR ===
    atrPct      ta.atr(atrPeriod) / close 100
    rocATROver  
    atrPct atrFactor
    rocATRUnder 
    = -rocATROver
    rocOver     
    useATR rocATROver  rocManualOver
    rocUnder    
    useATR rocATRUnder rocManualUnder

    // === SCORES INDIVIDUALES ===
    rsiScore   rsiVal   rsiOver    ?  rsiVal   rsiUnder    ? -0
    stochScore 
    stochVal stochOver  ?  stochVal stochUnder  ? -0
    cciScore   
    cciVal   cciOver    ?  cciVal   cciUnder    ? -0
    rocScore   
    rocVal   rocOver    ?  rocVal   rocUnder    ? -0
    willrScore 
    willrVal willrOver  ?  willrVal willrUnder  ? -0

    // === NORMALIZACIÓN & SUAVIZADO ===
    score     rsiScore stochScore cciScore rocScore willrScore
    lineaOsc  
    score 5
    emaOsc    
    ta.ema(lineaOscemaSuavizado)

    // === COLOR DINÁMICO DEL OSCILADOR ===
    oscColor emaOsc nivelSuperior color.red :
               
    emaOsc nivelInferior  color.green :
               
    color.blue

    // === PLOTS DEL OSCILADOR ===
    plot(emaOsc,                                title="EMA Súper Oscilador"color=oscColorlinewidth=2)
    plot(mostrarLineaBase lineaOsc na,     title="Línea base",          color=color.graylinewidth=1)
    hline(nivelSuperior"Sobrecompra",        color=color.new(color.red,   60), linestyle=hline.style_dashed)
    hline(0,             "Centro",             color=color.gray,                linestyle=hline.style_dotted)
    hline(nivelInferior,"Sobreventa",          color=color.new(color.green60), linestyle=hline.style_dashed)

    // === TABLA SEMÁFORO ===
    rsiState   rsiScore   ==  color.green rsiScore   == -color.red   color.gray
    stochState 
    stochScore ==  color.green stochScore == -color.red   color.gray
    cciState   
    cciScore   ==  color.green cciScore   == -color.red   color.gray
    rocState   
    rocScore   ==  color.green rocScore   == -color.red   color.gray
    willrState 
    willrScore ==  color.green willrScore == -color.red   color.gray

    var table semaforo table.new(position.top_right26border_width=1frame_width=1)
    if 
    barstate.islast
        table
    .cell(semaforo00"IND"text_color=color.whitebgcolor=color.black)
        
    table.cell(semaforo10"EST"text_color=color.whitebgcolor=color.black)
        
    table.cell(semaforo01"RSI"text_color=color.white)
        
    table.cell(semaforo11"●",   text_color=rsiState,   bgcolor=color.new(rsiState,   85))
        
    table.cell(semaforo02"STO"text_color=color.white)
        
    table.cell(semaforo12"●",   text_color=stochStatebgcolor=color.new(stochState85))
        
    table.cell(semaforo03"CCI"text_color=color.white)
        
    table.cell(semaforo13"●",   text_color=cciState,   bgcolor=color.new(cciState,   85))
        
    table.cell(semaforo04"ROC"text_color=color.white)
        
    table.cell(semaforo14"●",   text_color=rocState,   bgcolor=color.new(rocState,   85))
        
    table.cell(semaforo05"W%R"text_color=color.white)
        
    table.cell(semaforo15"●",   text_color=willrStatebgcolor=color.new(willrState85))

    // === SEÑALES DENTRO DEL PANEL DEL OSCILADOR ===
    // Venta: sale de sobrecompra (cierre bajo nivelSuperior)
    sellSignal ta.crossunder(emaOscnivelSuperior) and barstate.isconfirmed
    // Compra: sale de sobreventa (cierre sobre nivelInferior)
    buySignal  ta.crossover (emaOscnivelInferior)  and barstate.isconfirmed

    plotshape
    (series   sellSignal   nivelSuperior na,title    "Señal Venta",style    shape.triangledown,location location.absolute,size     size.small,color    color.red,text     "Sell")


    plotshape(series   buySignal    nivelInferior  na,title    "Señal Compra",style    shape.triangleup,location location.absolute,size     size.small,color    color.green,text     "Buy")

    // === ALERTAS PARA TRADINGVIEW ===
    alertcondition(sellSignal"Señal Venta""El Súper Oscilador sale de sobrecompra")
    alertcondition(buySignal,  "Señal Compra","El Súper Oscilador sale de sobreventa"
    16.07.2024 - 10.12.2024

  2. https://tr.tradingview.com/script/u7...n%C3%BC%C5%9F/
    Fibonacci Trend v7.2 - MA50 Şartsız Dönüş
    PHP Code:
    //@version=5
    strategy("Fibonacci Trend v7.2 - MA50 Şartsız Dönüş"overlay=truedefault_qty_type=strategy.percent_of_equitydefault_qty_value=100)

    // === Parametreler ===
    fibLen     input.int(50"Fibonacci Aralığı")
    fibTol     input.float(0.01"Fib Yakınlık Toleransı (%)"step=0.001)
    slMult     input.float(1.5"SL - ATR"step=0.1)
    tp2Mult    input.float(2.0"TP2 - ATR"step=0.1)
    volMult    input.float(1.5"Hacim Çarpanı"step=0.1)
    srLookback input.int(20"Destek/Direnç Mum Sayısı")

    // === Göstergeler ===
    ema50   ta.ema(close50)
    atr     ta.atr(14)
    volumeMA ta.sma(volume20)

    // === Fibonacci Seviyeleri ===
    lowestLow   ta.lowest(lowfibLen)
    highestHigh ta.highest(highfibLen)
    fibRange    highestHigh lowestLow

    f0 
    lowestLow
    f236  
    lowestLow 0.236 fibRange
    f382  
    lowestLow 0.382 fibRange
    f500  
    lowestLow 0.5   fibRange
    f618  
    lowestLow 0.618 fibRange
    f786  
    lowestLow 0.786 fibRange
    f1 
    highestHigh

    // === Fibonacci Çizgileri ===
    plot(f0title="Fib 0.0"color=color.gray)
    plot(f236title="Fib 0.236"color=color.red)
    plot(f382title="Fib 0.382"color=color.orange)
    plot(f500title="Fib 0.5"color=color.gray)
    plot(f618title="Fib 0.618"color=color.green)
    plot(f786title="Fib 0.786"color=color.green)
    plot(f1title="Fib 1.0"color=color.blue)

    // === Fitil ve Hacim Tespiti ===
    longWick   close open and (low f0 or math.abs(low f0)/close fibTol)
    shortWick  close open and (high f1 or math.abs(high f1)/close fibTol)

    volSpike   volume volumeMA volMult

    // === Long / Short Koşulları ===
    canLong  longWick and volSpike
    canShort 
    shortWick and volSpike

    // Önceki poz kontrolü
    notInPosition strategy.position_size == 0

    // === Sinyaller ===
    if canLong and notInPosition
        strategy
    .entry("Long"strategy.long)
        
    entry close
        sl 
    entry atr slMult
        tp 
    entry atr tp2Mult
        strategy
    .exit("TP/SL Long"from_entry="Long"stop=sllimit=tp)

    if 
    canShort and notInPosition
        strategy
    .entry("Short"strategy.short)
        
    entry close
        sl 
    entry atr slMult
        tp 
    entry atr tp2Mult
        strategy
    .exit("TP/SL Short"from_entry="Short"stop=sllimit=tp)

    // === Etiketler ===
    plotshape(canLong and notInPositionlocation=location.belowbarcolor=color.greenstyle=shape.labeluptext="Long")
    plotshape(canShort and notInPositionlocation=location.abovebarcolor=color.redstyle=shape.labeldowntext="Short"
    16.07.2024 - 10.12.2024

  3. https://tr.tradingview.com/script/MX8EUksX/
    Super SMA 5 8 13
    PHP Code:
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © tamerbozoglu
    //@version=4

    // ══════════════════════════════════════════════════════════════════════════════════════════════════ //
    //# * ══════════════════════════════════════════════════════════════════════════════════════════════
    //# *
    //# * Study       : SMA 5 8 13 Buy / Sell Signal
    //# * Author      : @BozzTamer
    //# * Strategist  : @xtrader_
    //# * Revision History
    //# * Release     : Sep 17, 2023
    //# * 
    //# *
    //# * ══════════════════════════════════════════════════════════════════════════════════════════════
    // ══════════════════════════════════════════════════════════════════════════════════════════════════ //
    //
    //This indicator is based on the 5 8 13 simple moving average strategy of strategist Selcuk Gonencler.
    //The indicator shows buy and sell signals when favorable conditions occur.

    // ══ H O W    T O    U S E ══════════════════════════════════════════════════════════════════════════ //
    // Above 5-8-13 - Confirmed hold/buy
    // 5 below (8-13 above) - Be careful, lose weight but don't run away.
    // Below 5-8 (above 13) - Risk has begun. Don't be stubborn. 13 is your last castle.
    // 5-8-13 below. Don't fight! Wait until it rises above 5-8 again.

    study(title="Super SMA 5 8 13"overlay=true)

    src close
    ma5 
    sma(src5)
    ma8 sma(src8)
    ma13 sma(src13)
    buy_cond cross(ma5ma13) and ma5 ma13
    sell_cond 
    cross(ma5ma13) and ma5 ma8 and ma5 ma13

    plot
    ma5color=color.rgb(02558), style=plot.style_linetitle="SMA 5"linewidth=2transp 0)
    plotma8color=color.rgb(2552300), style=plot.style_linetitle="SMA 8"linewidth=2transp 0)
    plotma13color=color.rgb(25500), style=plot.style_linetitle="SMA 13"linewidth=2transp 0)

    plotarrow(buy_cond 0colordown=color.rgb(02558), title="BUY SIGNAL",maxheight=50minheight=50transp 0)
    plotarrow(sell_cond ? -0colorup=color.rgb(25500), title="SELL SIGNAL",maxheight=50minheight=50transp 0)

    alertcondition(buy_condtitle "Buy Condition"message "Buy Alert!")
    alertcondition(sell_condtitle "Sell Condition"message "Sell Alert!"
    versiyon 5 hali
    PHP Code:
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © tamerbozoglu
    //@version=5

    // ══════════════════════════════════════════════════════════════════════════════════════════════════ //
    //# * ══════════════════════════════════════════════════════════════════════════════════════════════
    //# *
    //# * Study       : SMA 5 8 13 Buy / Sell Signal
    //# * Author      : @BozzTamer
    //# * Strategist  : @xtrader_
    //# * Revision History
    //# * Release     : Sep 17, 2023
    //# * 
    //# *
    //# * ══════════════════════════════════════════════════════════════════════════════════════════════
    // ══════════════════════════════════════════════════════════════════════════════════════════════════ //
    //
    //This indicator is based on the 5 8 13 simple moving average strategy of strategist Selcuk Gonencler.
    //The indicator shows buy and sell signals when favorable conditions occur.

    // ══ H O W    T O    U S E ══════════════════════════════════════════════════════════════════════════ //
    // Above 5-8-13 - Confirmed hold/buy
    // 5 below (8-13 above) - Be careful, lose weight but don't run away.
    // Below 5-8 (above 13) - Risk has begun. Don't be stubborn. 13 is your last castle.
    // 5-8-13 below. Don't fight! Wait until it rises above 5-8 again.

    indicator(title='Super SMA 5 8 13'overlay=true)

    src close
    ma5 
    ta.sma(src5)
    ma8 ta.sma(src8)
    ma13 ta.sma(src13)
    buy_cond ta.cross(ma5ma13) and ma5 ma13
    sell_cond 
    ta.cross(ma5ma13) and ma5 ma8 and ma5 ma13

    plot
    (ma5color=color.rgb(02558), style=plot.style_linetitle='SMA 5'linewidth=2transp=0)
    plot(ma8color=color.rgb(2552300), style=plot.style_linetitle='SMA 8'linewidth=2transp=0)
    plot(ma13color=color.rgb(25500), style=plot.style_linetitle='SMA 13'linewidth=2transp=0)

    plotarrow(buy_cond 0colordown=color.rgb(02558), title='BUY SIGNAL'maxheight=50minheight=50transp=0)
    plotarrow(sell_cond ? -0colorup=color.rgb(25500), title='SELL SIGNAL'maxheight=50minheight=50transp=0)

    alertcondition(buy_condtitle='Buy Condition'message='Buy Alert!')
    alertcondition(sell_condtitle='Sell Condition'message='Sell Alert!'
    versiyon 6 hali
    PHP Code:
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © tamerbozoglu
    //@version=6

    // ══════════════════════════════════════════════════════════════════════════════════════════════════ //
    //# * ══════════════════════════════════════════════════════════════════════════════════════════════
    //# *
    //# * Study       : SMA 5 8 13 Buy / Sell Signal
    //# * Author      : @BozzTamer
    //# * Strategist  : @xtrader_
    //# * Revision History
    //# * Release     : Sep 17, 2023
    //# * 
    //# *
    //# * ══════════════════════════════════════════════════════════════════════════════════════════════
    // ══════════════════════════════════════════════════════════════════════════════════════════════════ //
    //
    //This indicator is based on the 5 8 13 simple moving average strategy of strategist Selcuk Gonencler.
    //The indicator shows buy and sell signals when favorable conditions occur.

    // ══ H O W    T O    U S E ══════════════════════════════════════════════════════════════════════════ //
    // Above 5-8-13 - Confirmed hold/buy
    // 5 below (8-13 above) - Be careful, lose weight but don't run away.
    // Below 5-8 (above 13) - Risk has begun. Don't be stubborn. 13 is your last castle.
    // 5-8-13 below. Don't fight! Wait until it rises above 5-8 again.

    indicator(title 'Super SMA 5 8 13'overlay true)

    src close
    ma5 
    ta.sma(src5)
    ma8 ta.sma(src8)
    ma13 ta.sma(src13)
    buy_cond ta.cross(ma5ma13) and ma5 ma13
    sell_cond 
    ta.cross(ma5ma13) and ma5 ma8 and ma5 ma13

    plot
    (ma5color color.rgb(02558), style plot.style_linetitle 'SMA 5'linewidth 2)
    plot(ma8color color.rgb(2552300), style plot.style_linetitle 'SMA 8'linewidth 2)
    plot(ma13color color.rgb(25500), style plot.style_linetitle 'SMA 13'linewidth 2)

    plotarrow(buy_cond 0colordown color.rgb(02558), title 'BUY SIGNAL'maxheight 50minheight 50)
    plotarrow(sell_cond ? -0colorup color.rgb(25500), title 'SELL SIGNAL'maxheight 50minheight 50)

    alertcondition(buy_condtitle 'Buy Condition'message 'Buy Alert!')
    alertcondition(sell_condtitle 'Sell Condition'message 'Sell Alert!'
    sade hali...sinyalli...
    PHP Code:
    //@version=6
    indicator(title 'Super SMA 5 8 13'overlay true)

    src close
    ma5 
    ta.sma(src5)
    ma8 ta.sma(src8)
    ma13 ta.sma(src13)
    buy_cond ta.cross(ma5ma13) and ma5 ma13
    sell_cond 
    ta.cross(ma5ma13) and ma5 ma8 and ma5 ma13

    //plot(ma5, color = color.rgb(0, 255, 8), style = plot.style_line, title = 'SMA 5', linewidth = 2)
    //plot(ma8, color = color.rgb(255, 230, 0), style = plot.style_line, title = 'SMA 8', linewidth = 2)
    //plot(ma13, color = color.rgb(255, 0, 0), style = plot.style_line, title = 'SMA 13', linewidth = 2)

    plotarrow(buy_cond 0colordown color.rgb(02558), title 'BUY SIGNAL'maxheight 50minheight 50)
    plotarrow(sell_cond ? -0colorup color.rgb(25500), title 'SELL SIGNAL'maxheight 50minheight 50
    16.07.2024 - 10.12.2024

  4. periyotler için en iyi sma bulucu....https://tr.tradingview.com/script/WL...st-SMA-Finder/

    bunu kullanarak...

    örneğin x100 için...
    sma değerlerini değiştirerek kullanılabilir...
    1dak-15dak ve 1 saatlik için bulunan değerler uygulanınca...
    saatlik görüntü...https://www.tradingview.com/x/S2TkbLBd/
    16.07.2024 - 10.12.2024


  5. PHP Code:
    //@version=6
    indicator(title 'Master Trend BUY&SELL'shorttitle 'MASTER TREND BUY&SELL'overlay true)

    // Color variables
    upTrendColor color.green
    neutralColor 
    #0e0e0e
    downTrendColor color.red
    fillColor 
    color.rgb(12121270// Color between lines
    yellowColor color.rgb(2302142)
    blackTextColor color.rgb(000)
    blueColor color.rgb(2332170)
    whiteTextColor color.rgb(777)
    greenColor color.green
    redColor 
    color.red

    // Source
    source input(defval closetitle 'Source')

    // Sampling Period
    period input.int(defval 100minval 1title 'Sampling Period')

    // Range Multiplier
    multiplier input.float(defval 3.0minval 0.1title 'Range Multiplier')

    // Take Profit Settings
    takeProfitPips input.float(defval 600.0title 'Take Profit (in pips)')

    // Smooth Average Range
    smoothRange(xtm) =>
        
    adjustedPeriod 1
        avgRange 
    ta.ema(math.abs(x[1]), t)
        
    smoothRange ta.ema(avgRangeadjustedPeriod) * m
        smoothRange
    smoothedRange 
    smoothRange(sourceperiodmultiplier)

    // Trend Filter
    trendFilter(xr) =>
        
    filtered x
        filtered 
    := nz(filtered[1]) ? nz(filtered[1]) ? nz(filtered[1]) : nz(filtered[1]) ? nz(filtered[1]) : r
        filtered
    filter 
    trendFilter(sourcesmoothedRange)

    // Filter Direction
    upCount 0.0
    upCount 
    := filter filter[1] ? nz(upCount[1]) + filter filter[1] ? nz(upCount[1])
    downCount 0.0
    downCount 
    := filter filter[1] ? nz(downCount[1]) + filter filter[1] ? nz(downCount[1])

    // Colors
    filterColor upCount upTrendColor downCount downTrendColor neutralColor

    // Double Line Design
    lineOffset smoothedRange 0.1
    //upperLinePlot = plot(filter + lineOffset, color = filterColor, linewidth = 3, title = 'Upper Trend Line')
    lowerLinePlot plot(filter lineOffsetcolor filterColorlinewidth 3title 'Lower Trend Line')
    //fill(upperLinePlot, lowerLinePlot, color = fillColor, title = 'Trend Fill')


    // Break Outs
    longCondition bool(na)
    shortCondition bool(na)
    longCondition := source filter and source source[1] and upCount or source filter and source source[1] and upCount 0
    shortCondition 
    := source filter and source source[1] and downCount or source filter and source source[1] and downCount 0

    initialCondition 
    0
    initialCondition 
    := longCondition shortCondition ? -initialCondition[1]
    longSignal longCondition and initialCondition[1] == -1
    shortSignal 
    shortCondition and initialCondition[1] == 1

    // Take Profit Logic
    var float entryPriceBuy na
    var float entryPriceSell na
    takeProfitSignalBuy 
    false
    takeProfitSignalSell 
    false

    if longSignal
        entryPriceBuy 
    := source
        entryPriceBuy
    if not na(entryPriceBuy) and source >= entryPriceBuy takeProfitPips syminfo.mintick
        takeProfitSignalBuy 
    := true
        entryPriceBuy 
    := na
        entryPriceBuy

    if shortSignal
        entryPriceSell 
    := source
        entryPriceSell
    if not na(entryPriceSell) and source <= entryPriceSell takeProfitPips syminfo.mintick
        takeProfitSignalSell 
    := true
        entryPriceSell 
    := na
        entryPriceSell

    // Alerts and Signals
    plotshape(longSignaltitle 'Smart Buy Signal'text 'Al'textcolor color.whitestyle shape.labelupsize size.smalllocation location.belowbarcolor greenColor)
    plotshape(shortSignaltitle 'Smart Sell Signal'text 'Sat'textcolor color.whitestyle shape.labeldownsize size.smalllocation location.abovebarcolor redColor)
    //plotshape(takeProfitSignalBuy, title = 'Book Profit Buy', text = 'Book Profit', textcolor = blackTextColor, style = shape.labeldown, size = size.small, location = location.abovebar, color = yellowColor)
    //plotshape(takeProfitSignalSell, title = 'Book Profit Sell', text = 'Book Profit', textcolor = whiteTextColor, style = shape.labelup, size = size.small, location = location.belowbar, color = blueColor) 
    PHP Code:
    //@version=6
    indicator(title 'Master Trend BUY&SELL'shorttitle 'MASTER TREND BUY&SELL'overlay true)

    // Color variables
    upTrendColor color.green
    neutralColor 
    #0e0e0e
    downTrendColor color.red
    fillColor 
    color.rgb(12121270// Color between lines
    yellowColor color.rgb(2302142)
    blackTextColor color.rgb(000)
    blueColor color.rgb(2332170)
    whiteTextColor color.rgb(777)
    greenColor color.green
    redColor 
    color.red

    // Source
    source input(defval closetitle 'Source')

    // Sampling Period
    period input.int(defval 50minval 1title 'Sampling Period')

    // Range Multiplier
    multiplier input.float(defval 3.0minval 0.1title 'Range Multiplier')

    // Take Profit Settings
    takeProfitPips input.float(defval 600.0title 'Take Profit (in pips)')

    // Smooth Average Range
    smoothRange(xtm) =>
        
    adjustedPeriod 1
        avgRange 
    ta.ema(math.abs(x[1]), t)
        
    smoothRange ta.ema(avgRangeadjustedPeriod) * m
        smoothRange
    smoothedRange 
    smoothRange(sourceperiodmultiplier)

    // Trend Filter
    trendFilter(xr) =>
        
    filtered x
        filtered 
    := nz(filtered[1]) ? nz(filtered[1]) ? nz(filtered[1]) : nz(filtered[1]) ? nz(filtered[1]) : r
        filtered
    filter 
    trendFilter(sourcesmoothedRange)

    // Filter Direction
    upCount 0.0
    upCount 
    := filter filter[1] ? nz(upCount[1]) + filter filter[1] ? nz(upCount[1])
    downCount 0.0
    downCount 
    := filter filter[1] ? nz(downCount[1]) + filter filter[1] ? nz(downCount[1])

    // Colors
    filterColor upCount upTrendColor downCount downTrendColor neutralColor

    // Double Line Design
    lineOffset smoothedRange 0.1
    //upperLinePlot = plot(filter + lineOffset, color = filterColor, linewidth = 3, title = 'Upper Trend Line')
    lowerLinePlot plot(filter lineOffsetcolor filterColorlinewidth 3title 'Lower Trend Line')
    //fill(upperLinePlot, lowerLinePlot, color = fillColor, title = 'Trend Fill')


    // Break Outs
    longCondition bool(na)
    shortCondition bool(na)
    longCondition := source filter and source source[1] and upCount or source filter and source source[1] and upCount 0
    shortCondition 
    := source filter and source source[1] and downCount or source filter and source source[1] and downCount 0

    initialCondition 
    0
    initialCondition 
    := longCondition shortCondition ? -initialCondition[1]
    longSignal longCondition and initialCondition[1] == -1
    shortSignal 
    shortCondition and initialCondition[1] == 1

    // Take Profit Logic
    var float entryPriceBuy na
    var float entryPriceSell na
    takeProfitSignalBuy 
    false
    takeProfitSignalSell 
    false

    if longSignal
        entryPriceBuy 
    := source
        entryPriceBuy
    if not na(entryPriceBuy) and source >= entryPriceBuy takeProfitPips syminfo.mintick
        takeProfitSignalBuy 
    := true
        entryPriceBuy 
    := na
        entryPriceBuy

    if shortSignal
        entryPriceSell 
    := source
        entryPriceSell
    if not na(entryPriceSell) and source <= entryPriceSell takeProfitPips syminfo.mintick
        takeProfitSignalSell 
    := true
        entryPriceSell 
    := na
        entryPriceSell

    // Alerts and Signals
    plotshape(longSignaltitle 'Smart Buy Signal'text 'Al'textcolor color.whitestyle shape.labelupsize size.smalllocation location.belowbarcolor greenColor)
    plotshape(shortSignaltitle 'Smart Sell Signal'text 'Sat'textcolor color.whitestyle shape.labeldownsize size.smalllocation location.abovebarcolor redColor)
    //plotshape(takeProfitSignalBuy, title = 'Book Profit Buy', text = 'Book Profit', textcolor = blackTextColor, style = shape.labeldown, size = size.small, location = location.abovebar, color = yellowColor)
    //plotshape(takeProfitSignalSell, title = 'Book Profit Sell', text = 'Book Profit', textcolor = whiteTextColor, style = shape.labelup, size = size.small, location = location.belowbar, color = blueColor)
    /////
    // === Inputs ===
    fairLen     input.int(50"Fair Value EMA Length")
    zLen        input.int(100"Z-Score Lookback Length")
    zThreshold  input.float(3.0"Z-Score Threshold")
    src         input.source(close"Source")
    rsiLen      input.int(14"RSI Length")
    rsiEmaLen   input.int(7"EMA of RSI Slope")

    colorMode input.string("None""Bar Coloring Mode"options=[
         
    "None",
         
    "Reversal Solid"
         
    "Reversal Fade"
         
    "Exceeding Bands",
         
    "Classic Heat"
     
    ])

    enableSignals input.bool(false,'Show Signals')

    // === Smooth RGB Gradient Function
    f_colorGradient(_ratio_colA_colB) =>
        
    rA color.r(_colA)
        
    gA color.g(_colA)
        
    bA color.b(_colA)
        
    rB color.r(_colB)
        
    gB color.g(_colB)
        
    bB color.b(_colB)
        
    rr rA int((rB rA) * _ratio)
        
    rg gA int((gB gA) * _ratio)
        
    rb bA int((bB bA) * _ratio)
        
    color.rgb(rrrgrb0)


    // === Color Scheme ===
    bullMain     color.new(#5CF0D7, 0)
    bearMain     color.new(#B32AC3, 0)
    labelTextCol color.white
    borderCol    
    color.white

    // === Fair Value (EMA Only) ===
    fair ta.ema(srcfairLen)

    // === Z-Score Deviation
    dev        src fair
    devMean    
    ta.sma(devzLen)
    devStdev   ta.stdev(devzLen)
    zScore     devStdev != ? (dev devMean) / devStdev 0

    // === Z-Bands
    upperBand fair zThreshold devStdev
    lowerBand 
    fair zThreshold devStdev

    // === Re-entry Logic
    wasAbove src[1] > upperBand[1]
    wasBelow src[1] < lowerBand[1]
    backInsideFromAbove wasAbove and src <= upperBand
    backInsideFromBelow 
    wasBelow and src >= lowerBand

    // === RSI EMA Slope Filter
    rsi       ta.rsi(closersiLen)
    rsiEma    ta.ema(rsirsiEmaLen)
    rsiSlope  rsiEma rsiEma[1]

    slopeUp   rsiSlope 0
    slopeDown 
    rsiSlope 0

    // === Signal Memory (One per slope)
    var bool buyFiredOnSlope  false
    var bool sellFiredOnSlope false

    // Reset logic when slope flips
    buyReset  ta.crossover(rsiSlope0)
    sellReset ta.crossunder(rsiSlope0)

    if 
    buyReset
        buyFiredOnSlope 
    := false
    if sellReset
        sellFiredOnSlope 
    := false

    // Final entry conditions
    finalBuy  backInsideFromBelow and slopeUp and not buyFiredOnSlope and enableSignals
    finalSell 
    backInsideFromAbove and slopeDown and not sellFiredOnSlope and enableSignals

    if finalBuy
        buyFiredOnSlope 
    := true
    if finalSell
        sellFiredOnSlope 
    := true

    // === Plot Fair Value and Bands (All White)
    pUpper plot(upperBand"Upper Band"color=borderCollinewidth=1)
    pLower plot(lowerBand"Lower Band"color=borderCollinewidth=1)
    pFair  plot(fair"Fair Value EMA"color=borderCollinewidth=2)

    // === Elegant Signal Labels
    plotshape(finalBuy,  title="Buy",  location=location.belowbarstyle=shape.labelup,   text="𝓤𝓹",   color=bullMaintextcolor=#000000, size=size.small)
    plotshape(finalSelltitle="Sell"location=location.abovebarstyle=shape.labeldowntext="𝓓𝓸𝔀𝓷"color=bearMaintextcolor=labelTextColsize=size.small)

    // === Barcolor with Smoothing

    // === Gradient Fill: Top → Mid, Bottom → Mid
    fill(pUpperpFairupperBandfair,color.new(bearMain60), #00010400)
    fill(pFairpLowerfairlowerBandcolor.new(#000000, 100),color.new(bullMain, 60))




    // === Bar Coloring Modes

    // Reversal Memory (for "Reversal Solid" and "Reversal Fade")
    var string lastSignal ""
    if finalBuy
        lastSignal 
    := "bull"
    if finalSell
        lastSignal 
    := "bear"

    // Reversal Fade Tracker
    var int signalAge 0
    if finalBuy or finalSell
        signalAge 
    := 0
    else
        
    signalAge += 1

    // info
    var string lastTrend ""
    if close upperBand
        lastTrend 
    := "bull"
    else if close lowerBand
        lastTrend 
    := "bear"

    // === Bar Coloring Logic
    var color barCol na

    // 1. Reversal Solid
    if colorMode == "Reversal Solid"
        
    barCol := lastSignal == "bull" color.new(bullMain0) : lastSignal == "bear" color.new(bearMain0) : na

    if colorMode == "None"
        
    barCol := na

    // 2. Reversal Fade
    if colorMode == "Reversal Fade"
        
    fade math.min(90signalAge 1)
        
    barCol := lastSignal == "bull" color.new(bullMainfade) : lastSignal == "bear" color.new(bearMainfade) : na


    // 4. Exceeding Bands Only (only when outside bands)
    if colorMode == "Exceeding Bands"
        
    barCol := close upperBand color.new(bullMain0) : close lowerBand color.new(bearMain0) : na

    // 5. Classic Heat — correct: strongest color near bands, fade near fair
    // 5. Classic Heat — fixed: most intense near boundaries, fades toward fair
    // 6. Gradient Flow — RGB blend from bull to bear based on band distance
    if colorMode == "Classic Heat"
        
    bandRange     upperBand lowerBand
        ratioRaw      
    = (close lowerBand) / bandRange
        ratioClamped  
    math.max(0.0math.min(ratioRaw1.0))
        
    barCol := f_colorGradient(ratioClampedbullMainbearMain)



    barcolor(barCol)


    // === Table Position Setting
    enableTable input.bool(true,'Enable Table')
    tablePos input.string("Top Right""Table Position"options=["Top Left""Top Right""Bottom Left""Bottom Right"])
    pos tablePos == "Top Left" position.top_left :
          
    tablePos == "Top Right" position.top_right :
          
    tablePos == "Bottom Left" position.bottom_left :
          
    position.bottom_right

    // === Scoring Logic
    score_z       zScore < -zThreshold ? +zScore zThreshold ? -0
    score_slope   
    rsiSlope ? +rsiSlope ? -0
    score_price   
    close fair ? +close fair ? -0
    score_trend   
    lastTrend == "bull" ? +lastTrend == "bear" ? -0
    score_reentry 
    finalBuy ? +finalSell ? -0

    // === Score Aggregation
    totalScore score_z score_slope score_price score_trend score_reentry
    scoreCount 
    5
    avgScore   
    totalScore scoreCount

    finalSignal 
    avgScore 0.1 "Buy" avgScore < -0.1 "Sell" "Neutral"
    finalColor  avgScore 0.1 bullMain avgScore < -0.1 bearMain color.gray



    // === Shared Style
    bgcolor color.new(#000000, 0)
    textCol color.white

    // === Table Drawing
    if bar_index == and enableTable
        
    var table scoreTable table.new(pos27,frame_width 1border_width=1frame_color=color.whiteborder_color=color.white)
        
    table.cell(scoreTable00"Metric",      bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable10"Score",       bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable01"Z-Score",     bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable11str.tostring(score_z),       bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable02"RSI Slope",   bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable12str.tostring(score_slope),   bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable03"Price vs Fair"bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable13str.tostring(score_price),  bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable04"Trend State",  bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable14str.tostring(score_trend),  bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable05"Reentry",      bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable15str.tostring(score_reentry),bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable06"Final Signal"bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable16finalSignal,    bgcolor=bgcolortext_color=finalColor)


        
    table.cell_set_text_font_family(scoreTable,0,0,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,0,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,1,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,1,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,2,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,2,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,3,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,3,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,4,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,4,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,5,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,5,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,6,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,6,font.family_monospace
    16.07.2024 - 10.12.2024

  6. PHP Code:
    //@version=6
    indicator(title 'Master Trend BUY&SELL'shorttitle '.'overlay true)

    // Color variables
    upTrendColor color.green
    neutralColor 
    #0e0e0e
    downTrendColor color.red
    fillColor 
    color.rgb(12121270// Color between lines
    yellowColor color.rgb(2302142)
    blackTextColor color.rgb(000)
    blueColor color.rgb(2332170)
    whiteTextColor color.rgb(777)
    greenColor color.green
    redColor 
    color.red

    // Source
    source input(defval closetitle 'Source')

    // Sampling Period
    period input.int(defval 50minval 1title 'Sampling Period')

    // Range Multiplier
    multiplier input.float(defval 3.0minval 0.1title 'Range Multiplier')

    // Take Profit Settings
    takeProfitPips input.float(defval 600.0title 'Take Profit (in pips)')

    // Smooth Average Range
    smoothRange(xtm) =>
        
    adjustedPeriod 1
        avgRange 
    ta.ema(math.abs(x[1]), t)
        
    smoothRange ta.ema(avgRangeadjustedPeriod) * m
        smoothRange
    smoothedRange 
    smoothRange(sourceperiodmultiplier)

    // Trend Filter
    trendFilter(xr) =>
        
    filtered x
        filtered 
    := nz(filtered[1]) ? nz(filtered[1]) ? nz(filtered[1]) : nz(filtered[1]) ? nz(filtered[1]) : r
        filtered
    filter 
    trendFilter(sourcesmoothedRange)

    // Filter Direction
    upCount 0.0
    upCount 
    := filter filter[1] ? nz(upCount[1]) + filter filter[1] ? nz(upCount[1])
    downCount 0.0
    downCount 
    := filter filter[1] ? nz(downCount[1]) + filter filter[1] ? nz(downCount[1])

    // Colors
    filterColor upCount upTrendColor downCount downTrendColor neutralColor

    // Double Line Design
    lineOffset smoothedRange 0.1
    upperLinePlot 
    plot(filter lineOffsetcolor filterColorlinewidth 1title 'Yükseliş Trend Çizgisi')
    lowerLinePlot plot(filter lineOffsetcolor filterColorlinewidth 1title 'Düşüş Trend Çizgisi')
    //fill(upperLinePlot, lowerLinePlot, color = fillColor, title = 'Trend Fill')


    // Break Outs
    longCondition bool(na)
    shortCondition bool(na)
    longCondition := source filter and source source[1] and upCount or source filter and source source[1] and upCount 0
    shortCondition 
    := source filter and source source[1] and downCount or source filter and source source[1] and downCount 0

    initialCondition 
    0
    initialCondition 
    := longCondition shortCondition ? -initialCondition[1]
    longSignal longCondition and initialCondition[1] == -1
    shortSignal 
    shortCondition and initialCondition[1] == 1

    // Take Profit Logic
    var float entryPriceBuy na
    var float entryPriceSell na
    takeProfitSignalBuy 
    false
    takeProfitSignalSell 
    false

    if longSignal
        entryPriceBuy 
    := source
        entryPriceBuy
    if not na(entryPriceBuy) and source >= entryPriceBuy takeProfitPips syminfo.mintick
        takeProfitSignalBuy 
    := true
        entryPriceBuy 
    := na
        entryPriceBuy

    if shortSignal
        entryPriceSell 
    := source
        entryPriceSell
    if not na(entryPriceSell) and source <= entryPriceSell takeProfitPips syminfo.mintick
        takeProfitSignalSell 
    := true
        entryPriceSell 
    := na
        entryPriceSell

    // Alerts and Signals
    plotshape(longSignaltitle 'Smart Buy Signal'text 'Al'textcolor color.whitestyle shape.labelupsize size.smalllocation location.belowbarcolor greenColor)
    plotshape(shortSignaltitle 'Smart Sell Signal'text 'Sat'textcolor color.whitestyle shape.labeldownsize size.smalllocation location.abovebarcolor redColor)
    //plotshape(takeProfitSignalBuy, title = 'Book Profit Buy', text = 'Book Profit', textcolor = blackTextColor, style = shape.labeldown, size = size.small, location = location.abovebar, color = yellowColor)
    //plotshape(takeProfitSignalSell, title = 'Book Profit Sell', text = 'Book Profit', textcolor = whiteTextColor, style = shape.labelup, size = size.small, location = location.belowbar, color = blueColor)
    /////
    // === Inputs ===
    fairLen     input.int(50"Fair Value EMA Length")
    zLen        input.int(100"Z-Score Lookback Length")
    zThreshold  input.float(3.0"Z-Score Threshold")
    src         input.source(close"Source")
    rsiLen      input.int(14"RSI Length")
    rsiEmaLen   input.int(7"EMA of RSI Slope")

    colorMode input.string("None""Bar Coloring Mode"options=[
         
    "None",
         
    "Reversal Solid"
         
    "Reversal Fade"
         
    "Exceeding Bands",
         
    "Classic Heat"
     
    ])

    enableSignals input.bool(false,'Show Signals')

    // === Smooth RGB Gradient Function
    f_colorGradient(_ratio_colA_colB) =>
        
    rA color.r(_colA)
        
    gA color.g(_colA)
        
    bA color.b(_colA)
        
    rB color.r(_colB)
        
    gB color.g(_colB)
        
    bB color.b(_colB)
        
    rr rA int((rB rA) * _ratio)
        
    rg gA int((gB gA) * _ratio)
        
    rb bA int((bB bA) * _ratio)
        
    color.rgb(rrrgrb0)


    // === Color Scheme ===
    bullMain     color.new(#5CF0D7, 0)
    bearMain     color.new(#B32AC3, 0)
    labelTextCol color.white
    borderCol    
    color.white

    // === Fair Value (EMA Only) ===
    fair ta.ema(srcfairLen)

    // === Z-Score Deviation
    dev        src fair
    devMean    
    ta.sma(devzLen)
    devStdev   ta.stdev(devzLen)
    zScore     devStdev != ? (dev devMean) / devStdev 0

    // === Z-Bands
    upperBand fair zThreshold devStdev
    lowerBand 
    fair zThreshold devStdev

    // === Re-entry Logic
    wasAbove src[1] > upperBand[1]
    wasBelow src[1] < lowerBand[1]
    backInsideFromAbove wasAbove and src <= upperBand
    backInsideFromBelow 
    wasBelow and src >= lowerBand

    // === RSI EMA Slope Filter
    rsi       ta.rsi(closersiLen)
    rsiEma    ta.ema(rsirsiEmaLen)
    rsiSlope  rsiEma rsiEma[1]

    slopeUp   rsiSlope 0
    slopeDown 
    rsiSlope 0

    // === Signal Memory (One per slope)
    var bool buyFiredOnSlope  false
    var bool sellFiredOnSlope false

    // Reset logic when slope flips
    buyReset  ta.crossover(rsiSlope0)
    sellReset ta.crossunder(rsiSlope0)

    if 
    buyReset
        buyFiredOnSlope 
    := false
    if sellReset
        sellFiredOnSlope 
    := false

    // Final entry conditions
    finalBuy  backInsideFromBelow and slopeUp and not buyFiredOnSlope and enableSignals
    finalSell 
    backInsideFromAbove and slopeDown and not sellFiredOnSlope and enableSignals

    if finalBuy
        buyFiredOnSlope 
    := true
    if finalSell
        sellFiredOnSlope 
    := true

    // === Plot Fair Value and Bands (All White)
    pUpper plot(upperBand"Üst Band"color=borderCollinewidth=1)
    pLower plot(lowerBand"Alt Band"color=borderCollinewidth=1)
    pFair  plot(fair"Adil EMA"color=borderCollinewidth=2)

    // === Elegant Signal Labels
    plotshape(finalBuy,  title="Buy",  location=location.belowbarstyle=shape.labelup,   text="𝓤𝓹",   color=bullMaintextcolor=#000000, size=size.small)
    plotshape(finalSelltitle="Sell"location=location.abovebarstyle=shape.labeldowntext="𝓓𝓸𝔀𝓷"color=bearMaintextcolor=labelTextColsize=size.small)

    // === Barcolor with Smoothing

    // === Gradient Fill: Top → Mid, Bottom → Mid
    fill(pUpperpFairupperBandfair,color.new(bearMain60), #00010400)
    fill(pFairpLowerfairlowerBandcolor.new(#000000, 100),color.new(bullMain, 60))




    // === Bar Coloring Modes

    // Reversal Memory (for "Reversal Solid" and "Reversal Fade")
    var string lastSignal ""
    if finalBuy
        lastSignal 
    := "bull"
    if finalSell
        lastSignal 
    := "bear"

    // Reversal Fade Tracker
    var int signalAge 0
    if finalBuy or finalSell
        signalAge 
    := 0
    else
        
    signalAge += 1

    // info
    var string lastTrend ""
    if close upperBand
        lastTrend 
    := "bull"
    else if close lowerBand
        lastTrend 
    := "bear"

    // === Bar Coloring Logic
    var color barCol na

    // 1. Reversal Solid
    if colorMode == "Reversal Solid"
        
    barCol := lastSignal == "bull" color.new(bullMain0) : lastSignal == "bear" color.new(bearMain0) : na

    if colorMode == "None"
        
    barCol := na

    // 2. Reversal Fade
    if colorMode == "Reversal Fade"
        
    fade math.min(90signalAge 1)
        
    barCol := lastSignal == "bull" color.new(bullMainfade) : lastSignal == "bear" color.new(bearMainfade) : na


    // 4. Exceeding Bands Only (only when outside bands)
    if colorMode == "Exceeding Bands"
        
    barCol := close upperBand color.new(bullMain0) : close lowerBand color.new(bearMain0) : na

    // 5. Classic Heat — correct: strongest color near bands, fade near fair
    // 5. Classic Heat — fixed: most intense near boundaries, fades toward fair
    // 6. Gradient Flow — RGB blend from bull to bear based on band distance
    if colorMode == "Classic Heat"
        
    bandRange     upperBand lowerBand
        ratioRaw      
    = (close lowerBand) / bandRange
        ratioClamped  
    math.max(0.0math.min(ratioRaw1.0))
        
    barCol := f_colorGradient(ratioClampedbullMainbearMain)



    barcolor(barCol)


    // === Table Position Setting
    enableTable input.bool(true,'Enable Table')
    tablePos input.string("Top Right""Table Position"options=["Top Left""Top Right""Bottom Left""Bottom Right"])
    pos tablePos == "Top Left" position.top_left :
          
    tablePos == "Top Right" position.top_right :
          
    tablePos == "Bottom Left" position.bottom_left :
          
    position.bottom_right

    // === Scoring Logic
    score_z       zScore < -zThreshold ? +zScore zThreshold ? -0
    score_slope   
    rsiSlope ? +rsiSlope ? -0
    score_price   
    close fair ? +close fair ? -0
    score_trend   
    lastTrend == "bull" ? +lastTrend == "bear" ? -0
    score_reentry 
    finalBuy ? +finalSell ? -0

    // === Score Aggregation
    totalScore score_z score_slope score_price score_trend score_reentry
    scoreCount 
    5
    avgScore   
    totalScore scoreCount

    finalSignal 
    avgScore 0.1 "AL" avgScore < -0.1 "SAT" "Nötr"
    finalColor  avgScore 0.1 bullMain avgScore < -0.1 bearMain color.gray



    // === Shared Style
    bgcolor color.new(#000000, 0)
    textCol color.white

    // === Table Drawing
    if bar_index == and enableTable
        
    var table scoreTable table.new(pos27,frame_width 1border_width=1frame_color=color.whiteborder_color=color.white)
        
    table.cell(scoreTable00"İnd",      bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable10"Puan",       bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable01"Z-Score",     bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable11str.tostring(score_z),       bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable02"RSI",   bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable12str.tostring(score_slope),   bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable03"Fiyat"bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable13str.tostring(score_price),  bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable04"Trend ",  bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable14str.tostring(score_trend),  bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable05"R Giriş",      bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable15str.tostring(score_reentry),bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable06"Sonuç"bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable16finalSignal,    bgcolor=bgcolortext_color=finalColor)


        
    table.cell_set_text_font_family(scoreTable,0,0,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,0,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,1,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,1,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,2,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,2,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,3,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,3,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,4,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,4,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,5,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,5,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,6,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,6,font.family_monospace)
    /////////////////

    src88 input.source(close,"RSI Source",group "Connors RSI")
    lenrsi input(24"RSI Length",group "Connors RSI")
    lenupdown input(20"UpDown Length",group "Connors RSI")
    lenroc input(75"ROC Length",group "Connors RSI")

    z_score_length  input(14"Z-Score Lookback",group "Filtering")
    threshold       input.float(1.5"Z-Score Threshold"step=0.025,group "Filtering")
    trendingLongThreshold input.float(65"Trending Long Threshold" ,group "Filtering")
    trendingShortThreshold input.float(35"Trending Short Threshold",group "Filtering")
    revertingLongThreshold  input.float(70title="Reverting Long Threshold",group "Filtering")
    revertingShortThreshold input.float(30title="Reverting Short Threshold",group "Filtering")

    // ─── CONNORS RSI ──────────────────────────────────────────────────────────
    updown(s) =>
        
    isEqual == s[1]
        
    isGrowing s[1]
        
    ud 0.0
        ud 
    := isEqual isGrowing ? (nz(ud[1]) <= nz(ud[1])+1) : (nz(ud[1]) >= ? -nz(ud[1])-1)
        
    ud
    rsi88 
    ta.rsi(src88lenrsi)
    updownrsi ta.rsi(updown(src88), lenupdown)
    percentrank ta.percentrank(ta.roc(src881), lenroc)
    crsi =  math.avg(rsiupdownrsipercentrank


    // ─── Z-SCORING ──────────────────────────────────────────────────────────
    mean    ta.sma(crsiz_score_length)
    stdDev  ta.stdev(crsiz_score_length)
    zScore88  = (crsi mean) / stdDev

    isTrending 
    math.abs(zScore88) > threshold

    // ─── Signal Generation ────────────────────────────────────────────────
    var int signal 0
    if barstate.isconfirmed
        
    if isTrending
            signal 
    := crsi trendingLongThreshold crsi trendingShortThreshold ? -signal[1]
        else
            
    signal := crsi revertingLongThreshold crsi revertingShortThreshold ? -signal[1]


    trendColor signal == #17dfad : signal == -1  ? #dd326b : color.gray


    //decor = plot(crsi,"Decor",style = plot.style_columns,histbase = 50,color=trendColor,linewidth = 2)
    bgcolor(color.new(trendColor,75))
    //plotcandle(open,high,low,close,"Candles",color=trendColor,wickcolor = trendColor,bordercolor = trendColor,force_overlay = true) 
    16.07.2024 - 10.12.2024

  7. 2-3-5 sma stratejisi eklenmiş hali...
    PHP Code:
    //@version=6
    indicator(title 'Master Trend BUY&SELL'shorttitle '.'overlay true)

    // Color variables
    upTrendColor color.green
    neutralColor 
    #0e0e0e
    downTrendColor color.red
    fillColor 
    color.rgb(12121270// Color between lines
    yellowColor color.rgb(2302142)
    blackTextColor color.rgb(000)
    blueColor color.rgb(2332170)
    whiteTextColor color.rgb(777)
    greenColor color.green
    redColor 
    color.red

    // Source
    source input(defval closetitle 'Source')

    // Sampling Period
    period input.int(defval 50minval 1title 'Sampling Period')

    // Range Multiplier
    multiplier input.float(defval 3.0minval 0.1title 'Range Multiplier')

    // Take Profit Settings
    takeProfitPips input.float(defval 600.0title 'Take Profit (in pips)')

    // Smooth Average Range
    smoothRange(xtm) =>
        
    adjustedPeriod 1
        avgRange 
    ta.ema(math.abs(x[1]), t)
        
    smoothRange ta.ema(avgRangeadjustedPeriod) * m
        smoothRange
    smoothedRange 
    smoothRange(sourceperiodmultiplier)

    // Trend Filter
    trendFilter(xr) =>
        
    filtered x
        filtered 
    := nz(filtered[1]) ? nz(filtered[1]) ? nz(filtered[1]) : nz(filtered[1]) ? nz(filtered[1]) : r
        filtered
    filter 
    trendFilter(sourcesmoothedRange)

    // Filter Direction
    upCount 0.0
    upCount 
    := filter filter[1] ? nz(upCount[1]) + filter filter[1] ? nz(upCount[1])
    downCount 0.0
    downCount 
    := filter filter[1] ? nz(downCount[1]) + filter filter[1] ? nz(downCount[1])

    // Colors
    filterColor upCount upTrendColor downCount downTrendColor neutralColor

    // Double Line Design
    lineOffset smoothedRange 0.1
    upperLinePlot 
    plot(filter lineOffsetcolor filterColorlinewidth 1title 'Yükseliş Trend Çizgisi')
    lowerLinePlot plot(filter lineOffsetcolor filterColorlinewidth 1title 'Düşüş Trend Çizgisi')
    //fill(upperLinePlot, lowerLinePlot, color = fillColor, title = 'Trend Fill')


    // Break Outs
    longCondition bool(na)
    shortCondition bool(na)
    longCondition := source filter and source source[1] and upCount or source filter and source source[1] and upCount 0
    shortCondition 
    := source filter and source source[1] and downCount or source filter and source source[1] and downCount 0

    initialCondition 
    0
    initialCondition 
    := longCondition shortCondition ? -initialCondition[1]
    longSignal longCondition and initialCondition[1] == -1
    shortSignal 
    shortCondition and initialCondition[1] == 1

    // Take Profit Logic
    var float entryPriceBuy na
    var float entryPriceSell na
    takeProfitSignalBuy 
    false
    takeProfitSignalSell 
    false

    if longSignal
        entryPriceBuy 
    := source
        entryPriceBuy
    if not na(entryPriceBuy) and source >= entryPriceBuy takeProfitPips syminfo.mintick
        takeProfitSignalBuy 
    := true
        entryPriceBuy 
    := na
        entryPriceBuy

    if shortSignal
        entryPriceSell 
    := source
        entryPriceSell
    if not na(entryPriceSell) and source <= entryPriceSell takeProfitPips syminfo.mintick
        takeProfitSignalSell 
    := true
        entryPriceSell 
    := na
        entryPriceSell

    // Alerts and Signals
    plotshape(longSignaltitle 'Smart Buy Signal'text 'Al'textcolor color.whitestyle shape.labelupsize size.smalllocation location.belowbarcolor greenColor)
    plotshape(shortSignaltitle 'Smart Sell Signal'text 'Sat'textcolor color.whitestyle shape.labeldownsize size.smalllocation location.abovebarcolor redColor)
    //plotshape(takeProfitSignalBuy, title = 'Book Profit Buy', text = 'Book Profit', textcolor = blackTextColor, style = shape.labeldown, size = size.small, location = location.abovebar, color = yellowColor)
    //plotshape(takeProfitSignalSell, title = 'Book Profit Sell', text = 'Book Profit', textcolor = whiteTextColor, style = shape.labelup, size = size.small, location = location.belowbar, color = blueColor)
    /////
    // === Inputs ===
    fairLen     input.int(50"Fair Value EMA Length")
    zLen        input.int(100"Z-Score Lookback Length")
    zThreshold  input.float(3.0"Z-Score Threshold")
    src         input.source(close"Source")
    rsiLen      input.int(14"RSI Length")
    rsiEmaLen   input.int(7"EMA of RSI Slope")

    colorMode input.string("None""Bar Coloring Mode"options=[
         
    "None",
         
    "Reversal Solid"
         
    "Reversal Fade"
         
    "Exceeding Bands",
         
    "Classic Heat"
     
    ])

    enableSignals input.bool(false,'Show Signals')

    // === Smooth RGB Gradient Function
    f_colorGradient(_ratio_colA_colB) =>
        
    rA color.r(_colA)
        
    gA color.g(_colA)
        
    bA color.b(_colA)
        
    rB color.r(_colB)
        
    gB color.g(_colB)
        
    bB color.b(_colB)
        
    rr rA int((rB rA) * _ratio)
        
    rg gA int((gB gA) * _ratio)
        
    rb bA int((bB bA) * _ratio)
        
    color.rgb(rrrgrb0)


    // === Color Scheme ===
    bullMain     color.new(#5CF0D7, 0)
    bearMain     color.new(#B32AC3, 0)
    labelTextCol color.white
    borderCol    
    color.white

    // === Fair Value (EMA Only) ===
    fair ta.ema(srcfairLen)

    // === Z-Score Deviation
    dev        src fair
    devMean    
    ta.sma(devzLen)
    devStdev   ta.stdev(devzLen)
    zScore     devStdev != ? (dev devMean) / devStdev 0

    // === Z-Bands
    upperBand fair zThreshold devStdev
    lowerBand 
    fair zThreshold devStdev

    // === Re-entry Logic
    wasAbove src[1] > upperBand[1]
    wasBelow src[1] < lowerBand[1]
    backInsideFromAbove wasAbove and src <= upperBand
    backInsideFromBelow 
    wasBelow and src >= lowerBand

    // === RSI EMA Slope Filter
    rsi       ta.rsi(closersiLen)
    rsiEma    ta.ema(rsirsiEmaLen)
    rsiSlope  rsiEma rsiEma[1]

    slopeUp   rsiSlope 0
    slopeDown 
    rsiSlope 0

    // === Signal Memory (One per slope)
    var bool buyFiredOnSlope  false
    var bool sellFiredOnSlope false

    // Reset logic when slope flips
    buyReset  ta.crossover(rsiSlope0)
    sellReset ta.crossunder(rsiSlope0)

    if 
    buyReset
        buyFiredOnSlope 
    := false
    if sellReset
        sellFiredOnSlope 
    := false

    // Final entry conditions
    finalBuy  backInsideFromBelow and slopeUp and not buyFiredOnSlope and enableSignals
    finalSell 
    backInsideFromAbove and slopeDown and not sellFiredOnSlope and enableSignals

    if finalBuy
        buyFiredOnSlope 
    := true
    if finalSell
        sellFiredOnSlope 
    := true

    // === Plot Fair Value and Bands (All White)
    pUpper plot(upperBand"Üst Band"color=borderCollinewidth=1)
    pLower plot(lowerBand"Alt Band"color=borderCollinewidth=1)
    pFair  plot(fair"Adil EMA"color=borderCollinewidth=2)

    // === Elegant Signal Labels
    //plotshape(finalBuy,  title="Buy",  location=location.belowbar, style=shape.labelup,   text="𝓤𝓹",   color=bullMain, textcolor=#000000, size=size.small)
    //plotshape(finalSell, title="Sell", location=location.abovebar, style=shape.labeldown, text="𝓓𝓸𝔀𝓷", color=bearMain, textcolor=labelTextCol, size=size.small)

    // === Barcolor with Smoothing

    // === Gradient Fill: Top → Mid, Bottom → Mid
    fill(pUpperpFairupperBandfair,color.new(bearMain60), #00010400)
    fill(pFairpLowerfairlowerBandcolor.new(#000000, 100),color.new(bullMain, 60))




    // === Bar Coloring Modes

    // Reversal Memory (for "Reversal Solid" and "Reversal Fade")
    var string lastSignal ""
    if finalBuy
        lastSignal 
    := "bull"
    if finalSell
        lastSignal 
    := "bear"

    // Reversal Fade Tracker
    var int signalAge 0
    if finalBuy or finalSell
        signalAge 
    := 0
    else
        
    signalAge += 1

    // info
    var string lastTrend ""
    if close upperBand
        lastTrend 
    := "bull"
    else if close lowerBand
        lastTrend 
    := "bear"

    // === Bar Coloring Logic
    var color barCol na

    // 1. Reversal Solid
    if colorMode == "Reversal Solid"
        
    barCol := lastSignal == "bull" color.new(bullMain0) : lastSignal == "bear" color.new(bearMain0) : na

    if colorMode == "None"
        
    barCol := na

    // 2. Reversal Fade
    if colorMode == "Reversal Fade"
        
    fade math.min(90signalAge 1)
        
    barCol := lastSignal == "bull" color.new(bullMainfade) : lastSignal == "bear" color.new(bearMainfade) : na


    // 4. Exceeding Bands Only (only when outside bands)
    if colorMode == "Exceeding Bands"
        
    barCol := close upperBand color.new(bullMain0) : close lowerBand color.new(bearMain0) : na

    // 5. Classic Heat — correct: strongest color near bands, fade near fair
    // 5. Classic Heat — fixed: most intense near boundaries, fades toward fair
    // 6. Gradient Flow — RGB blend from bull to bear based on band distance
    if colorMode == "Classic Heat"
        
    bandRange     upperBand lowerBand
        ratioRaw      
    = (close lowerBand) / bandRange
        ratioClamped  
    math.max(0.0math.min(ratioRaw1.0))
        
    barCol := f_colorGradient(ratioClampedbullMainbearMain)



    barcolor(barCol)


    // === Table Position Setting
    enableTable input.bool(true,'Enable Table')
    tablePos input.string("Top Right""Table Position"options=["Top Left""Top Right""Bottom Left""Bottom Right"])
    pos tablePos == "Top Left" position.top_left :
          
    tablePos == "Top Right" position.top_right :
          
    tablePos == "Bottom Left" position.bottom_left :
          
    position.bottom_right

    // === Scoring Logic
    score_z       zScore < -zThreshold ? +zScore zThreshold ? -0
    score_slope   
    rsiSlope ? +rsiSlope ? -0
    score_price   
    close fair ? +close fair ? -0
    score_trend   
    lastTrend == "bull" ? +lastTrend == "bear" ? -0
    score_reentry 
    finalBuy ? +finalSell ? -0

    // === Score Aggregation
    totalScore score_z score_slope score_price score_trend score_reentry
    scoreCount 
    5
    avgScore   
    totalScore scoreCount

    finalSignal 
    avgScore 0.1 "AL" avgScore < -0.1 "SAT" "Nötr"
    finalColor  avgScore 0.1 bullMain avgScore < -0.1 bearMain color.gray



    // === Shared Style
    bgcolor color.new(#000000, 0)
    textCol color.white

    // === Table Drawing
    if bar_index == and enableTable
        
    var table scoreTable table.new(pos27,frame_width 1border_width=1frame_color=color.whiteborder_color=color.white)
        
    table.cell(scoreTable00"İnd",      bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable10"Puan",       bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable01"Z-Score",     bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable11str.tostring(score_z),       bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable02"RSI",   bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable12str.tostring(score_slope),   bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable03"Fiyat"bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable13str.tostring(score_price),  bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable04"Trend ",  bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable14str.tostring(score_trend),  bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable05"R Giriş",      bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable15str.tostring(score_reentry),bgcolor=bgcolortext_color=textCol)

        
    table.cell(scoreTable06"Sonuç"bgcolor=bgcolortext_color=textCol)
        
    table.cell(scoreTable16finalSignal,    bgcolor=bgcolortext_color=finalColor)


        
    table.cell_set_text_font_family(scoreTable,0,0,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,0,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,1,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,1,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,2,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,2,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,3,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,3,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,4,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,4,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,5,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,5,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,0,6,font.family_monospace)
        
    table.cell_set_text_font_family(scoreTable,1,6,font.family_monospace)
    /////////////////

    src88 input.source(close,"RSI Source",group "Connors RSI")
    lenrsi input(24"RSI Length",group "Connors RSI")
    lenupdown input(20"UpDown Length",group "Connors RSI")
    lenroc input(75"ROC Length",group "Connors RSI")

    z_score_length  input(14"Z-Score Lookback",group "Filtering")
    threshold       input.float(1.5"Z-Score Threshold"step=0.025,group "Filtering")
    trendingLongThreshold input.float(65"Trending Long Threshold" ,group "Filtering")
    trendingShortThreshold input.float(35"Trending Short Threshold",group "Filtering")
    revertingLongThreshold  input.float(70title="Reverting Long Threshold",group "Filtering")
    revertingShortThreshold input.float(30title="Reverting Short Threshold",group "Filtering")

    // ─── CONNORS RSI ──────────────────────────────────────────────────────────
    updown(s) =>
        
    isEqual == s[1]
        
    isGrowing s[1]
        
    ud 0.0
        ud 
    := isEqual isGrowing ? (nz(ud[1]) <= nz(ud[1])+1) : (nz(ud[1]) >= ? -nz(ud[1])-1)
        
    ud
    rsi88 
    ta.rsi(src88lenrsi)
    updownrsi ta.rsi(updown(src88), lenupdown)
    percentrank ta.percentrank(ta.roc(src881), lenroc)
    crsi =  math.avg(rsiupdownrsipercentrank


    // ─── Z-SCORING ──────────────────────────────────────────────────────────
    mean    ta.sma(crsiz_score_length)
    stdDev  ta.stdev(crsiz_score_length)
    zScore88  = (crsi mean) / stdDev

    isTrending 
    math.abs(zScore88) > threshold

    // ─── Signal Generation ────────────────────────────────────────────────
    var int signal 0
    if barstate.isconfirmed
        
    if isTrending
            signal 
    := crsi trendingLongThreshold crsi trendingShortThreshold ? -signal[1]
        else
            
    signal := crsi revertingLongThreshold crsi revertingShortThreshold ? -signal[1]


    trendColor signal == #17dfad : signal == -1  ? #dd326b : color.gray


    bgcolor(color.new(trendColor,75))
    /////////////
    //@version=6

    src6 close
    ma5 
    ta.sma(src62)
    ma8 ta.sma(src63)
    ma13 ta.sma(src65)
    buy_cond ta.cross(ma5ma13) and ma5 ma13
    sell_cond 
    ta.cross(ma5ma13) and ma5 ma8 and ma5 ma13

    plotarrow
    (buy_cond 0colordown color.rgb(02558), title 'BUY SIGNAL'maxheight 50minheight 50)
    plotarrow(sell_cond ? -0colorup color.rgb(25500), title 'SELL SIGNAL'maxheight 50minheight 50
    16.07.2024 - 10.12.2024

Sayfa 285/286 İlkİlk ... 185235275283284285286 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
  •