Sayfa 227/300 İlkİlk ... 127177217225226227228229237277 ... SonSon
Arama sonucu : 2398 madde; 1,809 - 1,816 arası.

Konu: Tradingview




  1. yedekleme...düzenlenecek...
    önceki parçalı çalışmalardan.....
    PHP Code:
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © YunusEmre32
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © fondDealer96636

    //@version=5

    indicator('*'overlay=truemax_bars_back=201)

    // input
    start 20
    lookback 
    input(1"Sensitivity"tooltip="Low (High Sensitivity), High (Low Sensitivity).\n\nAdjust according to timeframe and asset.")
    resp 1
    smoothing 
    input(3"Smoothing")
    source input(close"Source")


    // global
    var ix = -1
    var mal = array.new_int(0)


    // functions
    avg(sourcelen) =>
        
    sum 0.0
        
    for 0 to len-1
            sum 
    += source[i]
        
    sum/len

    bull 
    close open

    wick_touch
    (x) =>
        
    bull ? ((close <= and <= high) or (low <= and <= open)) : ((open <= and <= high) or (low <= and <= close))

    body_touch(x) =>
        
    bull ? (open and close) : (close and open)

    touches(t) =>
        
    touches 0
        
    for 0 to lookback-1
            touches 
    += t[i] ? 0
        touches


    // local
    ix := ix+1
    prev_mal 
    ix >= ? array.get(malix-1) : start

    cma 
    avg(sourceprev_mal)
    cma_p1 avg(sourceprev_mal+1)
    cma_m1 avg(sourceprev_mal-1)

    touches(wick_touch(cma))
    d_p1 touches(wick_touch(cma_p1))
    d_m1 touches(wick_touch(cma_m1))

    d_b touches(body_touch(cma))
    d_p1_b touches(body_touch(cma_p1))
    d_m1_b touches(body_touch(cma_m1))

    any_body_touch d_b or d_p1_b or d_m1_b 0
    no_wick_touch 
    <= and d_p1 <= and d_m1 <= 0
    wick_maximized 
    >= d_p1 and >= d_m1 prev_mal : (d_p1 >= and d_p1 >= d_m1 prev_mal+resp : (d_m1 >= and d_m1 >= d_p1 prev_mal-resp na))

    uptrend cma cma[1]
    downtrend cma cma[1]
    against_trend = (uptrend and close cma) or (downtrend and close cma)

    new_mal no_wick_touch or against_trend prev_mal-resp : (any_body_touch prev_mal+resp wick_maximized)
    next_mal na(new_mal) ? prev_mal new_mal

    array.push(malnext_mal : (next_mal 200 200 next_mal))


    // graph
    scma ta.ema(cmasmoothing)
    plot(scma"Automatic MA"style=plot.style_linecolor=#ffeb3b00)
    ////////////////////////////////////////
    start213 input(0.1)
    increment213 input(0.1)
    maximum213 input(1"Max Value")
    out213 ta.sar(start213increment213maximum213)
    plot(out213"Döngü"style=plot.style_linecolor=#ffeb3b00)
    ////////////////////////////////////////////////////////////////////


    //@version=5

    start22 input.float(title='Start'defval=0.05step=0.1)
    increment input.float(title='Increment'defval=0.075step=0.1)
    maximum input.float(title='Max Value'defval=0.35step=0.1)
    putlabel input(title='Put Labels'defval=true)
    colup input.color(title='Colors'defval=color.rgb(0230119100), inline='col')
    coldn input.color(title=''defval=color.rgb(2558282100), inline='col')

    int trend 0
    float sar 
    0.0
    float ep 
    0.0
    float af 
    0.0

    trend 
    := nz(trend[1])
    ep := nz(ep[1])
    af := nz(af[1])
    sar := sar[1]

    if 
    trend == and not na(high[1])
        
    trend := high >= high[1] or low >= low[1] ? : -1
        sar 
    := trend low[1] : high[1]
        
    ep := trend high[1] : low[1]
        
    af := start22
        af
    else
        
    nextsar sar
        
    if trend 0
            
    if high[1] > ep
                ep 
    := high[1]
                
    af := math.min(maximumaf increment)
                
    af

            nextsar 
    := sar af * (ep sar)
            
    nextsar := math.min(math.min(low[1], low[2]), nextsar)

            
    //Reversal
            
    if nextsar low
                trend 
    := -1
                nextsar 
    := ep
                ep 
    := low
                af 
    := start22
                af
        
    else
            if 
    low[1] < ep
                ep 
    := low[1]
                
    af := math.min(maximumaf increment)
                
    af

            nextsar 
    := sar af * (ep sar)
            
    nextsar := math.max(math.max(high[1], high[2]), nextsar)

            
    //Reversal
            
    if nextsar high
                trend 
    := 1
                nextsar 
    := ep
                ep 
    := high
                af 
    := start22
                af
        sar 
    := nextsar
        sar

    plot
    (sartitle='@@'color=trend colup coldnlinewidth=1style=plot.style_line)

    alertcondition(ta.change(trend) > 0title='PSAR Trend UP'message='PSAR Trend UP')
    alertcondition(ta.change(trend) < 0title='PSAR Trend DOWN'message='PSAR Trend DOWN')

    if 
    ta.change(trend) > and putlabel
        label
    .new(bar_indexsartext=str.tostring(math.round_to_mintick(sar)), color=colupstyle=label.style_label_upsize=size.huge)
    if 
    ta.change(trend) < and putlabel
        label
    .new(bar_indexsartext=str.tostring(math.round_to_mintick(sar)), color=coldnstyle=label.style_label_downsize=size.huge)

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © starbolt
    //@version=5

    len44 input.int(10'Length'step=1minval=1)
    displace input.int(0'Displace'step=1minval=0)
    ma_type input.string('HMA''MA Type'options=['SMA',  'HMA'])

    //Hilo Activator
    float hilo na
    hi 
    ta.sma(highlen44)
    lo ta.sma(lowlen44)


    // Hull Moving Average (HMA)
    if ma_type == 'HMA'
        
    hi := ta.wma(ta.wma(highlen44 2) - ta.wma(highlen44), math.round(math.sqrt(len44)))
        
    lo := ta.wma(ta.wma(lowlen44 2) - ta.wma(lowlen44), math.round(math.sqrt(len44)))

    hilo := close hi[displace] ? close lo[displace] ? -hilo[1]
    ghla hilo == -hi[displace] : lo[displace]
    color44 hilo == -color.red color.green

    //Alerts
    buyCondition hilo == and hilo[1] == -1
    sellCondition 
    hilo == -and hilo[1] == 1

    if buyCondition
        alert
    ('Long'alert.freq_once_per_bar)

    if 
    sellCondition
        alert
    ('Short'alert.freq_once_per_bar)

    //Plots 
    plot(ghlacolor=color44style=plot.style_crosslinewidth 3)  

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

    //@version=5
    import jdehorty/KernelFunctions/as kernel

    DFT
    (xyNx_dir) =>
        
    float _arg 0.0
        float _cos 
    0.0
        float _sin 
    0.0
        float xArr_i 
    0.0
        float yArr_i 
    0.0
        xArr 
    = array.new_float(array.size(x))
        
    yArr = array.new_float(array.size(y))

        for 
    0 to Nx 1 by 1
            xArr_i 
    := 0.0
            yArr_i 
    := 0.0
            kx 
    float(i) / float(Nx)
            
    _arg := -_dir math.pi kx
            
    for 0 to Nx 1 by 1
                _cos 
    := math.cos(_arg)
                
    _sin := math.sin(_arg)
                
    xArr_i += array.get(xk) * _cos - array.get(yk) * _sin
                yArr_i 
    += array.get(xk) * _sin + array.get(yk) * _cos
                yArr_i
            
    array.set(xArrixArr_i)
            array.
    set(yArriyArr_i)

        if 
    _dir == 1
            
    for 0 to Nx 1 by 1
                
    array.set(xi, array.get(xArri) / float(Nx))
                array.
    set(yi, array.get(yArri) / float(Nx))
        else
            for 
    0 to Nx 1 by 1
                
    array.set(xi, array.get(xArri))
                array.
    set(yi, array.get(yArri))

    //======================================================================================================================
    //                                                  INPUTS
    //======================================================================================================================

    input.int(5,"Fourier Period")
    xval input.source(close,"Fourier X Series",tooltip "i.e. the source of the discrete Fourier"+
     
    " transform (with the Y Series being the bars through time.)")
    highlighting input.bool(true,"Highlighting")
    smoothing66 input.int(10,"Kernel Smoothing")


    //======================================================================================================================
    //                                                  CALCULATIONS
    //======================================================================================================================

    // Fourier transform
    = array.new_float(N0.0)
    = array.new_float(N0.0)
    for 
    0 to N 1
        
    array.set(xixval[i])
        array.
    set(yi0.0)

    DFT(xyN1)

    mag = array.new_float(N0.0)
    for 
    0 to N 1
        mag_i 
    math.sqrt(math.pow(array.get(xi), 2) + math.pow(array.get(yi), 2))
        array.
    set(magimag_i)

    dft = array.get(mag,0)
    dfts kernel.rationalQuadratic(dft,25,1,smoothing66)

    //======================================================================================================================
    //                                                  DISPLAY
    //======================================================================================================================

    plot(dfts"Stop"color=color.rgb(0187212100) )

    ///////////////////////////////
    //@version=5
    start21 input(0.1)
    increment21 input(0.001)
    maximum21 input(1"Max Value")
    out21 ta.sar(start21increment21maximum21)
    //plot(out21, "Döngü", style=plot.style_line, color=#f0ce0e)
    plot(out21color=color.aqualinewidth=3title="1",style=plot.style_cross)
    //////////////////////////////////////////////////////////////////////////////////////
    //@version=5

    BackStep input.int(27,"Analysis Period")
    lowerValue input.float(0.382,"Lower Fibonacci Level",options=[0.2360.3820.500.6180.786])
    upperValue input.float(0.618,"Upper Fibonacci Level",options=[0.2360.3820.500.6180.786])
    showFill input.bool(true,"Show Filling")
    changeCandle input.bool(true,"Change Candle Color")
    atr77 ta.atr(200)
    max ta.highest(close,BackStep)
    min ta.lowest(close,BackStep)


    lowerFib min + (max-min)*lowerValue
    upperFib 
    min + (max-min)*upperValue
    ma 
    ta.wma(close,6)

    float closeVal ma
    float openVal 
    ma
    color clrToUse 
    closeVal>upperFib and openVal>upperFib?color.green:closeVal<lowerFib and openVal<lowerFib?color.red:color.yellow

    LowerFibLine 
    plot(lowerFib,title="0.382",color=color.rgb(18975255100))
    UpperFibLine plot(upperFib,title="0.618",color=color.rgb(18975255100))

    float LowerRetracement = (max-min)*0.318
    float UpperRetracement 
    = (max-min)*0.618
    ///////////////////////////////////////////////////////////////////////////////////////
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © peacefulLizard50262

    //@version=5

    // Custom cosh function
    cosh(float x) =>
        (
    math.exp(x) + math.exp(-x)) / 2

    // Custom acosh function
    acosh(float x) =>
        
    na math.log(math.sqrt(1))

    // Custom sinh function
    sinh(float x) =>
        (
    math.exp(x) - math.exp(-x)) / 2

    // Custom asinh function
    asinh(float x) =>
        
    math.log(math.sqrt(1))

    // Custom inverse tangent function
    atan(float x) =>
        
    math.pi math.atan(x)

    // Chebyshev Type I Moving Average
    chebyshevI(float srcfloat lenfloat ripple) =>
        
    0.
        b 
    0.
        g 
    0.
        chebyshev 
    0.
        
        a 
    := cosh(len acosh(/ (ripple)))
        
    := sinh(len asinh(ripple))
        
    := (b) / (b)
        
    chebyshev := (g) * src nz(chebyshev[1])
        
    chebyshev

    // Chebyshev Type II Moving Average
    chebyshevII(float srcfloat lenfloat ripple) =>
        
    0.
        b 
    0.
        g 
    0.
        chebyshev 
    0.
        
        a 
    := cosh(len acosh(ripple))
        
    := sinh(len asinh(ripple))
        
    := (b) / (b)
        
    chebyshev := (g) * src nz(chebyshev[1], src)
        
    chebyshev

    chebyshev
    (float srcfloat lengthfloat ripplebool style) =>
        
    style ?
         
    chebyshevI(srclengthripple) :
         
    chebyshevII(srclengthripple)

    source44 input.source(hl2"Source")
    up_color input.color(color.new(color.green20), "Up Color")
    down_color input.color(color.new(color.red20), "Down Color")
    text_color input.color(color.black"Text Color")
    mean_length input.float(24"Mean Length"510000.5)
    mean_ripple input.float(0.5"Mean Ripple"0.010.990.01)
    style44 input.bool(false"True Chebyshev I | False : Chebyshev II")
    atr_style input.bool(true"True: |Open-Close|  False: High-Low")
    atr_length input.float(64"ATR Length"610000.5)
    atr_ripple input.float(0.05"Mean Ripple"0.010.990.01)
    multiplier input.float(1.5"Multiplier"0.125100.125)
    alerts input.bool(false"Alerts")
    labels input.bool(false"Labels")

    atr chebyshev(atr_style high low math.abs(open close), atr_lengthatr_ripplestyle44)
    mean chebyshevI(source44mean_lengthmean_ripple)

    var 
    float offset 0.0
    var bool state na
    var float newOffset 0.0

    crossover 
    ta.crossover(source44offset)
    position source44 offset
    crossunder 
    ta.crossunder(source44offset)

    prevOffset nz(offset[1])

    if 
    crossover[2] and position[1] and position or (position and position[1] and position[2]) 
        
    newOffset := mean atr multiplier
        offset 
    := newOffset nz(prevOffset) or close[1] > nz(prevOffset) ? newOffset nz(prevOffset)
        
    state := true

    if crossunder[2] and not position[1] and not position or (not position and not position[1] and not position[2]) 
        
    newOffset := mean atr multiplier
        offset 
    := newOffset nz(prevOffset) or close[1] < nz(prevOffset) ? newOffset nz(prevOffset)
        
    state := false

    cross 
    ta.cross(closeoffset)

    down_trend not state and not state[1]
    up_trend state and state[1]

    colour up_trend up_color down_trend down_color color.new(color.white100

    if 
    up_trend and not up_trend[1] and labels
        label
    .new(bar_indexoffset"Up Trend \n" str.tostring(close), color up_colorstyle label.style_label_uptextcolor text_color)
        
    alert("Up Trend at " str.tostring(close))
    else
        
    alert("Up Trend at " str.tostring(close))

    if 
    down_trend and not down_trend[1] and labels
        label
    .new(bar_indexoffset"Down Trend \n" str.tostring(close), color down_colorstyle label.style_label_downtextcolor text_color)
        
    alert("Down Trend at " str.tostring(close))
    else
        
    alert("Down Trend at " str.tostring(close))
        

    plot(offset"Trend"colourlinewidth=3style plot.style_cross)

    plotshape(cross"Trend Is Getting Ready To Change"shape.xcrosslocation.belowbarcolor close offset up_color down_color)
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 

  2. swing trade için....
    otomatik ma...stop çizgisi yukarı keserse al.....tersi sat.....
    trend takibi ile

    üsteki kodun sadeleşmiş hali.....
    PHP Code:
    //@version=5
    indicator('*'overlay=truemax_bars_back=201)

    // input
    start 20
    lookback 
    input(1"Sensitivity"tooltip="Low (High Sensitivity), High (Low Sensitivity).\n\nAdjust according to timeframe and asset.")
    resp 1
    smoothing 
    input(3"Smoothing")
    source input(close"Source")


    // global
    var ix = -1
    var mal = array.new_int(0)


    // functions
    avg(sourcelen) =>
        
    sum 0.0
        
    for 0 to len-1
            sum 
    += source[i]
        
    sum/len

    bull 
    close open

    wick_touch
    (x) =>
        
    bull ? ((close <= and <= high) or (low <= and <= open)) : ((open <= and <= high) or (low <= and <= close))

    body_touch(x) =>
        
    bull ? (open and close) : (close and open)

    touches(t) =>
        
    touches 0
        
    for 0 to lookback-1
            touches 
    += t[i] ? 0
        touches


    // local
    ix := ix+1
    prev_mal 
    ix >= ? array.get(malix-1) : start

    cma 
    avg(sourceprev_mal)
    cma_p1 avg(sourceprev_mal+1)
    cma_m1 avg(sourceprev_mal-1)

    touches(wick_touch(cma))
    d_p1 touches(wick_touch(cma_p1))
    d_m1 touches(wick_touch(cma_m1))

    d_b touches(body_touch(cma))
    d_p1_b touches(body_touch(cma_p1))
    d_m1_b touches(body_touch(cma_m1))

    any_body_touch d_b or d_p1_b or d_m1_b 0
    no_wick_touch 
    <= and d_p1 <= and d_m1 <= 0
    wick_maximized 
    >= d_p1 and >= d_m1 prev_mal : (d_p1 >= and d_p1 >= d_m1 prev_mal+resp : (d_m1 >= and d_m1 >= d_p1 prev_mal-resp na))

    uptrend cma cma[1]
    downtrend cma cma[1]
    against_trend = (uptrend and close cma) or (downtrend and close cma)

    new_mal no_wick_touch or against_trend prev_mal-resp : (any_body_touch prev_mal+resp wick_maximized)
    next_mal na(new_mal) ? prev_mal new_mal

    array.push(malnext_mal : (next_mal 200 200 next_mal))


    // graph
    scma ta.ema(cmasmoothing)
    plot(scma"Otomatik MA"style=plot.style_linecolor=#fce305)
    ////////////////////////////////////////

    //@version=5
    import jdehorty/KernelFunctions/as kernel

    DFT
    (xyNx_dir) =>
        
    float _arg 0.0
        float _cos 
    0.0
        float _sin 
    0.0
        float xArr_i 
    0.0
        float yArr_i 
    0.0
        xArr 
    = array.new_float(array.size(x))
        
    yArr = array.new_float(array.size(y))

        for 
    0 to Nx 1 by 1
            xArr_i 
    := 0.0
            yArr_i 
    := 0.0
            kx 
    float(i) / float(Nx)
            
    _arg := -_dir math.pi kx
            
    for 0 to Nx 1 by 1
                _cos 
    := math.cos(_arg)
                
    _sin := math.sin(_arg)
                
    xArr_i += array.get(xk) * _cos - array.get(yk) * _sin
                yArr_i 
    += array.get(xk) * _sin + array.get(yk) * _cos
                yArr_i
            
    array.set(xArrixArr_i)
            array.
    set(yArriyArr_i)

        if 
    _dir == 1
            
    for 0 to Nx 1 by 1
                
    array.set(xi, array.get(xArri) / float(Nx))
                array.
    set(yi, array.get(yArri) / float(Nx))
        else
            for 
    0 to Nx 1 by 1
                
    array.set(xi, array.get(xArri))
                array.
    set(yi, array.get(yArri))

    //======================================================================================================================
    //                                                  INPUTS
    //======================================================================================================================

    input.int(1,"Fourier Period")
    xval input.source(close,"Fourier X Series",tooltip "i.e. the source of the discrete Fourier"+
     
    " transform (with the Y Series being the bars through time.)")
    highlighting input.bool(true,"Highlighting")
    smoothing66 input.int(10,"Kernel Smoothing")


    //======================================================================================================================
    //                                                  CALCULATIONS
    //======================================================================================================================

    // Fourier transform
    = array.new_float(N0.0)
    = array.new_float(N0.0)
    for 
    0 to N 1
        
    array.set(xixval[i])
        array.
    set(yi0.0)

    DFT(xyN1)

    mag = array.new_float(N0.0)
    for 
    0 to N 1
        mag_i 
    math.sqrt(math.pow(array.get(xi), 2) + math.pow(array.get(yi), 2))
        array.
    set(magimag_i)

    dft = array.get(mag,0)
    dfts kernel.rationalQuadratic(dft,25,1,smoothing66)

    //======================================================================================================================
    //                                                  DISPLAY
    //======================================================================================================================

    plot(dfts"Stop"color=color.aquastyle=plot.style_line )

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

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

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

    //@version=5

    // Custom cosh function
    cosh(float x) =>
        (
    math.exp(x) + math.exp(-x)) / 2

    // Custom acosh function
    acosh(float x) =>
        
    na math.log(math.sqrt(1))

    // Custom sinh function
    sinh(float x) =>
        (
    math.exp(x) - math.exp(-x)) / 2

    // Custom asinh function
    asinh(float x) =>
        
    math.log(math.sqrt(1))

    // Custom inverse tangent function
    atan(float x) =>
        
    math.pi math.atan(x)

    // Chebyshev Type I Moving Average
    chebyshevI(float srcfloat lenfloat ripple) =>
        
    0.
        b 
    0.
        g 
    0.
        chebyshev 
    0.
        
        a 
    := cosh(len acosh(/ (ripple)))
        
    := sinh(len asinh(ripple))
        
    := (b) / (b)
        
    chebyshev := (g) * src nz(chebyshev[1])
        
    chebyshev

    // Chebyshev Type II Moving Average
    chebyshevII(float srcfloat lenfloat ripple) =>
        
    0.
        b 
    0.
        g 
    0.
        chebyshev 
    0.
        
        a 
    := cosh(len acosh(ripple))
        
    := sinh(len asinh(ripple))
        
    := (b) / (b)
        
    chebyshev := (g) * src nz(chebyshev[1], src)
        
    chebyshev

    chebyshev
    (float srcfloat lengthfloat ripplebool style) =>
        
    style ?
         
    chebyshevI(srclengthripple) :
         
    chebyshevII(srclengthripple)

    source44 input.source(close"Source")
    up_color input.color(color.new(color.green20), "Up Color")
    down_color input.color(color.new(color.red20), "Down Color")
    text_color input.color(color.black"Text Color")
    mean_length input.float(24"Mean Length"510000.5)
    mean_ripple input.float(0.5"Mean Ripple"0.010.990.01)
    style44 input.bool(false"True Chebyshev I | False : Chebyshev II")
    atr_style input.bool(true"True: |Open-Close|  False: High-Low")
    atr_length input.float(64"ATR Length"610000.5)
    atr_ripple input.float(0.05"Mean Ripple"0.010.990.01)
    multiplier input.float(1.5"Multiplier"0.125100.125)
    alerts input.bool(true"Alerts")
    labels input.bool(true"Labels")

    atr chebyshev(atr_style high low math.abs(open close), atr_lengthatr_ripplestyle44)
    mean chebyshevI(source44mean_lengthmean_ripple)

    var 
    float offset 0.0
    var bool state na
    var float newOffset 0.0

    crossover 
    ta.crossover(source44offset)
    position source44 offset
    crossunder 
    ta.crossunder(source44offset)

    prevOffset nz(offset[1])

    if 
    crossover[2] and position[1] and position or (position and position[1] and position[2]) 
        
    newOffset := mean atr multiplier
        offset 
    := newOffset nz(prevOffset) or close[1] > nz(prevOffset) ? newOffset nz(prevOffset)
        
    state := true

    if crossunder[2] and not position[1] and not position or (not position and not position[1] and not position[2]) 
        
    newOffset := mean atr multiplier
        offset 
    := newOffset nz(prevOffset) or close[1] < nz(prevOffset) ? newOffset nz(prevOffset)
        
    state := false

    cross 
    ta.cross(closeoffset)

    down_trend not state and not state[1]
    up_trend state and state[1]

    colour up_trend up_color down_trend down_color color.new(color.white100

    if 
    up_trend and not up_trend[1] and labels
        label
    .new(bar_indexoffset"AL \n" str.tostring(close), color up_colorstyle label.style_label_uptextcolor text_color)
        
    alert("AL " str.tostring(close))
    else
        
    alert("Al " str.tostring(close))

    if 
    down_trend and not down_trend[1] and labels
        label
    .new(bar_indexoffset"SAT \n" str.tostring(close), color down_colorstyle label.style_label_downtextcolor text_color)
        
    alert("SAT " str.tostring(close))
    else
        
    alert("SAT " str.tostring(close))
        

    plot(offset"Trend"colourlinewidth=2style plot.style_stepline)

    plotshape(cross"Trend Değişimi"shape.xcrosslocation.belowbarcolor close offset up_color down_color)
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 

  3. PHP Code:
    //@version=5
    indicator(".",overlay=truemax_labels_count 100)
    a=input(20,"Alpha")
    b=input(true,"Maybe Dump Maybe Pump")
    a1=2*ta.ema(high,a/10)-ta.sma(low,a/2)
    a2=math.sqrt(ta.lowest(ta.highest(close,a),a/4)*a1)
    b1=2*ta.ema(low,a/10)-ta.sma(high,a/2)
    b2=math.sqrt(ta.highest(ta.lowest(close,a),a/4)*b1)
    c1=ta.ema(math.sqrt(a2*b2),a/20)
    plot(c1,color=#cd06e7,linewidth=1,transp=00)
    barcolor(color=close>c1+ta.atr(20)*0.7?#2eec08:(close<c1-ta.atr(20)*0.7?#f00c0c:#eef109))

    d1 ta.sma(close20) + ta.stdev(close20)
    d2 ta.sma(close20) - ta.stdev(close20)
    buy1 ta.crossover(closed2)
    sell1 ta.crossunder(closed1)

    buyrsi=ta.crossover(ta.rsi(close,7),30)
    sellrsi=ta.crossunder(ta.rsi(close,7),70)

    plotshape(and  buy1 and buyrsi title "Pump",  text 'X',  style shape.labelup,   location location.belowbarcolorcolor.greentextcolor color.white,  size size.tiny)
    plotshape(and sell1 and sellrsititle "Dump"text 'Y'style shape.labeldownlocation location.abovebarcolorcolor.red,   textcolor color.whitesize size.tiny)
    /////////////////////////////
    ///////////////////////////////////
    // User inputs
    prd input.int(defval=10title=' Period for Pivot Points'minval=1maxval=50)
    max_num_of_pivots input.int(defval=5title=' Maximum Number of Pivots'minval=5maxval=10)
    max_lines input.int(defval=1title=' Maximum number of trend lines'minval=1maxval=10)
    show_lines input.bool(defval=truetitle=' Show trend lines')
    show_pivots input.bool(defval=truetitle=' Show Pivot Points')

    float ph ta.pivothigh(highprdprd)
    float pl ta.pivotlow(lowprdprd)

    plotshape(ph and show_pivotsstyle=shape.triangledownlocation=location.abovebaroffset=-prdsize=size.tiny)
    plotshape(pl and show_pivotsstyle=shape.triangleuplocation=location.belowbaroffset=-prdsize=size.tiny)

    // Creating array of pivots
    var pivots_high = array.new_float(0)
    var 
    pivots_low = array.new_float(0)

    var 
    high_ind = array.new_int(0)
    var 
    low_ind = array.new_int(0)

    if 
    ph 
        
    array.push(pivots_highph)
        array.
    push(high_indbar_index prd)
        if array.
    size(pivots_high) > max_num_of_pivots  // limit the array size
            
    array.shift(pivots_high)
            array.
    shift(high_ind)

    if 
    pl
        
    array.push(pivots_lowpl)
        array.
    push(low_indbar_index prd)
        if array.
    size(pivots_low) > max_num_of_pivots  // limit the array size
            
    array.shift(pivots_low)
            array.
    shift(low_ind)

    // Create arrays to store slopes and lines
    var res_lines = array.new_line()
    var 
    res_slopes = array.new_float()

    len_lines = array.size(res_lines)

    if (
    len_lines >= 1)
        for 
    ind 0 to len_lines 
            to_delete 
    = array.pop(res_lines)
            array.
    pop(res_slopes)
            
    line.delete(to_delete)
            
    // line.set_extend(to_delete, extend=extend.none)



    count_slope(ph1ph2pos1pos2) => (ph2 ph1) / (pos2 pos1)


    if array.
    size(pivots_high) == max_num_of_pivots
        index_of_biggest_slope 
    0
        
    for ind1 0 to max_num_of_pivots 2
            
    for ind2 ind1 1 to max_num_of_pivots 1
                p1 
    = array.get(pivots_highind1)
                
    p2 = array.get(pivots_highind2)
                
    pos1 = array.get(high_indind1)
                
    pos2 = array.get(high_indind2)
                
    count_slope(p1p2pos1pos2)
                
    p1 pos1

                
    // ok = k * bar_index + b > high
                
    ok true
                
    // label.new(pos1, p1, str.tostring(ok))
                
    for ind3 ind2 to max_num_of_pivots 1
                    p3 
    = array.get(pivots_highind3)
                    
    pos3 = array.get(high_indind3)
                    if 
    p3 pos3 
                        ok 
    := false
                        
    // label.new(pos3, p3, 'cross')
                        
    break

                if 
    ind2 ind1 >= 1
                    
    for ind3 ind1 1 to ind2 1
                        p3 
    = array.get(pivots_highind3)
                        
    pos3 = array.get(high_indind3)
                        if 
    p3 pos3 
                            ok 
    := false
                            
    // label.new(pos3, p3, 'cross')
                            
    break

                for 
    ind 0 to prd 1
                    
    if high[ind] * 0.996 bar_index[ind] + b
                        ok 
    := false
                        
    break
                
                
                if 
    ok //and not (high > k * bar_index + b) // 'and not' for the last line to check if the crosses the price action
                    
    if array.size(res_slopes) < max_lines // max_lines // for now only 1 lines is to be shown
                        
    line line.new(pos1p1pos2p2extend=extend.right)
                        array.
    push(res_linesline)
                        array.
    push(res_slopesk)  
                    else
                        
    max_slope = array.max(res_slopes)
                        
    max_slope_ind = array.indexof(res_slopesmax_slope)
                        if 
    max_lines == 1
                            max_slope_ind 
    := 0
                        
    if max_slope
                            line_to_delete 
    = array.get(res_linesmax_slope_ind)
                            
    line.delete(line_to_delete
                            
    new_line line.new(pos1p1pos2p2extend=extend.right)
                            array.
    insert(res_linesmax_slope_indnew_line)
                            array.
    insert(res_slopesmax_slope_indk)
                            array.
    remove(res_linesmax_slope_ind 1)
                            array.
    remove(res_slopesmax_slope_ind 1)
                            
    // label.new(pos1, p1, str.tostring(res_slopes))

    // if barstate.islast
    //     label.new(bar_index, high, str.tostring(array.size(res_lines)))

    if array.size(res_lines) >= and barstate.islast
        
    for ind=0 to array.size(res_lines) - 
            l 
    = array.get(res_linesind)
            
    = array.get(res_slopesind)
            
    x1 line.get_x1(l)
            
    x2 line.get_x2(l
            
    prev_lable_ind 0//x2 + prd - 5
            
    for ind1=x2 to bar_index
                p 
    line.get_price(lind1
                if (
    math.abs(high[bar_index ind1]) < 0.005
                    if 
    ind1 prev_lable_ind 10 and ind1 x2 >= prd
                        label
    .new(ind1high[bar_index ind1], text='S'style=label.style_label_downcolor=color.red)
                        
    prev_lable_ind := ind1

    if not show_lines
        len_l 
    = array.size(res_lines)
        if (
    len_l >= 1)
            for 
    ind 0 to len_l 
                to_delete 
    = array.pop(res_lines)
                array.
    pop(res_slopes)
                
    line.delete(to_delete)

    var 
    sup_lines = array.new_line()
    var 
    sup_slopes = array.new_float()

    len_lines1 = array.size(sup_lines)

    if (
    len_lines1 >= 1)
        for 
    ind 0 to len_lines1 
            to_delete 
    = array.pop(sup_lines)
            array.
    pop(sup_slopes)
            
    line.delete(to_delete)

    if array.
    size(pivots_low) == max_num_of_pivots
        
    for ind1 0 to max_num_of_pivots 2
            
    for ind2 ind1 1 to max_num_of_pivots 1
                p1 
    = array.get(pivots_lowind1)
                
    p2 = array.get(pivots_lowind2)
                
    pos1 = array.get(low_indind1)
                
    pos2 = array.get(low_indind2)
                
    count_slope(p1p2pos1pos2)
                
    p1 pos1

                
    // check if pivot points in the future are lower than the line between two points 
                
    ok true
                
    for ind3 ind2 to max_num_of_pivots 1
                    p3 
    = array.get(pivots_lowind3)
                    
    pos3 = array.get(low_indind3)
                    if 
    p3 pos3 b
                        ok 
    := false
                        
    // label.new(pos3, p3, 'cross')
                        
    break

                
    // check if pivot points in the middle of two points is lower
                
    if ind2 ind1 >= 1
                    
    for ind3 ind1 1 to ind2 1
                        p3 
    = array.get(pivots_lowind3)
                        
    pos3 = array.get(low_indind3)
                        if 
    p3 pos3 b
                            ok 
    := false
                            
    // label.new(pos3, p3, 'cross')
                            
    break
                
                for 
    ind 0 to prd 2
                    
    if low[ind] * 1.008 bar_index[ind] + b
                        ok 
    := false
                        
    break
                
                if 
    ok //and not (low < k * bar_index + b) // 'and not' for the last line to check if the it crosses the price action
                    
    if array.size(sup_slopes) < max_lines // max_lines // for now only 1 lines is to be shown
                        
    line line.new(pos1p1pos2p2extend=extend.right)
                        
    // label.new(pos1, p1, 'ok to print')
                        
    array.push(sup_linesline)
                        array.
    push(sup_slopesk)  
                    else
                        
    max_slope = array.min(sup_slopes)
                        
    max_slope_ind = array.indexof(sup_slopesmax_slope)
                        if 
    max_lines == 1
                            max_slope_ind 
    := 0
                        
    if max_slope
                            line_to_delete 
    = array.get(sup_linesmax_slope_ind)
                            
    line.delete(line_to_delete
                            
    new_line line.new(pos1p1pos2p2extend=extend.right)
                            array.
    insert(sup_linesmax_slope_indnew_line)
                            array.
    insert(sup_slopesmax_slope_indk)
                            array.
    remove(sup_linesmax_slope_ind 1)
                            array.
    remove(sup_slopesmax_slope_ind 1)
                            
    // label.new(pos1, p1, str.tostring(sup_slopes))


    if array.size(sup_lines) >= and barstate.islast
        
    for ind=0 to array.size(sup_lines) - 
            l 
    = array.get(sup_linesind)
            
    = array.get(sup_slopesind)
            
    x1 line.get_x1(l)
            
    x2 line.get_x2(l
            
    prev_lable_ind 0//x2 + prd - 5
            
    for ind1=x2 to bar_index
                p 
    line.get_price(lind1
                if (
    math.abs(low[bar_index ind1]) < 0.005
                    if 
    ind1 prev_lable_ind 10 and ind1 x2 >= prd
                        label
    .new(ind1low[bar_index ind1], text='A'style=label.style_label_upcolor=color.green)
                        
    prev_lable_ind := ind1

    if not show_lines
        len_l 
    = array.size(sup_lines)
        if (
    len_l >= 1)
            for 
    ind 0 to len_l 
                to_delete 
    = array.pop(sup_lines)
                array.
    pop(sup_slopes)
                
    line.delete(to_delete)
    //////////////////////////////////////////////////// 
    düzenlemesi yapılacak örnek çalışma.....

  4. PHP Code:
     //@version=5
    indicator('*'overlay=truemax_bars_back=201)

    // input
    start 20
    lookback 
    input(1"Sensitivity"tooltip="Low (High Sensitivity), High (Low Sensitivity).\n\nAdjust according to timeframe and asset.")
    resp 1
    smoothing 
    input(3"Smoothing")
    source input(close"Source")


    // global
    var ix = -1
    var mal = array.new_int(0)


    // functions
    avg(sourcelen) =>
        
    sum 0.0
        
    for 0 to len-1
            sum 
    += source[i]
        
    sum/len

    bull 
    close open

    wick_touch
    (x) =>
        
    bull ? ((close <= and <= high) or (low <= and <= open)) : ((open <= and <= high) or (low <= and <= close))

    body_touch(x) =>
        
    bull ? (open and close) : (close and open)

    touches(t) =>
        
    touches 0
        
    for 0 to lookback-1
            touches 
    += t[i] ? 0
        touches


    // local
    ix := ix+1
    prev_mal 
    ix >= ? array.get(malix-1) : start

    cma 
    avg(sourceprev_mal)
    cma_p1 avg(sourceprev_mal+1)
    cma_m1 avg(sourceprev_mal-1)

    touches(wick_touch(cma))
    d_p1 touches(wick_touch(cma_p1))
    d_m1 touches(wick_touch(cma_m1))

    d_b touches(body_touch(cma))
    d_p1_b touches(body_touch(cma_p1))
    d_m1_b touches(body_touch(cma_m1))

    any_body_touch d_b or d_p1_b or d_m1_b 0
    no_wick_touch 
    <= and d_p1 <= and d_m1 <= 0
    wick_maximized 
    >= d_p1 and >= d_m1 prev_mal : (d_p1 >= and d_p1 >= d_m1 prev_mal+resp : (d_m1 >= and d_m1 >= d_p1 prev_mal-resp na))

    uptrend cma cma[1]
    downtrend cma cma[1]
    against_trend = (uptrend and close cma) or (downtrend and close cma)

    new_mal no_wick_touch or against_trend prev_mal-resp : (any_body_touch prev_mal+resp wick_maximized)
    next_mal na(new_mal) ? prev_mal new_mal

    array.push(malnext_mal : (next_mal 200 200 next_mal))


    // graph
    scma ta.ema(cmasmoothing)
    plot(scma"Otomatik MA"style=plot.style_linecolor=#fce305)
    ////////////////////////////////////////

    //@version=5
    import jdehorty/KernelFunctions/as kernel

    DFT
    (xyNx_dir) =>
        
    float _arg 0.0
        float _cos 
    0.0
        float _sin 
    0.0
        float xArr_i 
    0.0
        float yArr_i 
    0.0
        xArr 
    = array.new_float(array.size(x))
        
    yArr = array.new_float(array.size(y))

        for 
    0 to Nx 1 by 1
            xArr_i 
    := 0.0
            yArr_i 
    := 0.0
            kx 
    float(i) / float(Nx)
            
    _arg := -_dir math.pi kx
            
    for 0 to Nx 1 by 1
                _cos 
    := math.cos(_arg)
                
    _sin := math.sin(_arg)
                
    xArr_i += array.get(xk) * _cos - array.get(yk) * _sin
                yArr_i 
    += array.get(xk) * _sin + array.get(yk) * _cos
                yArr_i
            
    array.set(xArrixArr_i)
            array.
    set(yArriyArr_i)

        if 
    _dir == 1
            
    for 0 to Nx 1 by 1
                
    array.set(xi, array.get(xArri) / float(Nx))
                array.
    set(yi, array.get(yArri) / float(Nx))
        else
            for 
    0 to Nx 1 by 1
                
    array.set(xi, array.get(xArri))
                array.
    set(yi, array.get(yArri))

    //======================================================================================================================
    //                                                  INPUTS
    //======================================================================================================================

    input.int(1,"Fourier Period")
    xval input.source(close,"Fourier X Series",tooltip "i.e. the source of the discrete Fourier"+
     
    " transform (with the Y Series being the bars through time.)")
    highlighting input.bool(true,"Highlighting")
    smoothing66 input.int(10,"Kernel Smoothing")


    //======================================================================================================================
    //                                                  CALCULATIONS
    //======================================================================================================================

    // Fourier transform
    = array.new_float(N0.0)
    = array.new_float(N0.0)
    for 
    0 to N 1
        
    array.set(xixval[i])
        array.
    set(yi0.0)

    DFT(xyN1)

    mag = array.new_float(N0.0)
    for 
    0 to N 1
        mag_i 
    math.sqrt(math.pow(array.get(xi), 2) + math.pow(array.get(yi), 2))
        array.
    set(magimag_i)

    dft = array.get(mag,0)
    dfts kernel.rationalQuadratic(dft,25,1,smoothing66)

    //======================================================================================================================
    //                                                  DISPLAY
    //======================================================================================================================

    plot(dfts"Stop"color=color.aquastyle=plot.style_line )

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

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

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

    //@version=5

    // Custom cosh function
    cosh(float x) =>
        (
    math.exp(x) + math.exp(-x)) / 2

    // Custom acosh function
    acosh(float x) =>
        
    na math.log(math.sqrt(1))

    // Custom sinh function
    sinh(float x) =>
        (
    math.exp(x) - math.exp(-x)) / 2

    // Custom asinh function
    asinh(float x) =>
        
    math.log(math.sqrt(1))

    // Custom inverse tangent function
    atan(float x) =>
        
    math.pi math.atan(x)

    // Chebyshev Type I Moving Average
    chebyshevI(float srcfloat lenfloat ripple) =>
        
    0.
        b 
    0.
        g 
    0.
        chebyshev 
    0.
        
        a 
    := cosh(len acosh(/ (ripple)))
        
    := sinh(len asinh(ripple))
        
    := (b) / (b)
        
    chebyshev := (g) * src nz(chebyshev[1])
        
    chebyshev

    // Chebyshev Type II Moving Average
    chebyshevII(float srcfloat lenfloat ripple) =>
        
    0.
        b 
    0.
        g 
    0.
        chebyshev 
    0.
        
        a 
    := cosh(len acosh(ripple))
        
    := sinh(len asinh(ripple))
        
    := (b) / (b)
        
    chebyshev := (g) * src nz(chebyshev[1], src)
        
    chebyshev

    chebyshev
    (float srcfloat lengthfloat ripplebool style) =>
        
    style ?
         
    chebyshevI(srclengthripple) :
         
    chebyshevII(srclengthripple)

    source44 input.source(close"Source")
    up_color input.color(color.new(color.green20), "Up Color")
    down_color input.color(color.new(color.red20), "Down Color")
    text_color input.color(color.black"Text Color")
    mean_length input.float(24"Mean Length"510000.5)
    mean_ripple input.float(0.5"Mean Ripple"0.010.990.01)
    style44 input.bool(false"True Chebyshev I | False : Chebyshev II")
    atr_style input.bool(true"True: |Open-Close|  False: High-Low")
    atr_length input.float(64"ATR Length"610000.5)
    atr_ripple input.float(0.05"Mean Ripple"0.010.990.01)
    multiplier input.float(1.5"Multiplier"0.125100.125)
    alerts input.bool(true"Alerts")
    labels input.bool(true"Labels")

    atr chebyshev(atr_style high low math.abs(open close), atr_lengthatr_ripplestyle44)
    mean chebyshevI(source44mean_lengthmean_ripple)

    var 
    float offset 0.0
    var bool state na
    var float newOffset 0.0

    crossover 
    ta.crossover(source44offset)
    position source44 offset
    crossunder 
    ta.crossunder(source44offset)

    prevOffset nz(offset[1])

    if 
    crossover[2] and position[1] and position or (position and position[1] and position[2]) 
        
    newOffset := mean atr multiplier
        offset 
    := newOffset nz(prevOffset) or close[1] > nz(prevOffset) ? newOffset nz(prevOffset)
        
    state := true

    if crossunder[2] and not position[1] and not position or (not position and not position[1] and not position[2]) 
        
    newOffset := mean atr multiplier
        offset 
    := newOffset nz(prevOffset) or close[1] < nz(prevOffset) ? newOffset nz(prevOffset)
        
    state := false

    cross 
    ta.cross(closeoffset)

    down_trend not state and not state[1]
    up_trend state and state[1]

    colour up_trend up_color down_trend down_color color.new(color.white100

    if 
    up_trend and not up_trend[1] and labels
        label
    .new(bar_indexoffset"AL \n" str.tostring(close), color up_colorstyle label.style_label_uptextcolor text_color)
        
    alert("AL " str.tostring(close))
    else
        
    alert("Al " str.tostring(close))

    if 
    down_trend and not down_trend[1] and labels
        label
    .new(bar_indexoffset"SAT \n" str.tostring(close), color down_colorstyle label.style_label_downtextcolor text_color)
        
    alert("SAT " str.tostring(close))
    else
        
    alert("SAT " str.tostring(close))
        

    plot(offset"Trend"colourlinewidth=2style plot.style_stepline)

    plotshape(cross"Trend Değişimi"shape.xcrosslocation.belowbarcolor close offset up_color down_color)
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
    örnek üzerinde çalışılacak....

  5. PHP Code:
     // This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
    // © LuxAlgo

    //@version=5
    indicator("*"overlay true)
    //------------------------------------------------------------------------------
    //Settings
    //-----------------------------------------------------------------------------{
    mult input.float(5'Multiplicative Factor'minval 0)

    slope input.float(14'Slope'minval 0)

    width input.float(80'Width %'minval 0maxval 100) / 100

    //Style
    bullCss input.color(color.yellow'Average Color'inline 'avg'group 'Style')
    bearCss input.color(color.aqua''              inline 'avg'group 'Style')

    area input.string('Gradient''Area'options = ['Gradient''Solid'], group 'Style')
    upperCss input.color(color.new(color.aqua70), 'Upper Area'group 'Style')
    lowerCss input.color(color.new(color.yellow70)   , 'Lower Area'group 'Style')

    //-----------------------------------------------------------------------------}
    //Calculation
    //-----------------------------------------------------------------------------{
    var float upper na
    var float lower na
    var float avg   close

    var hold 0.
    var os 1.
        
    atr 
    nz(ta.atr(200)) * mult

    avg 
    := math.abs(close avg) > atr 
      
    math.avg(closeavg)
      : 
    avg os * (hold mult slope)

    os := math.sign(avg avg[1])
    hold := os != os[1] ? atr hold

    upper 
    := avg width hold
    lower 
    := avg width hold

    //-----------------------------------------------------------------------------}
    //Plots
    //-----------------------------------------------------------------------------{
    css os == bullCss bearCss

    plot_upper 
    plot(upper'Yüksek'na)
    plot_avg plot(avg'Ortalama'os != os[1] ? na css)
    plot_lower plot(lower'Düşük'na)

    var 
    color upper_topcol na
    var color upper_btmcol na
    var color lower_topcol na
    var color lower_btmcol na

    //Fill
    if area == 'Gradient'
        
    upper_topcol := upperCss
        upper_btmcol 
    := color.new(chart.bg_color100)
        
    lower_topcol := color.new(chart.bg_color100)
        
    lower_btmcol := lowerCss
    else
        
    upper_topcol := upperCss
        upper_btmcol 
    := upperCss
        lower_topcol 
    := lowerCss
        lower_btmcol 
    := lowerCss

    //Upper Area
    fill(plot_upperplot_avg
      
    top_color os != os[1] ? na upper_topcol
      
    bottom_color os != os[1] ? na upper_btmcol
      
    top_value upper
      
    bottom_value avg)

    //Lower Area
    fill(plot_avgplot_lower
      
    top_color os != os[1] ? na lower_topcol
      
    bottom_color os != os[1] ? na lower_btmcol
      
    top_value avg
      
    bottom_value lower)

    //-----------------------------------------------------------------------------}
    //
    //rodavlas12
    //@version=5


    // Input settings
    ccimomCross input.string('CCI''Entry Signal Source'options=['CCI''Momentum'], tooltip='CCI or Momentum will be the final source of the Entry signal if selected.')
    ccimomLength input.int(10minval=1title='CCI/Momentum Length')
    useDivergence input.bool(truetitle='Find Regular Bullish/Bearish Divergence'tooltip='If checked, it will only consider an overbought or oversold condition that has a regular bullish or bearish divergence formed inside that level.')
    rsiOverbought input.int(65minval=1title='RSI Overbought Level'tooltip='Adjusting the level to extremely high may filter out some signals especially when the option to find divergence is checked.')
    rsiOversold input.int(35minval=1title='RSI Oversold Level'tooltip='Adjusting this level extremely low may filter out some signals especially when the option to find divergence is checked.')
    rsiLength input.int(14minval=1title='RSI Length')
    plotMeanReversion input.bool(false'Plot Mean Reversion Bands on the chart'tooltip='This function doesn\'t affect the entry of signal but it suggests buying when the price is at the lower band, and then sell it on the next bounce at the higher bands.')
    emaPeriod input(200title='Lookback Period (EMA)')
    bandMultiplier input.float(1.8title='Outer Bands Multiplier'tooltip='Multiplier for both upper and lower bands')


    // CCI and Momentum calculation
    momLength ccimomCross == 'Momentum' ccimomLength 10
    mom 
    close close[momLength]
    cci ta.cci(closeccimomLength)
    ccimomCrossUp ccimomCross == 'Momentum' ta.cross(mom0) : ta.cross(cci0)
    ccimomCrossDown ccimomCross == 'Momentum' ta.cross(0mom) : ta.cross(0cci)

    // RSI calculation
    src close
    up 
    ta.rma(math.max(ta.change(src), 0), rsiLength)
    down ta.rma(-math.min(ta.change(src), 0), rsiLength)
    rsi down == 100 up == 100 100 / (up down)
    oversoldAgo rsi[0] <= rsiOversold or rsi[1] <= rsiOversold or rsi[2] <= rsiOversold or rsi[3] <= rsiOversold
    overboughtAgo 
    rsi[0] >= rsiOverbought or rsi[1] >= rsiOverbought or rsi[2] >= rsiOverbought or rsi[3] >= rsiOverbought

    // Regular Divergence Conditions
    bullishDivergenceCondition rsi[0] > rsi[1] and rsi[1] < rsi[2]
    bearishDivergenceCondition rsi[0] < rsi[1] and rsi[1] > rsi[2]

    // Entry Conditions
    longEntryCondition ccimomCrossUp and oversoldAgo and (not useDivergence or bullishDivergenceCondition)
    shortEntryCondition ccimomCrossDown and overboughtAgo and (not useDivergence or bearishDivergenceCondition)


    // Mean Reversion Indicator
    meanReversion plotMeanReversion ta.ema(closeemaPeriod) : na
    stdDev 
    plotMeanReversion ta.stdev(closeemaPeriod) : na
    upperBand 
    plotMeanReversion meanReversion stdDev bandMultiplier na
    lowerBand 
    plotMeanReversion meanReversion stdDev bandMultiplier na


    // Plotting
    plotshape(longEntryConditiontitle='BUY'style=shape.triangleuptext='B'location=location.belowbarcolor=color.new(color.lime0), textcolor=color.new(color.white0), size=size.tiny)
    plotshape(shortEntryConditiontitle='SELL'style=shape.triangledowntext='S'location=location.abovebarcolor=color.new(color.red0), textcolor=color.new(color.white0), size=size.tiny)

    //plot(upperBand, title='Upper Band', color=color.new(color.fuchsia, 0), linewidth=1)
    //plot(meanReversion, title='Mean', color=color.new(color.gray, 0), linewidth=1)
    //plot(lowerBand, title='Lower Band', color=color.new(color.blue, 0), linewidth=1)

    // Entry signal alerts
    //alertcondition(longEntryCondition, title='BUY Signal', message='Buy Entry Signal')
    //alertcondition(shortEntryCondition, title='SELL Signal', message='Sell Entry Signal')
    //alertcondition(longEntryCondition or shortEntryCondition, title='BUY or SELL Signal', message='Entry Signal')
    ////////////////////////////////////////////
    // © TommasoRossini
    //@version=5


    lnt input(200"Lenght")
    lnt2 input.int(10"Smooth"minval 1)
    lnt3 input.float(1.00"Zone Width"minval 0.5maxval 3step 0.25)
    downcol input.color(#e91e6200, "Premium color")
    upcol input.color(#2962ff00, "Discount color")
    atrs ta.sma(ta.atr(lnt), lnt) * lnt3
    max 
    ta.highest(highlnt)
    min ta.lowest(lowlnt)
    [
    middleupper11lower11] = ta.bb(closelnt2)
    upfirst ta.sma(math.avg(maxupper11), lnt2)
    downfirst ta.sma(math.avg(minlower11), lnt2)
    upsecond upfirst atrs
    downsecond 
    downfirst atrs
    average 
    math.avg(upfirstdownfirstmath.avg(maxmin))
    upavg math.avg(averageupfirst)
    downavg math.avg(averagedownfirst)

    p1 plot(upfirstcolor color.new(downcol100), editable false)
    p2 plot(upsecondcolor color.new(downcol0), title "Direnç")
    p3 plot(downfirstcolor color.new(upcol100), editable false)
    p4 plot(downsecondcolor color.new(upcol0), title "Destek")
    //fill(p1, p2, color = color.new(downcol, 85), title = "Roof fill")
    //fill(p3, p4, color = color.new(upcol, 85), title = "Floor fill")
    plot(close middle upavg nacolor color.new(downcol100), style plot.style_linebrtitle "Yukarı Kırılım")
    plot(close middle downavg nacolor color.new(upcol100), style plot.style_linebrtitle "Aşağı Kırılım")
    ///////////////////////////////////////////////////////////
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © RicardoSantos, midtownsk8rguy


    //  Cycle functions by: midtownsk8rguy
    //  https://www.tradingview.com/script/wyyXKHDn-Correlation-Cycle-CorrelationAngle-Market-State-John-Ehlers/
    rad2deg(Rad) =>  // Radians To Degrees
        
    var DEGREES_IN_1_RADIAN 90.0 math.asin(1.0)  // 57.29577951308 Constant
        
    Rad DEGREES_IN_1_RADIAN

    cc
    (SeriesPeriod) =>  // Correlation Cycle Function
        
    var PIx2 4.0 math.asin(1.0)  // 6.28318530718 Constant
        
    period math.max(2Period)
        
    Rx 0.0
        Rxx 
    0.0
        Rxy 
    0.0
        Ryy 
    0.0
        Ry 
    0.0
        Ix 
    0.0
        Ixx 
    0.0
        Ixy 
    0.0
        Iyy 
    0.0
        Iy 
    0.0
        
    for 1 to period by 1
            iMinusOne 
    1
            X 
    nz(Series[iMinusOne])
            
    temp PIx2 iMinusOne period
            Yc 
    math.cos(temp)
            
    Ys = -math.sin(temp)
            
    Rx += X
            Ix 
    += X
            Rxx 
    += X
            Ixx 
    += X
            Rxy 
    += Yc
            Ixy 
    += Ys
            Ryy 
    += Yc Yc
            Iyy 
    += Ys Ys
            Ry 
    += Yc
            Iy 
    += Ys
            Iy
        realPart 
    0.0
        temp_1 
    period Rxx Rx Rx
        temp_2 
    period Ryy Ry Ry
        
    if temp_1 0.0 and temp_2 0.0
            realPart 
    := (period Rxy Rx Ry) / math.sqrt(temp_1 temp_2)
            
    realPart
        imagPart 
    0.0
        temp_1 
    := period Ixx Ix Ix
        temp_2 
    := period Iyy Iy Iy
        
    if temp_1 0.0 and temp_2 0.0
            imagPart 
    := (period Ixy Ix Iy) / math.sqrt(temp_1 temp_2)
            
    imagPart
        
    [realPartimagPart]

    cap(RealPartImaginaryPart) =>  // Correlation Angle Phasor Function
        
    var HALF_OF_PI math.asin(1.0)  // 1.57079632679 Constant
        
    angle ImaginaryPart == 0.0 0.0 rad2deg(math.atan(RealPart ImaginaryPart) + HALF_OF_PI)
        if 
    ImaginaryPart 0.0
            angle 
    -= 180.0
            angle
        priorAngle 
    nz(angle[1])
        if 
    priorAngle angle and priorAngle angle 270.0
            angle 
    := priorAngle
            angle
        angle
    //------------------------------------------------------------------------------

    int length input(23)
    bool use_automatic_selection input(false)
    float cycle_length length

    if use_automatic_selection
        
    [_real_imag] = cc(closelength)
        
    cycle_length := math.round(cap(_real_imag))
        
    cycle_length

    bool is_new_cycle 
    false
    if bar_index cycle_length == cycle_length 1
        is_new_cycle 
    := true
        is_new_cycle

    var float avg11 open
    var color pl_color color.new(color.gray0)
    var 
    bool is_up na


    var line li_slope line.new(x1=bar_indexy1=openx2=bar_indexy2=openxloc=xloc.bar_indexextend=extend.rightcolor=color.yellowstyle=line.style_dottedwidth=2)
    var 
    line li_trend line.new(x1=bar_indexy1=openx2=bar_indexy2=openxloc=xloc.bar_indexextend=extend.rightcolor=color.yellowstyle=line.style_dashedwidth=2)

    var 
    float max11 high
    var float min11 low
    if high max11
        max11 
    := math.max(highavg11)
        
    max11
    if low min
        min11 
    := math.min(lowavg11)
        
    min11


    if is_new_cycle
        avg11 
    := (nz(avg11) * (cycle_length) + close * (cycle_length)) / 2
        max11 
    := high
        min11 
    := low
        
    if avg11 avg11[1]
            
    is_up := true
            pl_color 
    := color.new(color.lime0)
            if 
    not is_up[1]
                
    line.set_xy1(id=li_trendx=line.get_x1(id=li_slope), y=avg11[1])
                
    line.set_xy2(id=li_trendx=bar_index[0], y=avg11)
            else
                
    line.set_xy2(id=li_trendx=bar_index[0], y=avg11)
        if 
    avg11 avg11[1]
            
    is_up := false
            pl_color 
    := color.new(color.red0)
            if 
    is_up[1]
                
    line.set_xy1(id=li_trendx=line.get_x1(id=li_slope), y=avg11[1])
                
    line.set_xy2(id=li_trendx=bar_index[0], y=avg11)
            else
                
    line.set_xy2(id=li_trendx=bar_index[0], y=avg11)
        
    line.set_x1(id=li_slopex=bar_index[1])
        
    line.set_xy2(id=li_slopex=bar_index[0], y=avg)

        
    // line.new(x1=bar_index[cycle_length], y1=avg[cycle_length], x2=bar_index[0], y2=avg[0], xloc=xloc.bar_index, extend=extend.right, color=color.blue, style=line.style_dotted, width=1)
    if is_up
        line
    .set_y1(id=li_slopey=avg - (max11 min11) / cycle_length)
    else
        
    line.set_y1(id=li_slopey=avg + (max11 min11) / cycle_length)

    plot(series=avgtitle='Trend'color=pl_colorlinewidth=2style=plot.style_stepline
    üzerinde çalışılacak örnek....

Sayfa 227/300 İlkİlk ... 127177217225226227228229237277 ... 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
  •