Artan

11,55 10 13:55
339,00 9.98 15:15
22,76 9.95 15:15
10,43 9.91 15:13
16,92 9.51 15:15
Artan Hisseler

Azalan

4,77 -10 15:14
315,00 -10 13:55
66,60 -10 15:14
6,40 -9.99 15:16
89,70 -9.98 15:15
Azalan Hisseler

İşlem

6.192.893.848,25 15:15
4.274.050.321,19 15:15
4.236.097.275,21 15:16
3.634.227.018,50 15:15
3.356.203.605,98 15:16
Tüm Hisseler
Sayfa 348/355 İlkİlk ... 248298338346347348349350 ... SonSon
Arama sonucu : 2840 madde; 2,777 - 2,784 arası.

Konu: Tradingview

  1.  Alıntı Originally Posted by @yörük@ Yazıyı Oku
    denemek istersen... o kodun....kombine edilmiş... farklı versiyonu....

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

    // â”€â”€ Enhanced Inputs
    string GRP1 "Core Pattern Matching"
    string GRP2 "Projection & Smoothing"
    string GRP3 "Quality & Filtering"
    string GRP4 "Visuals"

    int   patLen   input.int(20,   "Pattern Length",      minval=8,  maxval=200group=GRP1)
    int   fLen     input.int(30,   "Forecast Bars",       minval=5,  maxval=300group=GRP1)
    int   depth    input.int(2000"Search Depth",        minval=200,maxval=6000,group=GRP1)
    float minConf  input.float(0.30,"Min Confidence",     minval=0.10,maxval=0.95,step=0.05,group=GRP1)

    string scaling    input.string("Adaptive","Scaling Method"options=["Fixed","Adaptive","Volatility","Z-Score"], group=GRP2)
    string smoothing  input.string("EMA","Projection Smoothing"options=["None","SMA","EMA","Adaptive"], group=GRP2)
    int    smoothLen  input.int(3"Smoothing Length",     minval=2,  maxval=10group=GRP2)

    bool   useQualFilter input.bool(true,  "Enable Quality Filter"group=GRP3)
    float  minVariance   input.float(0.001,"Min Pattern Variance"minval=0.0001maxval=0.01step=0.0001group=GRP3)
    int    trendCheck    input.int(5,      "Trend Coherence Bars"minval=3maxval=15group=GRP3)

    bool showProj   input.bool(true,  "Show Projection"group=GRP4)
    bool showBands  input.bool(true,  "Show Bands",      group=GRP4)
    bool showZones  input.bool(true,  "Show Zones",      group=GRP4)

    // Enhanced colors
    color upColor   input.color(#00FF88, "Uptrend (Green)",   group=GRP4)
    color dnColor   input.color(#FF4444, "Downtrend (Red)",   group=GRP4)
    color swColor   input.color(#FFAA00, "Sideways (Yellow)", group=GRP4)

    // â”€â”€ Enhanced Data buffers
    var array<floatprices = array.new<float>()
    var array<
    int>   times  = array.new<int>()
    var array<
    floathighs  = array.new<float>()
    var array<
    floatlows   = array.new<float>()

    // handles
    var array<linehProj = array.new<line>()
    var array<
    linehBand = array.new<line>()
    var array<
    box>  hBox  = array.new<box>()
    var 
    label       hLbl  na

    // â”€â”€ Enhanced Helper Functions
    safeDiv(float nfloat dfloat fb) => 
        
    == 0.0 fb d

    // Enhanced cosine similarity with multiple normalization methods
    cosineSim(array<floatarrint startAint startBint lenstring method "returns") =>
        array<
    floatseqA = array.new<float>()
        array<
    floatseqB = array.new<float>()
        
        
    // Extract sequences
        
    for 0 to len 1
            
    array.push(seqA, array.get(arrstartA i))
            array.
    push(seqB, array.get(arrstartB i))
        
        
    // Normalize based on method
        
    if method == "returns"
            
    // Return-based normalization (original method)
            
    float dp 0.0na2 0.0nb2 0.0
            
    for 1 to len 1
                float a0 
    = array.get(seqA1)
                
    float a1 = array.get(seqAk)
                
    float b0 = array.get(seqB1)
                
    float b1 = array.get(seqBk)
                
    float ra safeDiv(a1 a0a00.0)
                
    float rb safeDiv(b1 b0b00.0)
                
    dp  := dp ra rb
                na2 
    := na2 ra ra
                nb2 
    := nb2 rb rb
            float den 
    math.sqrt(na2) * math.sqrt(nb2)
            
    den == 0.0 0.0 dp den
        
    else
            
    // Z-score normalization for more stable comparison
            
    float meanA 0.0meanB 0.0
            
    for 0 to len 1
                meanA 
    := meanA + array.get(seqAi)
                
    meanB := meanB + array.get(seqBi)
            
    meanA := meanA len
            meanB 
    := meanB len
            
            float stdA 
    0.0stdB 0.0
            
    for 0 to len 1
                float diffA 
    = array.get(seqAi) - meanA
                float diffB 
    = array.get(seqBi) - meanB
                stdA 
    := stdA diffA diffA
                stdB 
    := stdB diffB diffB
            stdA 
    := math.sqrt(stdA len)
            
    stdB := math.sqrt(stdB len)
            
            if 
    stdA == 0.0 or stdB == 0.0
                0.0
            
    else
                
    float dp 0.0na2 0.0nb2 0.0
                
    for 0 to len 1
                    float za 
    = (array.get(seqAi) - meanA) / stdA
                    float zb 
    = (array.get(seqBi) - meanB) / stdB
                    dp  
    := dp za zb
                    na2 
    := na2 za za
                    nb2 
    := nb2 zb zb
                float den 
    math.sqrt(na2) * math.sqrt(nb2)
                
    den == 0.0 0.0 dp den

    // Pattern quality validation
    patternQuality(array<floatarrint startint len) =>
        if 
    start or start len >= array.size(arr)
            
    0.0
        
    else
            
    // Calculate variance to ensure pattern has sufficient movement
            
    float mean 0.0
            
    for 0 to len 1
                mean 
    := mean + array.get(arrstart i)
            
    mean := mean len
            
            float variance 
    0.0
            
    for 0 to len 1
                float diff 
    = array.get(arrstart i) - mean
                variance 
    := variance diff diff
            variance 
    := variance len
            
            
    // Check trend coherence - avoid choppy patterns
            
    int trendChanges 0
            bool lastUp 
    false
            bool firstCheck 
    true
            
    for 1 to len 1
                bool currentUp 
    = array.get(arrstart i) > array.get(arrstart 1)
                if 
    not firstCheck and currentUp != lastUp
                    trendChanges 
    := trendChanges 1
                lastUp 
    := currentUp
                firstCheck 
    := false
            
            float coherence 
    1.0 - (trendChanges / (len 1))
            
    math.sqrt(variance) * coherence

    // Enhanced smoothing function
    smoothProjection(array<floatprojstring methodint length) =>
        array<
    floatsmoothed = array.new<float>()
        
    int size = array.size(proj)
        
        if 
    method == "None"
            
    for 0 to size 1
                
    array.push(smoothed, array.get(proji))
        else if 
    method == "SMA"
            
    for 0 to size 1
                float sum 
    0.0
                int count 
    0
                int start 
    math.max(0length 1)
                for 
    start to i
                    sum 
    := sum + array.get(projj)
                    
    count := count 1
                
    array.push(smoothedsum count)
        else if 
    method == "EMA"
            
    float alpha 2.0 / (length 1.0)
            array.
    push(smoothed, array.get(proj0))
            for 
    1 to size 1
                float prev 
    = array.get(smoothed1)
                
    float curr = array.get(proji)
                array.
    push(smoothedalpha curr + (1.0 alpha) * prev)
        else 
    // Adaptive
            
    for 0 to size 1
                float sum 
    0.0
                float weightSum 
    0.0
                int adaptiveLen 
    length length
                
    for 0 to adaptiveLen 1
                    float weight 
    1.0 / (1.0)
                    
    sum := sum + array.get(projj) * weight
                    weightSum 
    := weightSum weight
                
    array.push(smoothedsum weightSum)
        
        
    smoothed

    // Sample std of returns (enhanced for volatility scaling)
    retStd(array<floatarrint startint len) =>
        if 
    start or start len >= array.size(arr)
            
    0.0
        
    else
            
    float s 0.0
            float c 
    0.0
            
    for start 1 to start len
                float r 
    safeDiv(array.get(arrk) - array.get(arr1), array.get(arr1), 0.0)
                
    := r
                c 
    := 1.0
            float m 
    safeDiv(sc0.0)
            
    float ss 0.0
            
    for start 1 to start len
                float r 
    safeDiv(array.get(arrk) - array.get(arr1), array.get(arr1), 0.0)
                
    float d m
                ss 
    := ss d
            math
    .sqrt(safeDiv(ssmath.max(1.01.0), 0.0))

    // Array min/max over a range
    arrMin(array<floataint startint len) =>
        
    float m na
        int stop 
    math.min(start len, array.size(a))
        if 
    start >= and start < array.size(a)
            for 
    start to stop 1
                float v 
    = array.get(ai)
                
    := na(m) ? math.min(mv)
        
    m

    arrMax
    (array<floataint startint len) =>
        
    float m na
        int stop 
    math.min(start len, array.size(a))
        if 
    start >= and start < array.size(a)
            for 
    start to stop 1
                float v 
    = array.get(ai)
                
    := na(m) ? math.max(mv)
        
    m

    // Draw cleanup
    cleanup() =>
        for 
    l in hProj
            line
    .delete(l)
        array.
    clear(hProj)
        for 
    l in hBand
            line
    .delete(l)
        array.
    clear(hBand)
        for 
    b in hBox
            box
    .delete(b)
        array.
    clear(hBox)
        if 
    not na(hLbl)
            
    label.delete(hLbl)

    // Keep arrays bounded
    keep(int maxKeep) =>
        while array.
    size(prices) > maxKeep
            
    array.shift(prices)
            array.
    shift(times)
            array.
    shift(highs)
            array.
    shift(lows)

    // â”€â”€ Ingest
    array.push(pricesclose)
    array.
    push(times,  time)
    array.
    push(highs,  high)
    array.
    push(lows,   low)
    keep(depth patLen fLen 50)

    // â”€â”€ Enhanced Engine
    if barstate.islastconfirmedhistory and array.size(prices) > patLen fLen
        cleanup
    ()
        
    hLbl := na

        int N 
    = array.size(prices)
        
    int recentStart patLen
        int searchEnd   
    patLen fLen
        int searchStart 
    math.max(0searchEnd depth)

        
    float bestScore = -1.0
        int   bestIdx   
    0
        float bestQuality 
    0.0

        
    // Enhanced pattern search with quality filtering
        
    for searchStart to searchEnd
            
    // Check pattern quality first if filtering enabled
            
    float quality useQualFilter patternQuality(pricesipatLen) : 1.0
            
            
    if quality >= minVariance
                string simMethod 
    scaling == "Z-Score" "zscore" "returns"
                
    float s cosineSim(pricesrecentStartipatLensimMethod)
                
                
    // Weight similarity by pattern quality
                
    float weightedScore * (0.7 0.3 math.min(quality / (minVariance 10.0), 1.0))
                
                if 
    weightedScore bestScore
                    bestScore 
    := weightedScore
                    bestIdx 
    := i
                    bestQuality 
    := quality

        bool have 
    bestScore >= minConf
        
    if have
            
    // Enhanced scaling methods
            
    float cur      = array.get(prices1)
            
    float baseHist = array.get(pricesbestIdx patLen 1)
            
    float scale    1.0
            
            
    if scaling == "Fixed"
                
    scale := 1.0
            
    else if scaling == "Adaptive"
                
    scale := safeDiv(curbaseHist1.0)
            else if 
    scaling == "Volatility"
                
    float cstd retStd(pricespatLenpatLen)
                
    float hstd retStd(pricesbestIdxpatLen)
                
    float vr   safeDiv(cstdhstd1.0)
                
    scale := safeDiv(curbaseHist1.0) * vr
            
    else // Z-Score
                // Z-score based scaling for more stable projections
                
    float histMean 0.0
                
    for 0 to patLen 1
                    histMean 
    := histMean + array.get(pricesbestIdx i)
                
    histMean := histMean patLen
                
                float histStd 
    0.0
                
    for 0 to patLen 1
                    float diff 
    = array.get(pricesbestIdx i) - histMean
                    histStd 
    := histStd diff diff
                histStd 
    := math.sqrt(histStd patLen)
                
                
    float currentStd ta.stdev(closepatLen)
                
    scale := safeDiv(currentStdhistStd1.0)

            
    // Build raw projection path
            
    array<floatrawProj = array.new<float>()
            for 
    0 to fLen 1
                float src 
    = array.get(pricesbestIdx patLen k)
                
    float val cur + (src baseHist) * scale
                
    array.push(rawProjval)

            
    // Apply smoothing to projection
            
    array<floatproj smoothProjection(rawProjsmoothingsmoothLen)
            
            
    // Enhanced confidence bands
            
    float baseVol ta.atr(20)
            
    float confMult = (1.0 bestScore) * 2.0 + (1.0 bestQuality / (minVariance 20.0)) * 1.0
            
            
    array<floatup = array.new<float>()
            array<
    floatdn = array.new<float>()
            for 
    0 to array.size(proj) - 1
                float val 
    = array.get(proji)
                
    float dynamicConf baseVol confMult * (1.0 0.1 fLen// Expanding confidence
                
    array.push(upval dynamicConf)
                array.
    push(dnval dynamicConf)

            
    // Directional analysis with smoothed values
            
    float last = array.get(proj, array.size(proj) - 1)
            
    float pct  safeDiv(last curcur0.0) * 100.0
            color lnColor 
    math.abs(pct) < 0.3 swColor : (pct upColor dnColor)

            
    // Draw enhanced projection
            
    if showProj
                line l0 
    line.new(bar_indexcurbar_index 1, array.get(proj0), color=lnColorwidth=3)
                array.
    push(hProjl0)
                for 
    0 to array.size(proj) - 2
                    line lk 
    line.new(bar_index 1, array.get(projk),
                                       
    bar_index 2, array.get(proj1),
                                       
    color=lnColorwidth=3)
                    array.
    push(hProjlk)

            
    // Enhanced bands
            
    if showBands
                color bc 
    color.new(lnColor70)
                
    line u0 line.new(bar_indexcur baseVol confMultbar_index 1, array.get(up0), color=bcstyle=line.style_dashed)
                
    line d0 line.new(bar_indexcur baseVol confMultbar_index 1, array.get(dn0), color=bcstyle=line.style_dashed)
                array.
    push(hBandu0)
                array.
    push(hBandd0)
                for 
    0 to array.size(up) - 2
                    line uu 
    line.new(bar_index 1, array.get(upk), bar_index 2, array.get(up1), color=bcstyle=line.style_dashed)
                    
    line dd line.new(bar_index 1, array.get(dnk), bar_index 2, array.get(dn1), color=bcstyle=line.style_dashed)
                    array.
    push(hBanduu)
                    array.
    push(hBanddd)

            
    // Zones (unchanged)
            
    if showZones
                float hLow  
    arrMin(lows,  bestIdxpatLen)
                
    float hHigh arrMax(highsbestIdxpatLen)
                if 
    not na(hLow) and not na(hHigh)
                    
    box b1 box.new(array.get(timesbestIdx), hLow, array.get(timesbestIdx patLen 1), hHigh,
                                     
    xloc=xloc.bar_timebgcolor=color.new(lnColor85), border_color=color.new(lnColor55))
                    array.
    push(hBoxb1)
                
    float cLow  ta.lowest(low,  patLen)
                
    float cHigh ta.highest(high,patLen)
                
    box b2 box.new(bar_index patLen 1cLowbar_indexcHigh,
                                 
    bgcolor=color.new(color.blue85), border_color=color.new(color.blue55))
                array.
    push(hBoxb2)

            
    // Enhanced label with quality metrics
            
    string tname math.abs(pct) < 0.3 "SIDEWAYS" : (pct "BULLISH" "BEARISH")
            
    string emoji math.abs(pct) < 0.3 "↔"        : (pct "â–²"      "â–¼")
            
    string lbl   str.format("{0} ENHANCED PROJECTION ({1})\nConfidence: {2,number,#.0}% | Quality: {3,number,#.0}%\nTarget: {4,number,#.##} | Change: {5,number,#.1}%\nMethod: {6} | Smoothing: {7}",
                                      
    emojitnamebestScore*100.0bestQuality*10000.0lastpctscalingsmoothing)
            
    hLbl := label.new(bar_index math.round(array.size(proj)/2.0), math.max(curlast) + ta.atr(10),
                              
    lblcolor=color.new(lnColor20), textcolor=color.white,
                              
    style=label.style_label_downsize=size.normal)

    ////////////////////
    // UI Options for Auto Trend Detection and No Signal in Sideways Market
    autoTrendDetection input.bool(truetitle 'Auto Trend Detection')
    noSignalSideways input.bool(truetitle 'No Signal in Sideways Market')


    // Color variables
    upTrendColor color.white
    neutralColor 
    #90bff9
    downTrendColor color.blue


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


    // Sampling Period - Replaced with Sniper Machine
    period input.int(defval 9minval 1title 'Sniper Machine Period')


    // Trend Master - Replaced with Sniper Machine
    multiplier input.float(defval 3.0minval 0.1title 'Sniper Machine Multiplier')


    // 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


    // Buy/Sell Signals - Adapted from Clear Trend Logic
    trendUp upCount // Equivalent to REMA_up in Clear Trend
    newBuySignal trendUp and not trendUp[1] and barstate.isconfirmed
    newSellSignal 
    not trendUp and trendUp[1] and barstate.isconfirmed


    initialCondition 
    0
    initialCondition 
    := newBuySignal newSellSignal ? -initialCondition[1]
    longSignal newBuySignal and initialCondition[1] == -1
    shortSignal 
    newSellSignal and initialCondition[1] == 1


    // Alerts and Signals
    plotshape(longSignaltitle 'Buy Signal'text '��'textcolor #000000, style = shape.labelup, size = size.small, location = location.belowbar, color = #fae10400) // Bright yellow for Buy
    plotshape(shortSignaltitle 'Sell Signal'text '��'textcolor #000000, style = shape.labeldown, size = size.small, location = location.abovebar, color = #fb020200) // Bright red for Sell


    alertcondition(longSignaltitle 'Buy alert on Sniper Machine'message 'Buy alert on Sniper Machine')
    alertcondition(shortSignaltitle 'Sell alert on Sniper Machine'message 'Sell alert on Sniper Machine')
    ///////////////

    // Inputs
    src     input.source(hlc3"Source")
    emaLen  input.int(15"Center EMA")
    spreadN input.int(200"Spread Length")
    kMult   input.float(3.0"Multiplier"step=0.1)

    upCol   input.color(color.rgb(25155), "Up Color")
    dnCol   input.color(color.rgb(26,221,127), "Down Color")

    // Core calculation
    mid    ta.ema(srcemaLen)
    spread ta.sma(high lowspreadN)
    uBand  mid kMult spread
    lBand  
    mid kMult spread

    // Crawl bands
    var float upC na
    var float dnC na
    upC 
    := na(upC[1]) ? uBand : (src[1] > upC[1] ? uBand math.min(uBandupC[1]))
    dnC := na(dnC[1]) ? lBand : (src[1] < dnC[1] ? lBand math.max(lBanddnC[1]))

    // Direction & guide
    var int dir na
    var float guide na
    if na(dir[1])
        
    dir := 1
    else
        
    dir := guide[1] == upC[1] ? (src upC ? -1) : (src dnC : -1)
    guide := dir == upC dnC

    // Background zone fill
    bgcolor(dir==color.new(upCol85) : color.new(dnCol85), title="Trend Zone")

    // Guide line
    plot(guide"Trs"color=color.new(dir==1?upCol:dnCol0), linewidth=1)

    // Signals
    trendUpbn    not na(dir[1]) and dir == -and dir[1] != -1
    trendDownbn  
    not na(dir[1]) and dir == 1  and dir[1] != 1
    pbUp       
    dir==-and high >= upC
    pbDown     
    dir==1  and low <= dnC

    dist 
    0.25 spread 
    filteredPbUp   
    pbUp   and (high upC <= dist)
    filteredPbDown pbDown and (dnC low <= dist)

    firstPbUp   filteredPbUp   and not filteredPbUp[1]
    firstPbDown filteredPbDown and not filteredPbDown[1]

    // ATR for vertical spacing of signals
    atrVal ta.atr(14)
    upY   low 15 atrVal
    downY 
    high 10 atrVal

    // Plot BUY/SELL arrows as labels for vertical spacing
    //if trendUpbn
        //label.new(bar_index, upY, text="BUY", style=label.style_triangleup, color=dnCol, textcolor=color.white, size=size.small, yloc=yloc.price)

    //if trendDownbn
        //label.new(bar_index, downY, text="SELL", style=label.style_triangledown, color=upCol, textcolor=color.white, size=size.small, yloc=yloc.price)

    // Pullback dots
    //plotshape(firstPbUp,   style=shape.circle, location=location.belowbar, color=color.new(dnCol,0), size=size.small)
    //plotshape(firstPbDown, style=shape.circle, location=location.abovebar, color=color.new(upCol,0), size=size.small)
    //////////////////////

    // --- User Inputs ---
    // NEW: Added the "20/20 Profile (Ultra-Safe)" option.
    profile input.string('20/20 Profile (Ultra-Safe)''Select Profile'options = ['20/20 Profile (Ultra-Safe)''16/16 Profile (Safe)''12/12 Profile (Balanced)''8/8 Profile (Aggressive)''Custom'], group 'Grid Calculation')

    // These inputs are now only used when "Custom" is selected.
    customRangePercent input.float(6.3title 'Custom Range as % of Price'group 'Grid Calculation')
    customGridCount input.int(12title 'Custom Grid Count'group 'Grid Calculation')

    // Style Inputs
    gridColor input.color(color.new(color.gray60), title 'Grid Line Color'group 'Line Style')
    gridWidth input.int(1title 'Grid Line Width'minval 1maxval 5group 'Line Style')
    gridStyleString input.string('Dotted'title 'Grid Line Style'options = ['Solid''Dashed''Dotted'], group 'Line Style')

    // --- Variable Declarations ---
    var array<linegridLines = array.new_line()
    var array<
    labelpriceLabels = array.new_label()
    var 
    float finalRangePercent 0.0
    var int finalGridCount 0

    // --- Logic to select parameters based on profile ---
    if profile == '20/20 Profile (Ultra-Safe)'
        
    finalRangePercent := 10.5
        finalGridCount 
    := 20
        finalGridCount
    else if profile == '16/16 Profile (Safe)'
        
    finalRangePercent := 8.4
        finalGridCount 
    := 16
        finalGridCount
    else if profile == '12/12 Profile (Balanced)'
        
    finalRangePercent := 6.3
        finalGridCount 
    := 12
        finalGridCount
    else if profile == '8/8 Profile (Aggressive)'
        
    finalRangePercent := 4.2
        finalGridCount 
    := 8
        finalGridCount
    else // Custom
        
    finalRangePercent := customRangePercent
        finalGridCount 
    := customGridCount
        finalGridCount

    // --- Helper Function ---
    getLineStyle(styleString) =>
        
    styleString == 'Solid' line.style_solid styleString == 'Dashed' line.style_dashed line.style_dotted

    // --- Drawing Logic ---
    if barstate.islast
        
    // Delete old lines and labels
        
    if array.size(gridLines) > 0
            
    for lineId in gridLines
                line
    .delete(lineId)
            array.
    clear(gridLines)
        if array.
    size(priceLabels) > 0
            
    for labelId in priceLabels
                label
    .delete(labelId)
            array.
    clear(priceLabels)

        
    // Main Calculation
        
    currentPrice close
        totalRange 
    currentPrice * (finalRangePercent 100)
        
    halfRange totalRange 2.0
        upperLimit 
    currentPrice halfRange
        lowerLimit 
    currentPrice halfRange
        selectedGridStyle 
    getLineStyle(gridStyleString)

        
    // Draw Lines & Labels
        
    array.push(gridLinesline.new(bar_index 99upperLimitbar_indexupperLimitxloc xloc.bar_indexextend extend.nonecolor color.new(color.green20), width 2))
        array.
    push(gridLinesline.new(bar_index 99lowerLimitbar_indexlowerLimitxloc xloc.bar_indexextend extend.nonecolor color.new(color.red20), width 2))
        if 
    finalGridCount 1
            stepSize 
    totalRange finalGridCount
            
    for 1 to finalGridCount 1 by 1
                gridLevel 
    lowerLimit stepSize
                
    array.push(gridLinesline.new(bar_index 99gridLevelbar_indexgridLevelxloc xloc.bar_indexextend extend.nonecolor gridColorwidth gridWidthstyle selectedGridStyle))
        array.
    push(priceLabelslabel.new(bar_indexupperLimittext str.tostring(upperLimitformat.mintick), xloc xloc.bar_indexcolor color.new(color.green70), textcolor color.whitestyle label.style_label_left))
        array.
    push(priceLabelslabel.new(bar_indexlowerLimittext str.tostring(lowerLimitformat.mintick), xloc xloc.bar_indexcolor color.new(color.red70), textcolor color.whitestyle label.style_label_left))
    ///////////////////////////////// 
    Eyvallah üstadım.
    Kodu irdeleyemedim, back test vb. de yapamadım ama...
    Çok iddialı


    Al,sat,tut,yakala,sık,bırak vb. tavsiye için aracı kurumunuzla görüşün.

  2.  Alıntı Originally Posted by KısaVade Yazıyı Oku
    Eyvallah üstadım.
    Kodu irdeleyemedim, back test vb. de yapamadım ama...
    Çok iddialı


    Hele şu projeksiyon doğru ise...
    Tey, tey, teeeeyyyyy


    Al,sat,tut,yakala,sık,bırak vb. tavsiye için aracı kurumunuzla görüşün.

  3.  Alıntı Originally Posted by KısaVade Yazıyı Oku
    Hele şu projeksiyon doğru ise...
    Tey, tey, teeeeyyyyy


    bilirsin üstadım.... projeksiyon doğrudur diyemem....

    çünkü....
    geriye doğru taradığın bar sayısı, aradığın pattern, volalite v.b....donelerle ileriye dönük istenilen bar sayısı kadar yapılıyor ki.....
    her periyottaki farklılıkta cabası....

    dediğin gibi...irdelemeden...test yapmadan....kullanmak
    veya
    kesin doğrudur...dememek lazım....

    bence projeksiyon çalışmalarında....her meta için spesifik ayarlar kullanılması taraftarıyım....
    endeks, btc, vadeli, hisse, usd gibi farklılıklarda...genel geçer durum yakalamak çok zor....
    selamlar...
    16.07.2024 - 10.12.2024

  4. https://www.tradingview.com/x/cRLp7tSr/

    ema3-atr5-sma10 kullanılarak yapılmış kombine örneği....

    denemek isteyene kodu...

    PHP Code:
    //@version=6
    indicator(title 'deneme'shorttitle '.'overlay truemax_lines_count 100max_labels_count=100max_boxes_count 100max_bars_back 100)

    var 
    params "Parameters"
    src55 nz(input.source(closetitle "Source"group params))
    len55 input.int(5title "ATR Len"group params)
    multi55 input.float(1.5title "Multi"step 0.25minval 0group params)

    var 
    cols "Colors"
    up_col input.color(color.rgb(25525525500), title "Yükseliş"group cols)
    down_col input.color(color.rgb(24733), title "DÜşüş"group cols)
    flat_col input.color(color.rgb(00000), title "Flat "inline "3"group cols)

    rope_smoother(float _src55float _threshold) =>

        var 
    float _rope _src55

        _move 
    _src55 _rope //Movement from Rope

        
    _rope += math.max(math.abs(_move) - nz(_threshold), 0) * math.sign(_move//Directional Movement beyond the Threshold
        
        
    [_rope,_rope+_threshold,_rope-_threshold//[Rope, Upper, Lower]

    ///_____________________________________________________________________________________________________________________

    //Calculating Rope
    atr99 ta.atr(len55)*multi55

    [rope,upper,lower] = rope_smoother(src55,atr99)

    //Directional Detection
    var dir 0

    dir 
    := rope rope[1] ? rope rope[1] ? -dir

    if ta.cross(src55,rope)
        
    dir := 0

    //Directional Color Assignment    
    col dir up_col dir down_col flat_col

    //High and Low Output Lines
    var float c_hi na
    var float c_lo na

    //Counters for Accumulating Averages
    var float h_sum 0
    var float l_sum 0
    var int c_count 0

    //Flip-Flop
    var ff 1

    if dir == 0

        
    if dir[1] != 0
            h_sum 
    := 0
            l_sum 
    := 0
            c_count 
    := 0
            ff 
    := ff * -1

        h_sum 
    += upper
        l_sum 
    += lower
        c_count 
    += 1
        c_hi 
    := h_sum/c_count
        c_lo 
    := l_sum/c_count

    ///
    plot(ropelinewidth 2color coltitle "ATR5"force_overlay true)
    ////////////////
    renk input(true)
    smaHigh ta.sma(high10)
    smaLow ta.sma(low10)
    mf=(smaHigh+smaLow)/2
    //plot(mf, title = '@yörük@ ', color = #fd07f500, linewidth = 2)
    plot(mftitle 'sma10'style plot.style_linebrcolor renk mf close color.rgb(000100)  : color.rgb(255255255100) : color.silverlinewidth 2)

    //////////////////////////////////
    type_ma input.string("EMA""Type"options = ["SMA""EMA"], group "MA")
    length98 input.int(3"Length"inline "ma"group "MA")
    source98 input.source(close""inline "ma"group "MA")
    grp98 "MA Shift Oscillator"
    osc_len input.int(15"Length"group grp98inline "osc")
    osc_threshold input.float(0.5""step 0.1group grp98inline "osc")

    osc_col_up2 input.color(color.rgb(255255255100), ""inline "c"group "color")
    osc_col_dn2 input.color(color.rgb(000100), ""inline "c"group "color")

    ma(source98length98MAtype) =>
        switch 
    MAtype
            
    "SMA"                   => ta.sma(source98length98)
            
    "EMA"                   => ta.ema(source98length98)
    // MA 
    MA ma(source98length98type_ma
    color98 source98 >= MA osc_col_up2 osc_col_dn2

    plot
    (MA"ema3"color=color98force_overlay truelinewidth 1)

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

  5. ilave...mtf sar tablo....macd bar uyarılı... (yedekleme)
    https://www.tradingview.com/x/m87JtZOz/

    denemek ve geliştirmek isteyene....

    PHP Code:
    //@version=6
    indicator(title 'deneme'shorttitle '.'overlay truemax_lines_count 100max_labels_count=100max_boxes_count 100max_bars_back 100)
    //////////////////////////////////////////////////////////////////MTF SAR HESAPLAMASIDIR///////////////
    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_right :
      
    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)

    //////////////////////
    var params "Parameters"
    src55 nz(input.source(closetitle "Source"group params))
    len55 input.int(5title "ATR Len"group params)
    multi55 input.float(1.5title "Multi"step 0.25minval 0group params)

    var 
    cols "Colors"
    up_col input.color(color.rgb(25525525500), title "Yükseliş"group cols)
    down_col input.color(color.rgb(24733), title "DÜşüş"group cols)
    flat_col input.color(color.rgb(00000), title "Flat "inline "3"group cols)

    rope_smoother(float _src55float _threshold) =>

        var 
    float _rope _src55

        _move 
    _src55 _rope //Movement from Rope

        
    _rope += math.max(math.abs(_move) - nz(_threshold), 0) * math.sign(_move//Directional Movement beyond the Threshold
        
        
    [_rope,_rope+_threshold,_rope-_threshold//[Rope, Upper, Lower]

    ///_____________________________________________________________________________________________________________________

    //Calculating Rope
    atr99 ta.atr(len55)*multi55

    [rope,upper,lower] = rope_smoother(src55,atr99)

    //Directional Detection
    var dir 0

    dir 
    := rope rope[1] ? rope rope[1] ? -dir

    if ta.cross(src55,rope)
        
    dir := 0

    //Directional Color Assignment    
    col dir up_col dir down_col flat_col

    //High and Low Output Lines
    var float c_hi na
    var float c_lo na

    //Counters for Accumulating Averages
    var float h_sum 0
    var float l_sum 0
    var int c_count 0

    //Flip-Flop
    var ff 1

    if dir == 0

        
    if dir[1] != 0
            h_sum 
    := 0
            l_sum 
    := 0
            c_count 
    := 0
            ff 
    := ff * -1

        h_sum 
    += upper
        l_sum 
    += lower
        c_count 
    += 1
        c_hi 
    := h_sum/c_count
        c_lo 
    := l_sum/c_count

    ///
    plot(ropelinewidth 3color coltitle "ATR"force_overlay true)
    //////////////////////////////////////////////////////////////////////
    groupFrames 'Trend Monitoring Time Frames'

    tf1 input.timeframe('1'title='TF1 - Short'group=groupFrames)
    tf2 input.timeframe('5'title='TF2 - Medium'group=groupFrames)
    tf3 input.timeframe('15'title='TF3 - Long'group=groupFrames)

    statusThreshold input.int(4title='Min Status Matches for Candle Color'options=[1234])

    //-----------------------------------------
    // User Inputs - Candle Color Settings
    //-----------------------------------------
    groupBody 'Candle Color: Body'
    sbBodyColor     input.color(color.whitetitle='KESİN AL'group=groupBody)
    bullBodyColor   input.color(color.rgb(255255255100), title='AL'group=groupBody)
    baseBodyColor   input.color(color.rgb(444), title='DİKKAT ET'group=groupBody)
    bearBodyColor   input.color(color.rgb(2558282100), title='SAT'group=groupBody)
    sbearBodyColor  input.color(color.rgb(2558282100), title='KESİN SAT'group=groupBody)
    ghostBodyColor  input.color(color.rgb(22364251100), title='TREND YOK'group=groupBody)

    groupBorder 'Candle Color: Border & Wick'
    sbBorderColor     input.color(color.whitetitle='KESİN AL'group=groupBorder)
    bullBorderColor   input.color(color.rgb(255255255100), title='AL'group=groupBorder)
    baseBorderColor   input.color(color.rgb(444), title='DİKKAT ET'group=groupBorder)
    bearBorderColor   input.color(color.rgb(2558282100), title='SAT'group=groupBorder)
    sbearBorderColor  input.color(color.rgb(2558282100), title='KESİN SAT'group=groupBorder)
    ghostBorderColor  input.color(color.rgb(22364251100), title='TREND YOK'group=groupBorder)

    //-----------------------------------------
    // User Inputs - MACD Settings (at bottom per request)
    //-----------------------------------------
    groupMACD 'MACD Settings'
    macdFastLen input.int(20title='MACD Fast Length'minval=1group=groupMACD)
    macdSlowLen input.int(40title='MACD Slow Length'minval=1group=groupMACD)
    macdSignalLen input.int(5title='MACD Signal Smoothing'minval=1group=groupMACD)
    maType input.string('EMA'title='MACD MA Type'options=['EMA''SMA''WMA'], group=groupMACD)

    //-----------------------------------------
    // MACD Calculation Function
    //-----------------------------------------
    calcMACD(_src_fastLen_slowLen_signalLen) =>
        
    fastMA maType == 'EMA' ta.ema(_src_fastLen) : maType == 'SMA' ta.sma(_src_fastLen) : ta.wma(_src_fastLen)
        
    slowMA maType == 'EMA' ta.ema(_src_slowLen) : maType == 'SMA' ta.sma(_src_slowLen) : ta.wma(_src_slowLen)
        
    macdValue fastMA slowMA
        signalLine 
    maType == 'EMA' ta.ema(macdValue_signalLen) : maType == 'SMA' ta.sma(macdValue_signalLen) : ta.wma(macdValue_signalLen)
        
    hist macdValue signalLine
        
    [macdValuesignalLinehistfastMAslowMA]

    //-----------------------------------------
    // MACD (10m) Logic
    //-----------------------------------------
    [macdLinesignalLinemacdHist__] = request.security(syminfo.tickerid'10'calcMACD(closemacdFastLenmacdSlowLenmacdSignalLen))
    macdBullish macdLine signalLine
    macdStrong 
    macdBullish and macdLine > -0.25 and signalLine > -0.25
    macdSuperBear 
    not macdBullish and macdLine < -0.25 and signalLine < -0.25
    macdNeutral 
    not macdBullish and macdLine > -0.025 and signalLine > -0.025 and not macdSuperBear
    macdText 
    macdStrong 'SUPERBULL' macdSuperBear 'SUPERBEAR' macdNeutral 'Basing' macdBullish 'Bullish' 'Bearish'

    //-----------------------------------------
    // Timeframe Status Function
    //-----------------------------------------
    f_getStatus(tf) =>
        [
    smaHighsmaLow] = request.security(syminfo.tickeridtf, [ta.sma(high20), ta.sma(low20)])
        [
    macdLine_tfsignalLine_tf_fastMA_tfslowMA_tf] = request.security(syminfo.tickeridtfcalcMACD(closemacdFastLenmacdSlowLenmacdSignalLen))
        
    price_tf request.security(syminfo.tickeridtfclose)
        
    macdBullish_tf macdLine_tf signalLine_tf
        aboveSMAs 
    price_tf smaHigh and price_tf smaLow
        belowSMAs 
    price_tf smaHigh and price_tf smaLow
        belowMAs 
    macdLine_tf fastMA_tf and signalLine_tf slowMA_tf
        status 
    ''
        
    statusColor color.gray
        
    if aboveSMAs and macdBullish_tf and macdLine_tf > -0.025
            status 
    := 'SUPERBULL'
        
    else if belowSMAs and not macdBullish_tf and macdLine_tf < -0.025 and belowMAs
            status 
    := 'SUPERBEAR'
        
    else if macdLine_tf > -0.025 and not macdBullish_tf
            status 
    := 'Basing'
        
    else if aboveSMAs and macdBullish_tf
            status 
    := 'Bullish'
        
    else if not aboveSMAs and not macdBullish_tf
            status 
    := 'Bearish'
        
    [statusstatusColor]

    //-----------------------------------------
    // Timeframe Status Logic
    //-----------------------------------------
    [status1color1] = f_getStatus(tf1)
    [
    status5color5] = f_getStatus(tf2)
    [
    status15color15] = f_getStatus(tf3)

    //-----------------------------------------
    // Status Match Count
    //-----------------------------------------
    superbullCount = (macdText == 'SUPERBULL' 0) + (status1 == 'SUPERBULL' 0) + (status5 == 'SUPERBULL' 0) + (status15 == 'SUPERBULL' 0)
    superbearCount = (macdText == 'SUPERBEAR' 0) + (status1 == 'SUPERBEAR' 0) + (status5 == 'SUPERBEAR' 0) + (status15 == 'SUPERBEAR' 0)
    basingCount = (macdText == 'Basing' 0) + (status1 == 'Basing' 0) + (status5 == 'Basing' 0) + (status15 == 'Basing' 0)
    bullishCount = (macdText == 'Bullish' 0) + (status1 == 'Bullish' 0) + (status5 == 'Bullish' 0) + (status15 == 'Bullish' 0)
    bearishCount = (macdText == 'Bearish' 0) + (status1 == 'Bearish' 0) + (status5 == 'Bearish' 0) + (status15 == 'Bearish' 0)

    //-----------------------------------------
    // Candle Coloring Logic
    //-----------------------------------------
    candleBodyColor ghostBodyColor
    candleBorderWickColor 
    ghostBorderColor

    if superbullCount >= statusThreshold
        candleBodyColor 
    := sbBodyColor
        candleBorderWickColor 
    := sbBorderColor
    else if superbearCount >= statusThreshold
        candleBodyColor 
    := sbearBodyColor
        candleBorderWickColor 
    := sbearBorderColor
    else if basingCount >= statusThreshold
        candleBodyColor 
    := baseBodyColor
        candleBorderWickColor 
    := baseBorderColor
    else if bullishCount >= statusThreshold
        candleBodyColor 
    := bullBodyColor
        candleBorderWickColor 
    := bullBorderColor
    else if bearishCount >= statusThreshold
        candleBodyColor 
    := bearBodyColor
        candleBorderWickColor 
    := bearBorderColor

    plotcandle
    (openhighlowclose,
         
    title='BAR',
         
    color=candleBodyColor,
         
    bordercolor=candleBorderWickColor,
         
    wickcolor=candleBorderWickColor)
    //////////////////////////////////////////////////////
    //@version=6
    var table logo table.new(position.bottom_center11)
    if 
    barstate.islast
        table
    .cell(logo00'deneme eğitim çalışması kod birleştirme örneği    'text_size size.normaltext_color color.rgb(2182415))

    //@version=6

    smaHigh ta.sma(high6)
    smaLow ta.sma(low6)
    mf=(smaHigh+smaLow)/2
    plot
    (mftitle 'sma6 'color #fd07f500, linewidth = 2)

    type_ma input.string("EMA""Type"options = ["SMA""EMA"], group "MA")
    length98 input.int(3"Length"inline "ma"group "MA")
    source98 input.source(close""inline "ma"group "MA")
    grp98 "MA Shift Oscillator"
    osc_len input.int(15"Length"group grp98inline "osc")
    osc_threshold input.float(0.5""step 0.1group grp98inline "osc")

    osc_col_up2 input.color(color.rgb(255255255100), ""inline "c"group "color")
    osc_col_dn2 input.color(color.rgb(000100), ""inline "c"group "color")

    ma(source98length98MAtype) =>
        switch 
    MAtype
            
    "SMA"                   => ta.sma(source98length98)
            
    "EMA"                   => ta.ema(source98length98)
    // MA 
    MA ma(source98length98type_ma
    color98 source98 >= MA osc_col_up2 osc_col_dn2

    plot
    (MA"ema"color=color98force_overlay truelinewidth 1)

    renk input(true)
    grp1 "Indicator Settings"
    src44 input.source(hlc3"Source"group=grp1tooltip="Price source used for band calculations"display display.data_window)
    len44 input.int(3"Length"group=grp1tooltip="Length for the basis calculation"display display.data_window)
    basis ta.ema(ta.ema(src44len44), len44)
    plot(basistitle 'ema3'style plot.style_linebrcolor renk basis close color.rgb(000100)  : color.rgb(255255255100) : color.silverlinewidth 2)
    /////////////////////////////// 
    16.07.2024 - 10.12.2024

  6. https://www.tradingview.com/x/kZ58kBwO/

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

    // ── Enhanced Inputs

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

    // Inputs
    src     input.source(hlc3"Source")
    emaLen  input.int(1"Center EMA")
    spreadN input.int(100"Spread Length")
    kMult   input.float(3.0"Multiplier"step=0.1)

    upCol   input.color(color.rgb(25155), "Up Color")
    dnCol   input.color(color.rgb(26,221,127), "Down Color")

    // Core calculation
    mid    ta.ema(srcemaLen)
    spread ta.sma(high lowspreadN)
    uBand  mid kMult spread
    lBand  
    mid kMult spread

    // Crawl bands
    var float upC na
    var float dnC na
    upC 
    := na(upC[1]) ? uBand : (src[1] > upC[1] ? uBand math.min(uBandupC[1]))
    dnC := na(dnC[1]) ? lBand : (src[1] < dnC[1] ? lBand math.max(lBanddnC[1]))

    // Direction & guide
    var int dir na
    var float guide na
    if na(dir[1])
        
    dir := 1
    else
        
    dir := guide[1] == upC[1] ? (src upC ? -1) : (src dnC : -1)
    guide := dir == upC dnC

    // Background zone fill
    //bgcolor(dir==1 ? color.new(upCol, 85) : color.new(dnCol, 85), title="Trend Zone")

    // Guide line
    plot(guide"ema1"color=color.new(dir==1?upCol:dnCol0), linewidth=1)

    // Signals
    trendUpbn    not na(dir[1]) and dir == -and dir[1] != -1
    trendDownbn  
    not na(dir[1]) and dir == 1  and dir[1] != 1
    pbUp       
    dir==-and high >= upC
    pbDown     
    dir==1  and low <= dnC

    dist 
    0.25 spread 
    filteredPbUp   
    pbUp   and (high upC <= dist)
    filteredPbDown pbDown and (dnC low <= dist)

    firstPbUp   filteredPbUp   and not filteredPbUp[1]
    firstPbDown filteredPbDown and not filteredPbDown[1]

    // ATR for vertical spacing of signals
    atrVal ta.atr(14)
    upY   low 15 atrVal
    downY 
    high 10 atrVal

    // Plot BUY/SELL arrows as labels for vertical spacing
    //if trendUpbn
        //label.new(bar_index, upY, text="BUY", style=label.style_triangleup, color=dnCol, textcolor=color.white, size=size.small, yloc=yloc.price)

    //if trendDownbn
        //label.new(bar_index, downY, text="SELL", style=label.style_triangledown, color=upCol, textcolor=color.white, size=size.small, yloc=yloc.price)

    // Pullback dots
    //plotshape(firstPbUp,   style=shape.circle, location=location.belowbar, color=color.new(dnCol,0), size=size.small)
    //plotshape(firstPbDown, style=shape.circle, location=location.abovebar, color=color.new(upCol,0), size=size.small)
    ////////////////////// 
    16.07.2024 - 10.12.2024

  7. https://www.tradingview.com/x/JOJTMcEz/

    farklı kodlarla yapılmış kombine örneği....

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

    // ── Enhanced Inputs
    string GRP1 "Core Pattern Matching"
    string GRP2 "Projection & Smoothing"
    string GRP3 "Quality & Filtering"
    string GRP4 "Visuals"

    int   patLen   input.int(20,   "Pattern Length",      minval=8,  maxval=200group=GRP1)
    int   fLen     input.int(30,   "Forecast Bars",       minval=5,  maxval=300group=GRP1)
    int   depth    input.int(2000"Search Depth",        minval=200,maxval=6000,group=GRP1)
    float minConf  input.float(0.30,"Min Confidence",     minval=0.10,maxval=0.95,step=0.05,group=GRP1)

    string scaling    input.string("Adaptive","Scaling Method"options=["Fixed","Adaptive","Volatility","Z-Score"], group=GRP2)
    string smoothing  input.string("EMA","Projection Smoothing"options=["None","SMA","EMA","Adaptive"], group=GRP2)
    int    smoothLen  input.int(3"Smoothing Length",     minval=2,  maxval=10group=GRP2)

    bool   useQualFilter input.bool(true,  "Enable Quality Filter"group=GRP3)
    float  minVariance   input.float(0.001,"Min Pattern Variance"minval=0.0001maxval=0.01step=0.0001group=GRP3)
    int    trendCheck    input.int(5,      "Trend Coherence Bars"minval=3maxval=15group=GRP3)

    bool showProj   input.bool(true,  "Show Projection"group=GRP4)
    bool showBands  input.bool(true,  "Show Bands",      group=GRP4)
    bool showZones  input.bool(true,  "Show Zones",      group=GRP4)

    // Enhanced colors
    color upColor   input.color(#00FF88, "Uptrend (Green)",   group=GRP4)
    color dnColor   input.color(#FF4444, "Downtrend (Red)",   group=GRP4)
    color swColor   input.color(#FFAA00, "Sideways (Yellow)", group=GRP4)

    // ── Enhanced Data buffers
    var array<floatprices = array.new<float>()
    var array<
    int>   times  = array.new<int>()
    var array<
    floathighs  = array.new<float>()
    var array<
    floatlows   = array.new<float>()

    // handles
    var array<linehProj = array.new<line>()
    var array<
    linehBand = array.new<line>()
    var array<
    box>  hBox  = array.new<box>()
    var 
    label       hLbl  na

    // ── Enhanced Helper Functions
    safeDiv(float nfloat dfloat fb) => 
        
    == 0.0 fb d

    // Enhanced cosine similarity with multiple normalization methods
    cosineSim(array<floatarrint startAint startBint lenstring method "returns") =>
        array<
    floatseqA = array.new<float>()
        array<
    floatseqB = array.new<float>()
        
        
    // Extract sequences
        
    for 0 to len 1
            
    array.push(seqA, array.get(arrstartA i))
            array.
    push(seqB, array.get(arrstartB i))
        
        
    // Normalize based on method
        
    if method == "returns"
            
    // Return-based normalization (original method)
            
    float dp 0.0na2 0.0nb2 0.0
            
    for 1 to len 1
                float a0 
    = array.get(seqA1)
                
    float a1 = array.get(seqAk)
                
    float b0 = array.get(seqB1)
                
    float b1 = array.get(seqBk)
                
    float ra safeDiv(a1 a0a00.0)
                
    float rb safeDiv(b1 b0b00.0)
                
    dp  := dp ra rb
                na2 
    := na2 ra ra
                nb2 
    := nb2 rb rb
            float den 
    math.sqrt(na2) * math.sqrt(nb2)
            
    den == 0.0 0.0 dp den
        
    else
            
    // Z-score normalization for more stable comparison
            
    float meanA 0.0meanB 0.0
            
    for 0 to len 1
                meanA 
    := meanA + array.get(seqAi)
                
    meanB := meanB + array.get(seqBi)
            
    meanA := meanA len
            meanB 
    := meanB len
            
            float stdA 
    0.0stdB 0.0
            
    for 0 to len 1
                float diffA 
    = array.get(seqAi) - meanA
                float diffB 
    = array.get(seqBi) - meanB
                stdA 
    := stdA diffA diffA
                stdB 
    := stdB diffB diffB
            stdA 
    := math.sqrt(stdA len)
            
    stdB := math.sqrt(stdB len)
            
            if 
    stdA == 0.0 or stdB == 0.0
                0.0
            
    else
                
    float dp 0.0na2 0.0nb2 0.0
                
    for 0 to len 1
                    float za 
    = (array.get(seqAi) - meanA) / stdA
                    float zb 
    = (array.get(seqBi) - meanB) / stdB
                    dp  
    := dp za zb
                    na2 
    := na2 za za
                    nb2 
    := nb2 zb zb
                float den 
    math.sqrt(na2) * math.sqrt(nb2)
                
    den == 0.0 0.0 dp den

    // Pattern quality validation
    patternQuality(array<floatarrint startint len) =>
        if 
    start or start len >= array.size(arr)
            
    0.0
        
    else
            
    // Calculate variance to ensure pattern has sufficient movement
            
    float mean 0.0
            
    for 0 to len 1
                mean 
    := mean + array.get(arrstart i)
            
    mean := mean len
            
            float variance 
    0.0
            
    for 0 to len 1
                float diff 
    = array.get(arrstart i) - mean
                variance 
    := variance diff diff
            variance 
    := variance len
            
            
    // Check trend coherence - avoid choppy patterns
            
    int trendChanges 0
            bool lastUp 
    false
            bool firstCheck 
    true
            
    for 1 to len 1
                bool currentUp 
    = array.get(arrstart i) > array.get(arrstart 1)
                if 
    not firstCheck and currentUp != lastUp
                    trendChanges 
    := trendChanges 1
                lastUp 
    := currentUp
                firstCheck 
    := false
            
            float coherence 
    1.0 - (trendChanges / (len 1))
            
    math.sqrt(variance) * coherence

    // Enhanced smoothing function
    smoothProjection(array<floatprojstring methodint length) =>
        array<
    floatsmoothed = array.new<float>()
        
    int size = array.size(proj)
        
        if 
    method == "None"
            
    for 0 to size 1
                
    array.push(smoothed, array.get(proji))
        else if 
    method == "SMA"
            
    for 0 to size 1
                float sum 
    0.0
                int count 
    0
                int start 
    math.max(0length 1)
                for 
    start to i
                    sum 
    := sum + array.get(projj)
                    
    count := count 1
                
    array.push(smoothedsum count)
        else if 
    method == "EMA"
            
    float alpha 2.0 / (length 1.0)
            array.
    push(smoothed, array.get(proj0))
            for 
    1 to size 1
                float prev 
    = array.get(smoothed1)
                
    float curr = array.get(proji)
                array.
    push(smoothedalpha curr + (1.0 alpha) * prev)
        else 
    // Adaptive
            
    for 0 to size 1
                float sum 
    0.0
                float weightSum 
    0.0
                int adaptiveLen 
    length length
                
    for 0 to adaptiveLen 1
                    float weight 
    1.0 / (1.0)
                    
    sum := sum + array.get(projj) * weight
                    weightSum 
    := weightSum weight
                
    array.push(smoothedsum weightSum)
        
        
    smoothed

    // Sample std of returns (enhanced for volatility scaling)
    retStd(array<floatarrint startint len) =>
        if 
    start or start len >= array.size(arr)
            
    0.0
        
    else
            
    float s 0.0
            float c 
    0.0
            
    for start 1 to start len
                float r 
    safeDiv(array.get(arrk) - array.get(arr1), array.get(arr1), 0.0)
                
    := r
                c 
    := 1.0
            float m 
    safeDiv(sc0.0)
            
    float ss 0.0
            
    for start 1 to start len
                float r 
    safeDiv(array.get(arrk) - array.get(arr1), array.get(arr1), 0.0)
                
    float d m
                ss 
    := ss d
            math
    .sqrt(safeDiv(ssmath.max(1.01.0), 0.0))

    // Array min/max over a range
    arrMin(array<floataint startint len) =>
        
    float m na
        int stop 
    math.min(start len, array.size(a))
        if 
    start >= and start < array.size(a)
            for 
    start to stop 1
                float v 
    = array.get(ai)
                
    := na(m) ? math.min(mv)
        
    m

    arrMax
    (array<floataint startint len) =>
        
    float m na
        int stop 
    math.min(start len, array.size(a))
        if 
    start >= and start < array.size(a)
            for 
    start to stop 1
                float v 
    = array.get(ai)
                
    := na(m) ? math.max(mv)
        
    m

    // Draw cleanup
    cleanup() =>
        for 
    l in hProj
            line
    .delete(l)
        array.
    clear(hProj)
        for 
    l in hBand
            line
    .delete(l)
        array.
    clear(hBand)
        for 
    b in hBox
            box
    .delete(b)
        array.
    clear(hBox)
        if 
    not na(hLbl)
            
    label.delete(hLbl)

    // Keep arrays bounded
    keep(int maxKeep) =>
        while array.
    size(prices) > maxKeep
            
    array.shift(prices)
            array.
    shift(times)
            array.
    shift(highs)
            array.
    shift(lows)

    // ── Ingest
    array.push(pricesclose)
    array.
    push(times,  time)
    array.
    push(highs,  high)
    array.
    push(lows,   low)
    keep(depth patLen fLen 50)

    // ── Enhanced Engine
    if barstate.islastconfirmedhistory and array.size(prices) > patLen fLen
        cleanup
    ()
        
    hLbl := na

        int N 
    = array.size(prices)
        
    int recentStart patLen
        int searchEnd   
    patLen fLen
        int searchStart 
    math.max(0searchEnd depth)

        
    float bestScore = -1.0
        int   bestIdx   
    0
        float bestQuality 
    0.0

        
    // Enhanced pattern search with quality filtering
        
    for searchStart to searchEnd
            
    // Check pattern quality first if filtering enabled
            
    float quality useQualFilter patternQuality(pricesipatLen) : 1.0
            
            
    if quality >= minVariance
                string simMethod 
    scaling == "Z-Score" "zscore" "returns"
                
    float s cosineSim(pricesrecentStartipatLensimMethod)
                
                
    // Weight similarity by pattern quality
                
    float weightedScore * (0.7 0.3 math.min(quality / (minVariance 10.0), 1.0))
                
                if 
    weightedScore bestScore
                    bestScore 
    := weightedScore
                    bestIdx 
    := i
                    bestQuality 
    := quality

        bool have 
    bestScore >= minConf
        
    if have
            
    // Enhanced scaling methods
            
    float cur      = array.get(prices1)
            
    float baseHist = array.get(pricesbestIdx patLen 1)
            
    float scale    1.0
            
            
    if scaling == "Fixed"
                
    scale := 1.0
            
    else if scaling == "Adaptive"
                
    scale := safeDiv(curbaseHist1.0)
            else if 
    scaling == "Volatility"
                
    float cstd retStd(pricespatLenpatLen)
                
    float hstd retStd(pricesbestIdxpatLen)
                
    float vr   safeDiv(cstdhstd1.0)
                
    scale := safeDiv(curbaseHist1.0) * vr
            
    else // Z-Score
                // Z-score based scaling for more stable projections
                
    float histMean 0.0
                
    for 0 to patLen 1
                    histMean 
    := histMean + array.get(pricesbestIdx i)
                
    histMean := histMean patLen
                
                float histStd 
    0.0
                
    for 0 to patLen 1
                    float diff 
    = array.get(pricesbestIdx i) - histMean
                    histStd 
    := histStd diff diff
                histStd 
    := math.sqrt(histStd patLen)
                
                
    float currentStd ta.stdev(closepatLen)
                
    scale := safeDiv(currentStdhistStd1.0)

            
    // Build raw projection path
            
    array<floatrawProj = array.new<float>()
            for 
    0 to fLen 1
                float src 
    = array.get(pricesbestIdx patLen k)
                
    float val cur + (src baseHist) * scale
                
    array.push(rawProjval)

            
    // Apply smoothing to projection
            
    array<floatproj smoothProjection(rawProjsmoothingsmoothLen)
            
            
    // Enhanced confidence bands
            
    float baseVol ta.atr(20)
            
    float confMult = (1.0 bestScore) * 2.0 + (1.0 bestQuality / (minVariance 20.0)) * 1.0
            
            
    array<floatup = array.new<float>()
            array<
    floatdn = array.new<float>()
            for 
    0 to array.size(proj) - 1
                float val 
    = array.get(proji)
                
    float dynamicConf baseVol confMult * (1.0 0.1 fLen// Expanding confidence
                
    array.push(upval dynamicConf)
                array.
    push(dnval dynamicConf)

            
    // Directional analysis with smoothed values
            
    float last = array.get(proj, array.size(proj) - 1)
            
    float pct  safeDiv(last curcur0.0) * 100.0
            color lnColor 
    math.abs(pct) < 0.3 swColor : (pct upColor dnColor)

            
    // Draw enhanced projection
            
    if showProj
                line l0 
    line.new(bar_indexcurbar_index 1, array.get(proj0), color=lnColorwidth=3)
                array.
    push(hProjl0)
                for 
    0 to array.size(proj) - 2
                    line lk 
    line.new(bar_index 1, array.get(projk),
                                       
    bar_index 2, array.get(proj1),
                                       
    color=lnColorwidth=3)
                    array.
    push(hProjlk)

            
    // Enhanced bands
            
    if showBands
                color bc 
    color.new(lnColor70)
                
    line u0 line.new(bar_indexcur baseVol confMultbar_index 1, array.get(up0), color=bcstyle=line.style_dashed)
                
    line d0 line.new(bar_indexcur baseVol confMultbar_index 1, array.get(dn0), color=bcstyle=line.style_dashed)
                array.
    push(hBandu0)
                array.
    push(hBandd0)
                for 
    0 to array.size(up) - 2
                    line uu 
    line.new(bar_index 1, array.get(upk), bar_index 2, array.get(up1), color=bcstyle=line.style_dashed)
                    
    line dd line.new(bar_index 1, array.get(dnk), bar_index 2, array.get(dn1), color=bcstyle=line.style_dashed)
                    array.
    push(hBanduu)
                    array.
    push(hBanddd)

            
    // Zones (unchanged)
            
    if showZones
                float hLow  
    arrMin(lows,  bestIdxpatLen)
                
    float hHigh arrMax(highsbestIdxpatLen)
                if 
    not na(hLow) and not na(hHigh)
                    
    box b1 box.new(array.get(timesbestIdx), hLow, array.get(timesbestIdx patLen 1), hHigh,
                                     
    xloc=xloc.bar_timebgcolor=color.new(lnColor85), border_color=color.new(lnColor55))
                    array.
    push(hBoxb1)
                
    float cLow  ta.lowest(low,  patLen)
                
    float cHigh ta.highest(high,patLen)
                
    box b2 box.new(bar_index patLen 1cLowbar_indexcHigh,
                                 
    bgcolor=color.new(color.blue85), border_color=color.new(color.blue55))
                array.
    push(hBoxb2)

            
    // Enhanced label with quality metrics
            
    string tname math.abs(pct) < 0.3 "SIDEWAYS" : (pct "BULLISH" "BEARISH")
            
    string emoji math.abs(pct) < 0.3 "↔"        : (pct "▲"      "▼")
            
    string lbl   str.format("{0} ENHANCED PROJECTION ({1})\nConfidence: {2,number,#.0}% | Quality: {3,number,#.0}%\nTarget: {4,number,#.##} | Change: {5,number,#.1}%\nMethod: {6} | Smoothing: {7}",
                                      
    emojitnamebestScore*100.0bestQuality*10000.0lastpctscalingsmoothing)
            
    hLbl := label.new(bar_index math.round(array.size(proj)/2.0), math.max(curlast) + ta.atr(10),
                              
    lblcolor=color.new(lnColor20), textcolor=color.white,
                              
    style=label.style_label_downsize=size.normal)

    ////////////////////
    // UI Options for Auto Trend Detection and No Signal in Sideways Market
    autoTrendDetection input.bool(truetitle 'Auto Trend Detection')
    noSignalSideways input.bool(truetitle 'No Signal in Sideways Market')


    // Color variables
    upTrendColor color.white
    neutralColor 
    #90bff9
    downTrendColor color.blue


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


    // Sampling Period - Replaced with Sniper Machine
    period input.int(defval 9minval 1title 'Sniper Machine Period')


    // Trend Master - Replaced with Sniper Machine
    multiplier input.float(defval 3.0minval 0.1title 'Sniper Machine Multiplier')


    // 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


    // Buy/Sell Signals - Adapted from Clear Trend Logic
    trendUp upCount // Equivalent to REMA_up in Clear Trend
    newBuySignal trendUp and not trendUp[1] and barstate.isconfirmed
    newSellSignal 
    not trendUp and trendUp[1] and barstate.isconfirmed


    initialCondition 
    0
    initialCondition 
    := newBuySignal newSellSignal ? -initialCondition[1]
    longSignal newBuySignal and initialCondition[1] == -1
    shortSignal 
    newSellSignal and initialCondition[1] == 1


    // Alerts and Signals
    plotshape(longSignaltitle 'Buy Signal'text '🚀'textcolor #000000, style = shape.labelup, size = size.small, location = location.belowbar, color = #fae10400) // Bright yellow for Buy
    plotshape(shortSignaltitle 'Sell Signal'text '🚨'textcolor #000000, style = shape.labeldown, size = size.small, location = location.abovebar, color = #fb020200) // Bright red for Sell


    alertcondition(longSignaltitle 'Buy alert on Sniper Machine'message 'Buy alert on Sniper Machine')
    alertcondition(shortSignaltitle 'Sell alert on Sniper Machine'message 'Sell alert on Sniper Machine')
    ///////////////

    // Inputs
    src     input.source(hlc3"Source")
    emaLen  input.int(15"Center EMA")
    spreadN input.int(200"Spread Length")
    kMult   input.float(3.0"Multiplier"step=0.1)

    upCol   input.color(color.rgb(25155), "Up Color")
    dnCol   input.color(color.rgb(26,221,127), "Down Color")

    // Core calculation
    mid    ta.ema(srcemaLen)
    spread ta.sma(high lowspreadN)
    uBand  mid kMult spread
    lBand  
    mid kMult spread

    // Crawl bands
    var float upC na
    var float dnC na
    upC 
    := na(upC[1]) ? uBand : (src[1] > upC[1] ? uBand math.min(uBandupC[1]))
    dnC := na(dnC[1]) ? lBand : (src[1] < dnC[1] ? lBand math.max(lBanddnC[1]))

    // Direction & guide
    var int dir na
    var float guide na
    if na(dir[1])
        
    dir := 1
    else
        
    dir := guide[1] == upC[1] ? (src upC ? -1) : (src dnC : -1)
    guide := dir == upC dnC

    // Background zone fill
    bgcolor(dir==color.new(upCol85) : color.new(dnCol85), title="Trend Zone")

    // Guide line
    plot(guide"ema15"color=color.new(dir==1?upCol:dnCol0), linewidth=1)

    // Signals
    trendUpbn    not na(dir[1]) and dir == -and dir[1] != -1
    trendDownbn  
    not na(dir[1]) and dir == 1  and dir[1] != 1
    pbUp       
    dir==-and high >= upC
    pbDown     
    dir==1  and low <= dnC

    dist 
    0.25 spread 
    filteredPbUp   
    pbUp   and (high upC <= dist)
    filteredPbDown pbDown and (dnC low <= dist)

    firstPbUp   filteredPbUp   and not filteredPbUp[1]
    firstPbDown filteredPbDown and not filteredPbDown[1]

    // ATR for vertical spacing of signals
    atrVal ta.atr(14)
    upY   low 15 atrVal
    downY 
    high 10 atrVal

    // Plot BUY/SELL arrows as labels for vertical spacing
    //if trendUpbn
        //label.new(bar_index, upY, text="BUY", style=label.style_triangleup, color=dnCol, textcolor=color.white, size=size.small, yloc=yloc.price)

    //if trendDownbn
        //label.new(bar_index, downY, text="SELL", style=label.style_triangledown, color=upCol, textcolor=color.white, size=size.small, yloc=yloc.price)

    // Pullback dots
    //plotshape(firstPbUp,   style=shape.circle, location=location.belowbar, color=color.new(dnCol,0), size=size.small)
    //plotshape(firstPbDown, style=shape.circle, location=location.abovebar, color=color.new(upCol,0), size=size.small)
    //////////////////////

    // --- User Inputs ---
    // NEW: Added the "20/20 Profile (Ultra-Safe)" option.
    profile input.string('20/20 Profile (Ultra-Safe)''Select Profile'options = ['20/20 Profile (Ultra-Safe)''16/16 Profile (Safe)''12/12 Profile (Balanced)''8/8 Profile (Aggressive)''Custom'], group 'Grid Calculation')

    // These inputs are now only used when "Custom" is selected.
    customRangePercent input.float(6.3title 'Custom Range as % of Price'group 'Grid Calculation')
    customGridCount input.int(12title 'Custom Grid Count'group 'Grid Calculation')

    // Style Inputs
    gridColor input.color(color.new(color.gray60), title 'Grid Line Color'group 'Line Style')
    gridWidth input.int(1title 'Grid Line Width'minval 1maxval 5group 'Line Style')
    gridStyleString input.string('Dotted'title 'Grid Line Style'options = ['Solid''Dashed''Dotted'], group 'Line Style')

    // --- Variable Declarations ---
    var array<linegridLines = array.new_line()
    var array<
    labelpriceLabels = array.new_label()
    var 
    float finalRangePercent 0.0
    var int finalGridCount 0

    // --- Logic to select parameters based on profile ---
    if profile == '20/20 Profile (Ultra-Safe)'
        
    finalRangePercent := 10.5
        finalGridCount 
    := 20
        finalGridCount
    else if profile == '16/16 Profile (Safe)'
        
    finalRangePercent := 8.4
        finalGridCount 
    := 16
        finalGridCount
    else if profile == '12/12 Profile (Balanced)'
        
    finalRangePercent := 6.3
        finalGridCount 
    := 12
        finalGridCount
    else if profile == '8/8 Profile (Aggressive)'
        
    finalRangePercent := 4.2
        finalGridCount 
    := 8
        finalGridCount
    else // Custom
        
    finalRangePercent := customRangePercent
        finalGridCount 
    := customGridCount
        finalGridCount

    // --- Helper Function ---
    getLineStyle(styleString) =>
        
    styleString == 'Solid' line.style_solid styleString == 'Dashed' line.style_dashed line.style_dotted

    // --- Drawing Logic ---
    if barstate.islast
        
    // Delete old lines and labels
        
    if array.size(gridLines) > 0
            
    for lineId in gridLines
                line
    .delete(lineId)
            array.
    clear(gridLines)
        if array.
    size(priceLabels) > 0
            
    for labelId in priceLabels
                label
    .delete(labelId)
            array.
    clear(priceLabels)

        
    // Main Calculation
        
    currentPrice close
        totalRange 
    currentPrice * (finalRangePercent 100)
        
    halfRange totalRange 2.0
        upperLimit 
    currentPrice halfRange
        lowerLimit 
    currentPrice halfRange
        selectedGridStyle 
    getLineStyle(gridStyleString)

        
    // Draw Lines & Labels
        
    array.push(gridLinesline.new(bar_index 99upperLimitbar_indexupperLimitxloc xloc.bar_indexextend extend.nonecolor color.new(color.green20), width 2))
        array.
    push(gridLinesline.new(bar_index 99lowerLimitbar_indexlowerLimitxloc xloc.bar_indexextend extend.nonecolor color.new(color.red20), width 2))
        if 
    finalGridCount 1
            stepSize 
    totalRange finalGridCount
            
    for 1 to finalGridCount 1 by 1
                gridLevel 
    lowerLimit stepSize
                
    array.push(gridLinesline.new(bar_index 99gridLevelbar_indexgridLevelxloc xloc.bar_indexextend extend.nonecolor gridColorwidth gridWidthstyle selectedGridStyle))
        array.
    push(priceLabelslabel.new(bar_indexupperLimittext str.tostring(upperLimitformat.mintick), xloc xloc.bar_indexcolor color.new(color.green70), textcolor color.whitestyle label.style_label_left))
        array.
    push(priceLabelslabel.new(bar_indexlowerLimittext str.tostring(lowerLimitformat.mintick), xloc xloc.bar_indexcolor color.new(color.red70), textcolor color.whitestyle label.style_label_left))
    ////////////////////son///////////// 
    16.07.2024 - 10.12.2024

  8. https://tr.tradingview.com/v/MbBYobih/ macd ve rsi kullanarak hesaplanmış... https://www.tradingview.com/x/K8gkA7Fb/

    https://tr.tradingview.com/v/UEPdjqLf/ mum tesbiti için.... https://www.tradingview.com/x/x3lXlfdD/
    eski köpekbalığı tekniği gibi..... blok olan mum kalıpları içinde... en tepe ve en diple...tek mum aralığı yakalamak gibi....

    şimdi yazan kişi kodda.... son 20 barı...saatlik tarıyor...yani en dip ve tepe işaretliyor.....

    bense...her zaman sadece son üç barı sürekli tarıyorum....

    https://www.tradingview.com/x/4pE8dpui/ bu kodun ayarı değişmemiş hali....

    https://www.tradingview.com/x/zVeRNR92/ bu kodun 15 dakkalık hali...kendi taramamla kıyaslamak için....

    https://www.tradingview.com/x/Zryh1JLF/ bu da...kodu 3 barla taratınca görünüm....

    kodu..kendimle kıyaslayınca...emeğe saygı gereği...nasıl kullanabilirim deseydim.....

    kendi kalıbıma... https://www.tradingview.com/x/ZQdMWVbK/ böyle uyguladığımda... 1dk grafikte kendi kalıbımla tarar...
    bu kodla 15 dk getirir.... destek direnç v.b kullanmaya çalışırdım....
    16.07.2024 - 10.12.2024

Sayfa 348/355 İlkİlk ... 248298338346347348349350 ... 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
  •