Sayfa 196/308 İlkİlk ... 96146186194195196197198206246296 ... SonSon
Arama sonucu : 2464 madde; 1,561 - 1,568 arası.

Konu: Tradingview

  1. https://tr.tradingview.com/script/96...ation-Heatmap/

    çok güzel bir mantıkla yapılmış bence....
    trendin korelasyonunu...belirlenen zaman dilimleri için hesaplıyor......

    yani trendin, mtf korelasyonu gibi....

    https://www.tradingview.com/x/4675N9hf/

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

    //@version=5
    strategy("*"overlay truemax_lines_count 100max_labels_count 100format=format.price)

    //@version=5
    // User inputs
    prd22 input.int(defval=2title=' 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(highprd22prd22)
    float pl ta.pivotlow(lowprd22prd22)

    //plotshape(ph and show_pivots, style=shape.triangledown, location=location.abovebar, offset=-prd22, size=size.small)
    //plotshape(pl and show_pivots, style=shape.triangleup, location=location.belowbar, offset=-prd22, size=size.small)

    // 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 prd22)
        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 prd22)
        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 prd22 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 >= prd22
                        
    //label.new(ind1, high[bar_index - ind1], text='S', style=label.style_label_down, color=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 prd22 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 >= prd22
                        
    //label.new(ind1, low[bar_index - ind1], text='A', style=label.style_label_up, color=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)
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // 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(27'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.rgb(2558282100) : color.rgb(7617579100)

    //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(ghla"TR--@R"color=color44style=plot.style_circleslinewidth 3)  

    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © carefulCode53358
    //@version=5
    start1 input.float(title='Start'defval=0.1step=0.1)
    increment1 input.float(title='Increment'defval=0.1step=0.1)
    maximum1 input.float(title='Max Value'defval=1step=0.1)
    putlabel1 input(title='Put Labels'defval=false)
    colup1 input.color(title='Colors'defval=color.rgb(0230119100), inline='col')
    coldn1 input.color(title=''defval=color.rgb(2558282100), inline='col')

    int trend1 0
    float sar1 
    0.0
    float ep1 
    0.0
    float af1 
    0.0

    trend1 
    := nz(trend1[1])
    ep1 := nz(ep1[1])
    af1 := nz(af1[1])
    sar1 := sar1[1]

    if 
    trend1 == and not na(high[1])
        
    trend1 := high >= high[1] or low >= low[1] ? : -1
        sar1 
    := trend1 low[1] : high[1]
        
    ep1 := trend1 high[1] : low[1]
        
    af1 := start1
        af1
    else
        
    nextsar1 sar1
        
    if trend1 0
            
    if high[1] > ep1
                ep1 
    := high[1]
                
    af1 := math.min(maximum1af1 increment1)
                
    af1

            nextsar1 
    := sar1 af1 * (ep1 sar1)
            
    nextsar1 := math.min(math.min(low[1], low[2]), nextsar1)

            
    //Reversal
            
    if nextsar1 low
                trend1 
    := -1
                nextsar1 
    := ep1
                ep1 
    := low
                af1 
    := start1
                af1
        
    else
            if 
    low[1] < ep1
                ep1 
    := low[1]
                
    af1 := math.min(maximum1af1 increment1)
                
    af1

            nextsar1 
    := sar1 af1 * (ep1 sar1)
            
    nextsar1 := math.max(math.max(high[1], high[2]), nextsar1)

            
    //Reversal
            
    if nextsar1 high
                trend1 
    := 1
                nextsar1 
    := ep1
                ep1 
    := high
                af1 
    := start1
                af1
        sar1 
    := nextsar1
        sar1

    plot
    (sar1title='İV--@Ü'color=trend1 colup1 coldn1linewidth=1style=plot.style_line)

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

    if 
    ta.change(trend1) > and putlabel1
        label
    .new(bar_indexsar1text=str.tostring(math.round_to_mintick(sar1)), color=colup1style=label.style_label_upsize=size.small)
    if 
    ta.change(trend1) < and putlabel1
        label
    .new(bar_indexsar1text=str.tostring(math.round_to_mintick(sar1)), color=coldn1style=label.style_label_downsize=size.small)

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    start12 input.float(title='Start'defval=0step=0.1)
    increment12 input.float(title='Increment'defval=0.1step=0.1)
    maximum12 input.float(title='Max Value'defval=1step=0.1)
    putlabel12 input(title='Put Labels'defval=false)
    colup12 input.color(title='Colors'defval=color.rgb(0230119100), inline='col')
    coldn12 input.color(title=''defval=color.rgb(2558282100), inline='col')

    int trend12 0
    float sar12 
    0.0
    float ep12 
    0.0
    float af12 
    0.0

    trend12 
    := nz(trend12[1])
    ep12 := nz(ep12[1])
    af12 := nz(af12[1])
    sar12 := sar12[1]

    if 
    trend12 == and not na(high[1])
        
    trend1 := high >= high[1] or low >= low[1] ? : -1
        sar12 
    := trend12 low[1] : high[1]
        
    ep12 := trend12 high[1] : low[1]
        
    af12 := start12
        af12
    else
        
    nextsar12 sar12
        
    if trend12 0
            
    if high[1] > ep12
                ep12 
    := high[1]
                
    af12 := math.min(maximum12af12 increment12)
                
    af12

            nextsar12 
    := sar12 af12 * (ep12 sar12)
            
    nextsar12 := math.min(math.min(low[1], low[2]), nextsar12)

            
    //Reversal
            
    if nextsar12 low
                trend12 
    := -1
                nextsar12 
    := ep12
                ep12 
    := low
                af12 
    := start12
                af12
        
    else
            if 
    low[1] < ep12
                ep12 
    := low[1]
                
    af12 := math.min(maximum12af12 increment12)
                
    af12

            nextsar12 
    := sar12 af12 * (ep12 sar12)
            
    nextsar12 := math.max(math.max(high[1], high[2]), nextsar12)

            
    //Reversal
            
    if nextsar12 high
                trend12 
    := 1
                nextsar12 
    := ep12
                ep12 
    := high
                af12 
    := start12
                af12
        sar12 
    := nextsar12
        sar12

    plot
    (sar12title='KV--@K'color=trend12 colup12 coldn12linewidth=1style=plot.style_line)

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

    if 
    ta.change(trend12) > and putlabel12
        label
    .new(bar_indexsar12text=str.tostring(math.round_to_mintick(sar12)), color=colup12style=label.style_label_upsize=size.small)
    if 
    ta.change(trend12) < and putlabel12
        label
    .new(bar_indexsar12text=str.tostring(math.round_to_mintick(sar12)), color=coldn12style=label.style_label_downsize=size.small)

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    start123 input.float(title='Start'defval=0step=0.1)
    increment123 input.float(title='Increment'defval=0.1step=0.1)
    maximum123 input.float(title='Max Value'defval=0.1step=0.1)
    putlabel123 input(title='Put Labels'defval=false)
    colup123 input.color(title='Colors'defval=color.rgb(0230119100), inline='col')
    coldn123 input.color(title=''defval=color.rgb(2558282100), inline='col')

    int trend123 0
    float sar123 
    0.0
    float ep123 
    0.0
    float af123 
    0.0

    trend123 
    := nz(trend123[1])
    ep123 := nz(ep123[1])
    af123 := nz(af123[1])
    sar123 := sar123[1]

    if 
    trend123 == and not na(high[1])
        
    trend123 := high >= high[1] or low >= low[1] ? : -1
        sar123 
    := trend123 low[1] : high[1]
        
    ep123 := trend123 high[1] : low[1]
        
    af123 := start123
        af123
    else
        
    nextsar123 sar123
        
    if trend123 0
            
    if high[1] > ep123
                ep123 
    := high[1]
                
    af123 := math.min(maximum123af123 increment123)
                
    af123

            nextsar123 
    := sar123 af123 * (ep123 sar123)
            
    nextsar123 := math.min(math.min(low[1], low[2]), nextsar123)

            
    //Reversal
            
    if nextsar123 low
                trend123 
    := -1
                nextsar123 
    := ep123
                ep123 
    := low
                af123 
    := start123
                af123
        
    else
            if 
    low[1] < ep123
                ep123 
    := low[1]
                
    af123 := math.min(maximum123af123 increment123)
                
    af123

            nextsar123 
    := sar123 af123 * (ep123 sar123)
            
    nextsar123 := math.max(math.max(high[1], high[2]), nextsar123)

            
    //Reversal
            
    if nextsar123 high
                trend123 
    := 1
                nextsar123 
    := ep123
                ep123 
    := high
                af123 
    := start123
                af123
        sar123 
    := nextsar123
        sar123

    plot
    (sar123title='OV--@Ö'color=trend123 colup123 coldn123linewidth=1style=plot.style_line)

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

    if 
    ta.change(trend123) > and putlabel123
        label
    .new(bar_indexsar123text=str.tostring(math.round_to_mintick(sar123)), color=colup123style=label.style_label_upsize=size.small)
    if 
    ta.change(trend123) < and putlabel123
        label
    .new(bar_indexsar123text=str.tostring(math.round_to_mintick(sar123)), color=coldn123style=label.style_label_downsize=size.small)

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    start1234 input.float(title='Start'defval=0step=0.1)
    increment1234 input.float(title='Increment'defval=0.01step=0.1)
    maximum1234 input.float(title='Max Value'defval=0.1step=0.1)
    putlabel1234 input(title='Put Labels'defval=false)
    colup1234 input.color(title='Colors'defval=color.rgb(0230119100), inline='col')
    coldn1234 input.color(title=''defval=color.rgb(2558282100), inline='col')

    int trend1234 0
    float sar1234 
    0.0
    float ep1234 
    0.0
    float af1234 
    0.0

    trend1234 
    := nz(trend1234[1])
    ep1234 := nz(ep1234[1])
    af1234 := nz(af1234[1])
    sar1234 := sar1234[1]

    if 
    trend1234 == and not na(high[1])
        
    trend1234 := high >= high[1] or low >= low[1] ? : -1
        sar1234 
    := trend1234 low[1] : high[1]
        
    ep1234 := trend1234 high[1] : low[1]
        
    af1234 := start1234
        af1234
    else
        
    nextsar1234 sar1234
        
    if trend1234 0
            
    if high[1] > ep1234
                ep1234 
    := high[1]
                
    af1234 := math.min(maximum1234af1234 increment1234)
                
    af1234

            nextsar1234 
    := sar1234 af1234 * (ep1234 sar1234)
            
    nextsar1234 := math.min(math.min(low[1], low[2]), nextsar1234)

            
    //Reversal
            
    if nextsar1234 low
                trend1234 
    := -1
                nextsar1234 
    := ep1234
                ep1234 
    := low
                af1234 
    := start1234
                af1234
        
    else
            if 
    low[1] < ep1234
                ep1234 
    := low[1]
                
    af1234 := math.min(maximum1234af1234 increment1234)
                
    af1234

            nextsar1234 
    := sar1234 af1234 * (ep1234 sar1234)
            
    nextsar1234 := math.max(math.max(high[1], high[2]), nextsar1234)

            
    //Reversal
            
    if nextsar1234 high
                trend1234 
    := 1
                nextsar1234 
    := ep1234
                ep1234 
    := high
                af1234 
    := start1234
                af1234
        sar1234 
    := nextsar1234
        sar1234

    plot
    (sar1234title='UV--@Y'color=trend1234 colup1234 coldn1234linewidth=1style=plot.style_line)

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

    if 
    ta.change(trend1234) > and putlabel1234
        label
    .new(bar_indexsar1234text=str.tostring(math.round_to_mintick(sar1234)), color=colup1234style=label.style_label_upsize=size.small)
    if 
    ta.change(trend1234) < and putlabel1234
        label
    .new(bar_indexsar123text=str.tostring(math.round_to_mintick(sar1234)), color=coldn1234style=label.style_label_downsize=size.small)

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

    //@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=false)
    colup input.color(title='Colors'defval=color.rgb(22364251100), inline='col')
    coldn input.color(title=''defval=color.rgb(22364251100), 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='Yörük'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.small)
    if 
    ta.change(trend) < and putlabel
        label
    .new(bar_indexsartext=str.tostring(math.round_to_mintick(sar)), color=coldnstyle=label.style_label_downsize=size.small)

    ////////////////////////////////////////////////////////
    // 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"--Stop--"style=plot.style_linecolor=#ffeb3b00)
    ////////////////////////////////////////

    length7=(1)
    src7=close
    start17 
    input(0.1)
    increment17 input(0.1)
    maximum17 input(1"Max Value")
    out17 ta.sar(start17increment17maximum17)

    momo1 src7 src7[length7]

    smdo1 out17 momo1

    plot
    (smdo1"---DD---"style=plot.style_linecolor=color.rgb(255255255100))
    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    changebarcol input.bool(truetitle='Change Bar Color'inline='bcol')
    bcolup input.color(color.limetitle=''inline='bcol')
    bcoldn input.color(color.redtitle=''inline='bcol')

    var 
    color lastBarColor na

    // BACAP 21 EMA TREND
    //Linesize = input.int(3, title='Line Size', minval=1)
    BullishColor input.color(color.lime)
    BearishColor input.color(color.red)


    // Determine the color based on 21 DEMA Trend
    barColorBasedOnDEMATrend close sar1 and close sar12 and close sar and close ghla  BullishColor close sar1 and close sar12 and close sar and close ghla   BearishColor nz(lastBarColor[1])

    // Change bar color
    lastBarColor := barColorBasedOnDEMATrend
    barcolor
    (color=changebarcol barColorBasedOnDEMATrend na)

    ta.crossover(close,sar) and ta.crossover(close,sar1) and ta.crossover(close,sar12) and ta.crossover(close,ghla) and ta.crossover(close,scma) and ta.crossover(close,smdo1
    ta.crossunder(close,sar) and ta.crossunder(close,sar1) and ta.crossunder(close,sar12) and ta.crossunder(close,ghla) and ta.crossunder(close,scma) and ta.crossunder(close,smdo1)
    in_b ta.barssince(x)[1] < ta.barssince(y)[1]
    in_s ta.barssince(y)[1] < ta.barssince(x)[1]


    if 
    x
        strategy
    .entry("Long",strategy.long)
    if 
    y
        strategy
    .close("Long")

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

    //@version=5
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Tooltips {
    string t1 "The candle lookback length refers to the number of bars, starting from the current one, that will be examined in order to find a similar event in the past."
    string t2 "The amount of Forecast candles that should be displayed in the future."
    string t3 "Background color divider between price and forecast."
    string t4 "Displays the current events found"
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Inputs {
    Series   input.int(1,"Candle Series",1,20,tooltip=t1)
    Forecast input.int(166,"Forecast Candles",1,166,tooltip=t2)
    Divider  input.bool(true,"Forecast Divider",t3)
    Display  input.bool(true,"Display Event",t4)
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Types {
    type Event
        box currentEvent
        box pastEvent
        box prediction
        
    array<box>  candle
        
    array<linewick
    type Data
        
    array<int>   
        
    array<int>   d
        
    array<floato
        
    array<floath
        
    array<floatl
        
    array<floatc
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Variables & Arrays {
    bar_index
    var data  Data.new(array.new<int>(),
                         array.new<
    int>(),
                         array.new<
    float>(),
                         array.new<
    float>(),
                         array.new<
    float>(),
                         array.new<
    float>())
    var 
    event Event.new(box.new(na,na,na,na,chart.fg_color,border_style=line.style_dashed,bgcolor=color(na)),
                         
    box.new(na,na,na,na,chart.fg_color,border_style=line.style_dashed,bgcolor=color(na)),
                         
    box.new(na,na,na,na,chart.fg_color,border_style=line.style_dotted,
                          
    bgcolor=color.new(color.teal,75)),
                         array.new<
    box>(Forecast),
                         array.new<
    line>(Forecast))
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Methods {
    //Store Data
    method Store(Data x)=>
        
    int   B b
        int bin 
    close>open?1:close<open?-1:0
        float O 
    open
        float H 
    high
        float L 
    low
        float C 
    close
        x
    .b.unshift(B)
        
    x.d.unshift(bin)
        
    x.o.unshift(O)
        
    x.h.unshift(H)
        
    x.l.unshift(L)
        
    x.c.unshift(C)

    //Candle Plots
    method Candle(Event e,x,i)=>
        
    int dist   1
        float prev 
    x.c.get(i)
        
    float diff = ((close-prev)/prev)+1
        
    for j=i-1 to i-Forecast
            idx 
    j-i+Forecast
            
    if j<0
                
    break
            else
                
    pos x.d.get(j)
                
    top = (pos>0?x.c.get(j):x.o.get(j))*diff
                bot 
    = (pos>0?x.o.get(j):x.c.get(j))*diff
                hi  
    = (x.h.get(j))*diff
                lo  
    = (x.l.get(j))*diff
                col 
    pos==1?#26a69a:pos==-1?#ef5350:chart.fg_color
                
    candle e.candle.get(idx)
                if 
    na(candle)
                    
    e.candle.set(idx,box.new(b+dist,top,b+dist+2,bot,na,bgcolor=col))
                    
    e.wick.set(idx,line.new(b+dist+1,hi,b+dist+1,lo,color=col))
                else
                    
    box.set_lefttop(e.candle.get(idx),b+dist,top)
                    
    box.set_rightbottom(e.candle.get(idx),b+dist+2,bot)
                    
    box.set_bgcolor(e.candle.get(idx),col)
                    
    line.set_xy1(e.wick.get(idx),b+dist+1,hi)
                    
    line.set_xy2(e.wick.get(idx),b+dist+1,lo)
                    
    line.set_color(e.wick.get(idx),col)
            
    dist += 3

    //Events Display
    method Events(Event e,idx,h1,l1,h2,l2,fh,fl)=>
        
    int start idx.get(Series-1)
        
    int end   idx.get(0)
        
    e.currentEvent.set_lefttop(b-Series+1,h1.max())
        
    e.currentEvent.set_rightbottom(b,l1.min())
        
    e.pastEvent.set_lefttop(start,h2.max())
        
    e.pastEvent.set_rightbottom(end,l2.min())
        
    e.prediction.set_lefttop(end+1,fh.max())
        
    e.prediction.set_rightbottom(math.min(b,end+Forecast),fl.min())

    //Current Event
    method Series(Data x)=>
        
    data.Store()
        
    bool found false
        
    if barstate.islast
            events 
    x.d.slice(0,Series)
            for 
    i=Series to x.d.size()-Series
                elements 
    x.d.slice(i,i+Series)
                
    equal 0
                
    for [k,thisin elements
                    
    if this==events.get(k)
                        
    equal += 1
                
    if equal==Series
                    found 
    := true
                    event
    .Candle(data,i)
                    if 
    Display
                        bar 
    x.b.slice(i,i+Series)
                        
    h1  x.h.slice(0,Series)
                        
    l1  x.l.slice(0,Series)
                        
    h2  x.h.slice(i,i+Series)
                        
    l2  x.l.slice(i,i+Series)
                        
    fh  i-Forecast<0?x.h.slice(0,i-1):x.h.slice(i-Forecast,i-1)
                        
    fl  i-Forecast<0?x.l.slice(0,i-1):x.l.slice(i-Forecast,i-1)
                        
    event.Events(bar,h1,l1,h2,l2,fh,fl)
                    break
        if 
    barstate.islast and not found
            runtime
    .error("Couldn't find similar candle series event. \nFix: Decrease Candle Series length")
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Divider {
    //bgcolor(Divider and barstate.islast?color.new(chart.fg_color,80):na,1)
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Run Code {
    data.Series()
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

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

  3. https://tr.tradingview.com/v/XrvyQSzH/
    birleştirilmiş kodlar....

    https://www.tradingview.com/x/UnCCKQ7z/

    kodu sadeleştirince...ve sadece kırılım gösterilince ise.....https://www.tradingview.com/x/F9mvBZ7a/


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

    //@version=5
    indicator("SAR "overlay=true)

    //SAR

    SAR input(truetitle='*')
    OSAR input(truetitle='Other Time frame SAR')


    start input(0.02title="start"group="Parabolic SAR")
    increment input(0.02title="Increment"group="Parabolic SAR")
    maximum input(0.2title="Maximum"group="Parabolic SAR")
     
    out ta.sar(startincrementmaximum)
     
    sarChange ta.change(out<high)
     
    var 
    prevSar out
     
    if(sarChange)
        
    prevSar := out[1] + ((out[1]/100)*0.002)
     
    plot(SAR and sarChange?na:prevSarstyle=plot.style_linebroffset=-1color=out<high?color.green:color.redtitle="Sar-Kırılım"linewidth=2)
    plot(SAR and out out natitle='Sar-Trend'color=color.rgb(120123134100), style=plot.style_circleslinewidth=2)
     

    //sar_15
    //15min sar
    startD_15 input(0.02title="start"group="Parabolic SAR")
    incrementD_15 input(0.02title="Increment"group="Parabolic SAR")
    maximumD_15 input(0.2title="Maximum"group="Parabolic SAR")
     
    outD_15 request.security(syminfo.ticker"5"ta.sar(startD_15incrementD_15,maximumD_15))
    plot(OSAR and outD_15 outD_15 natitle='Sar_5'color=color.rgb(25500100), style=plot.style_circleslinewidth=1)

    //sar_30
    //30min sar
    startD_30 input(0.02title="start"group="Parabolic SAR")
    incrementD_30 input(0.02title="Increment"group="Parabolic SAR")
    maximumD_30 input(0.2title="Maximum"group="Parabolic SAR")
     
    outD_30 request.security(syminfo.ticker"15"ta.sar(startD_30incrementD_30,maximumD_30))
    plot(OSAR and outD_30 outD_30 natitle='Sar_15'color=color.rgb(7468240100), style=plot.style_circleslinewidth=1)

    //sar_01
    //01Hr sar
    startD_60 input(0.02title="start"group="Parabolic SAR")
    incrementD_60 input(0.02title="Increment"group="Parabolic SAR")
    maximumD_60 input(0.2title="Maximum"group="Parabolic SAR")
     
    outD_60 request.security(syminfo.ticker"60"ta.sar(startD_60incrementD_60,maximumD_60))
    plot(OSAR and outD_60 outD_60 natitle='Sar_60'color=color.rgb(73240112100), style=plot.style_circleslinewidth=1)


    //sar_02
    //02Hr sar
    startD_120 input(0.02title="start"group="Parabolic SAR")
    incrementD_120 input(0.02title="Increment"group="Parabolic SAR")
    maximumD_120 input(0.2title="Maximum"group="Parabolic SAR")
     
    outD_120 request.security(syminfo.ticker"240"ta.sar(startD_120incrementD_120,maximumD_120))
    plot(OSAR and outD_120 outD_120 natitle='Sar_240'color=color.rgb(25117072100), style=plot.style_circleslinewidth=1)

    //sar_03
    //03Hr sar
    startD_180 input(0.03title="start"group="Parabolic SAR")
    incrementD_180 input(0.03title="Increment"group="Parabolic SAR")
    maximumD_180 input(0.2title="Maximum"group="Parabolic SAR")
     
    outD_180 request.security(syminfo.ticker"D"ta.sar(startD_180incrementD_180,maximumD_180))
    plot(OSAR and outD_180 outD_180 natitle='Sar_Gün'color=color.rgb(25172239100), style=plot.style_circleslinewidth=1
    kırılıma göre bar renklendirmesi yapılabileceği gibi....

    kırılım çizgilerine göre strateji yazılınca da sonuç ortalaması güzel....

    aslında....
    kırılımlarıda mtf yaparsak....
    1-5-15-60 lık.... ve 1-5-15 e strateji yazılırsa...
    agresif olur ki...
    bir ara yapmak lazım...
    ve sonucu test edip görmek lazım...
    Son düzenleme : @yörük@; 02-07-2023 saat: 09:56.

  4. https://www.tradingview.com/x/UM2V8JRU/
    https://www.tradingview.com/x/OhLlzvxl/
    https://www.tradingview.com/x/h12ATSP5/

    derleme denemeye eklenmiş hali.....
    değer olarak yörük sar değeri olan...
    0.05-0.075-0.35 kullanıldı....

  5.  Alıntı Originally Posted by @yörük@ Yazıyı Oku
    https://tr.tradingview.com/v/XrvyQSzH/
    birleştirilmiş kodlar....

    https://www.tradingview.com/x/UnCCKQ7z/

    kodu sadeleştirince...ve sadece kırılım gösterilince ise.....https://www.tradingview.com/x/F9mvBZ7a/


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

    //@version=5
    indicator("SAR "overlay=true)

    //SAR

    SAR input(truetitle='*')
    OSAR input(truetitle='Other Time frame SAR')


    start input(0.02title="start"group="Parabolic SAR")
    increment input(0.02title="Increment"group="Parabolic SAR")
    maximum input(0.2title="Maximum"group="Parabolic SAR")
     
    out ta.sar(startincrementmaximum)
     
    sarChange ta.change(out<high)
     
    var 
    prevSar out
     
    if(sarChange)
        
    prevSar := out[1] + ((out[1]/100)*0.002)
     
    plot(SAR and sarChange?na:prevSarstyle=plot.style_linebroffset=-1color=out<high?color.green:color.redtitle="Sar-Kırılım"linewidth=2)
    plot(SAR and out out natitle='Sar-Trend'color=color.rgb(120123134100), style=plot.style_circleslinewidth=2)
     

    //sar_15
    //15min sar
    startD_15 input(0.02title="start"group="Parabolic SAR")
    incrementD_15 input(0.02title="Increment"group="Parabolic SAR")
    maximumD_15 input(0.2title="Maximum"group="Parabolic SAR")
     
    outD_15 request.security(syminfo.ticker"5"ta.sar(startD_15incrementD_15,maximumD_15))
    plot(OSAR and outD_15 outD_15 natitle='Sar_5'color=color.rgb(25500100), style=plot.style_circleslinewidth=1)

    //sar_30
    //30min sar
    startD_30 input(0.02title="start"group="Parabolic SAR")
    incrementD_30 input(0.02title="Increment"group="Parabolic SAR")
    maximumD_30 input(0.2title="Maximum"group="Parabolic SAR")
     
    outD_30 request.security(syminfo.ticker"15"ta.sar(startD_30incrementD_30,maximumD_30))
    plot(OSAR and outD_30 outD_30 natitle='Sar_15'color=color.rgb(7468240100), style=plot.style_circleslinewidth=1)

    //sar_01
    //01Hr sar
    startD_60 input(0.02title="start"group="Parabolic SAR")
    incrementD_60 input(0.02title="Increment"group="Parabolic SAR")
    maximumD_60 input(0.2title="Maximum"group="Parabolic SAR")
     
    outD_60 request.security(syminfo.ticker"60"ta.sar(startD_60incrementD_60,maximumD_60))
    plot(OSAR and outD_60 outD_60 natitle='Sar_60'color=color.rgb(73240112100), style=plot.style_circleslinewidth=1)


    //sar_02
    //02Hr sar
    startD_120 input(0.02title="start"group="Parabolic SAR")
    incrementD_120 input(0.02title="Increment"group="Parabolic SAR")
    maximumD_120 input(0.2title="Maximum"group="Parabolic SAR")
     
    outD_120 request.security(syminfo.ticker"240"ta.sar(startD_120incrementD_120,maximumD_120))
    plot(OSAR and outD_120 outD_120 natitle='Sar_240'color=color.rgb(25117072100), style=plot.style_circleslinewidth=1)

    //sar_03
    //03Hr sar
    startD_180 input(0.03title="start"group="Parabolic SAR")
    incrementD_180 input(0.03title="Increment"group="Parabolic SAR")
    maximumD_180 input(0.2title="Maximum"group="Parabolic SAR")
     
    outD_180 request.security(syminfo.ticker"D"ta.sar(startD_180incrementD_180,maximumD_180))
    plot(OSAR and outD_180 outD_180 natitle='Sar_Gün'color=color.rgb(25172239100), style=plot.style_circleslinewidth=1
    kırılıma göre bar renklendirmesi yapılabileceği gibi....

    kırılım çizgilerine göre strateji yazılınca da sonuç ortalaması güzel....

    aslında....
    kırılımlarıda mtf yaparsak....
    1-5-15-60 lık.... ve 1-5-15 e strateji yazılırsa...
    agresif olur ki...
    bir ara yapmak lazım...
    ve sonucu test edip görmek lazım...
    örnek bir kırılım denemesi.....
    sarı renkli olan 5 dakkalık sar kırılımı....

    https://www.tradingview.com/x/wm3AinBE/
    https://www.tradingview.com/x/OSwqrOmL/
    https://www.tradingview.com/x/gOdnFFiv/
    https://www.tradingview.com/x/t2UBgY7Q/

    periyot küöüldükçe....
    barın içinde kırılım çizgileri oluşacağından agresif olacak....

  6. 1-5-15-30-60 kırılımları mtf olunca.....
    https://www.tradingview.com/x/M0Sp5mQa/
    https://www.tradingview.com/x/Zhanciaf/
    https://www.tradingview.com/x/Vyp2rA4N/

    gizlenince.....https://www.tradingview.com/x/H2up5GH6/


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

    //@version=5
    indicator("SAR "overlay=true)

    //SAR

    SAR input(truetitle='*')
    OSAR input(truetitle='Other Time frame SAR')


    start88 input(0.05title="start"group="Parabolic SAR")
    increment88 input(0.075title="Increment"group="Parabolic SAR")
    maximum88 input(0.35title="Maximum"group="Parabolic SAR")
     
    out88 ta.sar(start88increment88maximum88)
     
    sarChange ta.change(out88<high)
     
    var 
    prevSar out88
     
    if(sarChange)
        
    prevSar := out88[1] + ((out88[1]/100)*0.002)
     
    plot(SAR and sarChange?na:prevSarstyle=plot.style_linebroffset=-1color=out88<high?color.green:color.redtitle="Kırılım"linewidth=1)
    plot(SAR and out88 out88 natitle='Sar-Trend'color=#ff990000, style=plot.style_circles, linewidth=2)
     

    //sar_15
    //15min sar
    startD_15 input(0.05title="start"group="Parabolic SAR")
    incrementD_15 input(0.075title="Increment"group="Parabolic SAR")
    maximumD_15 input(0.35title="Maximum"group="Parabolic SAR")
     
    outD_15 request.security(syminfo.ticker"1"ta.sar(startD_15incrementD_15,maximumD_15))

    sarChange5 ta.change(outD_15<high)
     
    var 
    prevSar5 outD_15
     
    if(sarChange5)
        
    prevSar5 := outD_15[1] + ((outD_15[1]/100)*0.002)
     
    plot(SAR and sarChange5?na:prevSar5style=plot.style_linebroffset=-1color=outD_15<high?color.rgb(78238243100):color.rgb(78238243100), title="Kırılım-1"linewidth=1)

    plot(OSAR and outD_15 outD_15 natitle='Sar_1'color=#ff990000, style=plot.style_circles, linewidth=1)

    //sar_30
    //30min sar
    startD_30 input(0.05title="start"group="Parabolic SAR")
    incrementD_30 input(0.075title="Increment"group="Parabolic SAR")
    maximumD_30 input(0.35title="Maximum"group="Parabolic SAR")
     
    outD_30 request.security(syminfo.ticker"5"ta.sar(startD_30incrementD_30,maximumD_30))

    sarChange56 ta.change(outD_30<high)
     
    var 
    prevSar56 outD_30
     
    if(sarChange56)
        
    prevSar56 := outD_30[1] + ((outD_30[1]/100)*0.002)
     
    plot(SAR and sarChange56?na:prevSar56style=plot.style_linebroffset=-1color=outD_30<high?color.rgb(78238243100):color.rgb(78238243100), title="Kırılım-5"linewidth=1)


    plot(OSAR and outD_30 outD_30 natitle='Sar_5'color=#ff990000, style=plot.style_circles, linewidth=1)

    //sar_01
    //01Hr sar
    startD_60 input(0.05title="start"group="Parabolic SAR")
    incrementD_60 input(0.075title="Increment"group="Parabolic SAR")
    maximumD_60 input(0.35title="Maximum"group="Parabolic SAR")
     
    outD_60 request.security(syminfo.ticker"15"ta.sar(startD_60incrementD_60,maximumD_60))

    sarChange567 ta.change(outD_60<high)
     
    var 
    prevSar567 outD_60
     
    if(sarChange567)
        
    prevSar567 := outD_60[1] + ((outD_60[1]/100)*0.002)
     
    plot(SAR and sarChange567?na:prevSar567style=plot.style_linebroffset=-1color=outD_60<high?color.rgb(78238243100):color.rgb(78238243100), title="Kırılım-15"linewidth=1)



    plot(OSAR and outD_60 outD_60 natitle='Sar_15'color=#ff990000, style=plot.style_circles, linewidth=1)


    //sar_02
    //02Hr sar
    startD_120 input(0.05title="start"group="Parabolic SAR")
    incrementD_120 input(0.075title="Increment"group="Parabolic SAR")
    maximumD_120 input(0.35title="Maximum"group="Parabolic SAR")
     
    outD_120 request.security(syminfo.ticker"30"ta.sar(startD_120incrementD_120,maximumD_120))

    sarChange5678 ta.change(outD_120<high)
     
    var 
    prevSar5678 outD_120
     
    if(sarChange5678)
        
    prevSar5678 := outD_120[1] + ((outD_120[1]/100)*0.002)
     
    plot(SAR and sarChange5678?na:prevSar5678style=plot.style_linebroffset=-1color=outD_120<high?color.rgb(78238243100):color.rgb(78238243100), title="Kırılım-30"linewidth=1)


    plot(OSAR and outD_120 outD_120 natitle='Sar_30'color=#ff990000, style=plot.style_circles, linewidth=1)

    //sar_03
    //03Hr sar
    startD_180 input(0.05title="start"group="Parabolic SAR")
    incrementD_180 input(0.075title="Increment"group="Parabolic SAR")
    maximumD_180 input(0.35title="Maximum"group="Parabolic SAR")
     
    outD_180 request.security(syminfo.ticker"60"ta.sar(startD_180incrementD_180,maximumD_180))

    sarChange56789 ta.change(outD_180<high)
     
    var 
    prevSar56789 outD_180
     
    if(sarChange56789)
        
    prevSar56789 := outD_180[1] + ((outD_180[1]/100)*0.002)
     
    plot(SAR and sarChange56789?na:prevSar56789style=plot.style_linebroffset=-1color=outD_180<high?color.rgb(78238243100):color.rgb(78238243100), title="Kırılım-60"linewidth=1)


    plot(OSAR and outD_180 outD_180 natitle='Sar_60'color=#ff990000, style=plot.style_circles, linewidth=1) 
    bir ara stratejisini yazmak lazım.....

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

    //@version=5
    strategy("*"overlay truemax_lines_count 100max_labels_count 100format=format.price)

    //@version=5
    // User inputs
    prd22 input.int(defval=2title=' 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(highprd22prd22)
    float pl ta.pivotlow(lowprd22prd22)

    //plotshape(ph and show_pivots, style=shape.triangledown, location=location.abovebar, offset=-prd22, size=size.small)
    //plotshape(pl and show_pivots, style=shape.triangleup, location=location.belowbar, offset=-prd22, size=size.small)

    // 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 prd22)
        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 prd22)
        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 prd22 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 >= prd22
                        
    //label.new(ind1, high[bar_index - ind1], text='S', style=label.style_label_down, color=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 prd22 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 >= prd22
                        
    //label.new(ind1, low[bar_index - ind1], text='A', style=label.style_label_up, color=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)
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // 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(27'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.rgb(2558282100) : color.rgb(7617579100)

    //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(ghla"TR--@R"color=color44style=plot.style_circleslinewidth 3)  

    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © carefulCode53358
    //@version=5
    start1 input.float(title='Start'defval=0.1step=0.1)
    increment1 input.float(title='Increment'defval=0.1step=0.1)
    maximum1 input.float(title='Max Value'defval=1step=0.1)
    putlabel1 input(title='Put Labels'defval=false)
    colup1 input.color(title='Colors'defval=color.rgb(0230119100), inline='col')
    coldn1 input.color(title=''defval=color.rgb(2558282100), inline='col')

    int trend1 0
    float sar1 
    0.0
    float ep1 
    0.0
    float af1 
    0.0

    trend1 
    := nz(trend1[1])
    ep1 := nz(ep1[1])
    af1 := nz(af1[1])
    sar1 := sar1[1]

    if 
    trend1 == and not na(high[1])
        
    trend1 := high >= high[1] or low >= low[1] ? : -1
        sar1 
    := trend1 low[1] : high[1]
        
    ep1 := trend1 high[1] : low[1]
        
    af1 := start1
        af1
    else
        
    nextsar1 sar1
        
    if trend1 0
            
    if high[1] > ep1
                ep1 
    := high[1]
                
    af1 := math.min(maximum1af1 increment1)
                
    af1

            nextsar1 
    := sar1 af1 * (ep1 sar1)
            
    nextsar1 := math.min(math.min(low[1], low[2]), nextsar1)

            
    //Reversal
            
    if nextsar1 low
                trend1 
    := -1
                nextsar1 
    := ep1
                ep1 
    := low
                af1 
    := start1
                af1
        
    else
            if 
    low[1] < ep1
                ep1 
    := low[1]
                
    af1 := math.min(maximum1af1 increment1)
                
    af1

            nextsar1 
    := sar1 af1 * (ep1 sar1)
            
    nextsar1 := math.max(math.max(high[1], high[2]), nextsar1)

            
    //Reversal
            
    if nextsar1 high
                trend1 
    := 1
                nextsar1 
    := ep1
                ep1 
    := high
                af1 
    := start1
                af1
        sar1 
    := nextsar1
        sar1

    plot
    (sar1title='İV--@Ü'color=trend1 colup1 coldn1linewidth=1style=plot.style_line)

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

    if 
    ta.change(trend1) > and putlabel1
        label
    .new(bar_indexsar1text=str.tostring(math.round_to_mintick(sar1)), color=colup1style=label.style_label_upsize=size.small)
    if 
    ta.change(trend1) < and putlabel1
        label
    .new(bar_indexsar1text=str.tostring(math.round_to_mintick(sar1)), color=coldn1style=label.style_label_downsize=size.small)

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    start12 input.float(title='Start'defval=0step=0.1)
    increment12 input.float(title='Increment'defval=0.1step=0.1)
    maximum12 input.float(title='Max Value'defval=1step=0.1)
    putlabel12 input(title='Put Labels'defval=false)
    colup12 input.color(title='Colors'defval=color.rgb(0230119100), inline='col')
    coldn12 input.color(title=''defval=color.rgb(2558282100), inline='col')

    int trend12 0
    float sar12 
    0.0
    float ep12 
    0.0
    float af12 
    0.0

    trend12 
    := nz(trend12[1])
    ep12 := nz(ep12[1])
    af12 := nz(af12[1])
    sar12 := sar12[1]

    if 
    trend12 == and not na(high[1])
        
    trend1 := high >= high[1] or low >= low[1] ? : -1
        sar12 
    := trend12 low[1] : high[1]
        
    ep12 := trend12 high[1] : low[1]
        
    af12 := start12
        af12
    else
        
    nextsar12 sar12
        
    if trend12 0
            
    if high[1] > ep12
                ep12 
    := high[1]
                
    af12 := math.min(maximum12af12 increment12)
                
    af12

            nextsar12 
    := sar12 af12 * (ep12 sar12)
            
    nextsar12 := math.min(math.min(low[1], low[2]), nextsar12)

            
    //Reversal
            
    if nextsar12 low
                trend12 
    := -1
                nextsar12 
    := ep12
                ep12 
    := low
                af12 
    := start12
                af12
        
    else
            if 
    low[1] < ep12
                ep12 
    := low[1]
                
    af12 := math.min(maximum12af12 increment12)
                
    af12

            nextsar12 
    := sar12 af12 * (ep12 sar12)
            
    nextsar12 := math.max(math.max(high[1], high[2]), nextsar12)

            
    //Reversal
            
    if nextsar12 high
                trend12 
    := 1
                nextsar12 
    := ep12
                ep12 
    := high
                af12 
    := start12
                af12
        sar12 
    := nextsar12
        sar12

    plot
    (sar12title='KV--@K'color=trend12 colup12 coldn12linewidth=1style=plot.style_line)

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

    if 
    ta.change(trend12) > and putlabel12
        label
    .new(bar_indexsar12text=str.tostring(math.round_to_mintick(sar12)), color=colup12style=label.style_label_upsize=size.small)
    if 
    ta.change(trend12) < and putlabel12
        label
    .new(bar_indexsar12text=str.tostring(math.round_to_mintick(sar12)), color=coldn12style=label.style_label_downsize=size.small)

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    start123 input.float(title='Start'defval=0step=0.1)
    increment123 input.float(title='Increment'defval=0.1step=0.1)
    maximum123 input.float(title='Max Value'defval=0.1step=0.1)
    putlabel123 input(title='Put Labels'defval=false)
    colup123 input.color(title='Colors'defval=color.rgb(0230119100), inline='col')
    coldn123 input.color(title=''defval=color.rgb(2558282100), inline='col')

    int trend123 0
    float sar123 
    0.0
    float ep123 
    0.0
    float af123 
    0.0

    trend123 
    := nz(trend123[1])
    ep123 := nz(ep123[1])
    af123 := nz(af123[1])
    sar123 := sar123[1]

    if 
    trend123 == and not na(high[1])
        
    trend123 := high >= high[1] or low >= low[1] ? : -1
        sar123 
    := trend123 low[1] : high[1]
        
    ep123 := trend123 high[1] : low[1]
        
    af123 := start123
        af123
    else
        
    nextsar123 sar123
        
    if trend123 0
            
    if high[1] > ep123
                ep123 
    := high[1]
                
    af123 := math.min(maximum123af123 increment123)
                
    af123

            nextsar123 
    := sar123 af123 * (ep123 sar123)
            
    nextsar123 := math.min(math.min(low[1], low[2]), nextsar123)

            
    //Reversal
            
    if nextsar123 low
                trend123 
    := -1
                nextsar123 
    := ep123
                ep123 
    := low
                af123 
    := start123
                af123
        
    else
            if 
    low[1] < ep123
                ep123 
    := low[1]
                
    af123 := math.min(maximum123af123 increment123)
                
    af123

            nextsar123 
    := sar123 af123 * (ep123 sar123)
            
    nextsar123 := math.max(math.max(high[1], high[2]), nextsar123)

            
    //Reversal
            
    if nextsar123 high
                trend123 
    := 1
                nextsar123 
    := ep123
                ep123 
    := high
                af123 
    := start123
                af123
        sar123 
    := nextsar123
        sar123

    plot
    (sar123title='OV--@Ö'color=trend123 colup123 coldn123linewidth=1style=plot.style_line)

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

    if 
    ta.change(trend123) > and putlabel123
        label
    .new(bar_indexsar123text=str.tostring(math.round_to_mintick(sar123)), color=colup123style=label.style_label_upsize=size.small)
    if 
    ta.change(trend123) < and putlabel123
        label
    .new(bar_indexsar123text=str.tostring(math.round_to_mintick(sar123)), color=coldn123style=label.style_label_downsize=size.small)

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    start1234 input.float(title='Start'defval=0step=0.1)
    increment1234 input.float(title='Increment'defval=0.01step=0.1)
    maximum1234 input.float(title='Max Value'defval=0.1step=0.1)
    putlabel1234 input(title='Put Labels'defval=false)
    colup1234 input.color(title='Colors'defval=color.rgb(0230119100), inline='col')
    coldn1234 input.color(title=''defval=color.rgb(2558282100), inline='col')

    int trend1234 0
    float sar1234 
    0.0
    float ep1234 
    0.0
    float af1234 
    0.0

    trend1234 
    := nz(trend1234[1])
    ep1234 := nz(ep1234[1])
    af1234 := nz(af1234[1])
    sar1234 := sar1234[1]

    if 
    trend1234 == and not na(high[1])
        
    trend1234 := high >= high[1] or low >= low[1] ? : -1
        sar1234 
    := trend1234 low[1] : high[1]
        
    ep1234 := trend1234 high[1] : low[1]
        
    af1234 := start1234
        af1234
    else
        
    nextsar1234 sar1234
        
    if trend1234 0
            
    if high[1] > ep1234
                ep1234 
    := high[1]
                
    af1234 := math.min(maximum1234af1234 increment1234)
                
    af1234

            nextsar1234 
    := sar1234 af1234 * (ep1234 sar1234)
            
    nextsar1234 := math.min(math.min(low[1], low[2]), nextsar1234)

            
    //Reversal
            
    if nextsar1234 low
                trend1234 
    := -1
                nextsar1234 
    := ep1234
                ep1234 
    := low
                af1234 
    := start1234
                af1234
        
    else
            if 
    low[1] < ep1234
                ep1234 
    := low[1]
                
    af1234 := math.min(maximum1234af1234 increment1234)
                
    af1234

            nextsar1234 
    := sar1234 af1234 * (ep1234 sar1234)
            
    nextsar1234 := math.max(math.max(high[1], high[2]), nextsar1234)

            
    //Reversal
            
    if nextsar1234 high
                trend1234 
    := 1
                nextsar1234 
    := ep1234
                ep1234 
    := high
                af1234 
    := start1234
                af1234
        sar1234 
    := nextsar1234
        sar1234

    plot
    (sar1234title='UV--@Y'color=trend1234 colup1234 coldn1234linewidth=1style=plot.style_line)

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

    if 
    ta.change(trend1234) > and putlabel1234
        label
    .new(bar_indexsar1234text=str.tostring(math.round_to_mintick(sar1234)), color=colup1234style=label.style_label_upsize=size.small)
    if 
    ta.change(trend1234) < and putlabel1234
        label
    .new(bar_indexsar123text=str.tostring(math.round_to_mintick(sar1234)), color=coldn1234style=label.style_label_downsize=size.small)

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

    //@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=false)
    colup input.color(title='Colors'defval=color.rgb(22364251100), inline='col')
    coldn input.color(title=''defval=color.rgb(22364251100), 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='Yörük'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.small)
    if 
    ta.change(trend) < and putlabel
        label
    .new(bar_indexsartext=str.tostring(math.round_to_mintick(sar)), color=coldnstyle=label.style_label_downsize=size.small)

    ////////////////////////////////////////////////////////
    // 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"--Stop--"style=plot.style_linecolor=#ffeb3b00)
    ////////////////////////////////////////

    length7=(1)
    src7=close
    start17 
    input(0.1)
    increment17 input(0.1)
    maximum17 input(1"Max Value")
    out17 ta.sar(start17increment17maximum17)

    momo1 src7 src7[length7]

    smdo1 out17 momo1

    plot
    (smdo1"---DD---"style=plot.style_linecolor=color.rgb(255255255100))
    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    changebarcol input.bool(truetitle='Change Bar Color'inline='bcol')
    bcolup input.color(color.limetitle=''inline='bcol')
    bcoldn input.color(color.redtitle=''inline='bcol')

    var 
    color lastBarColor na

    // BACAP 21 EMA TREND
    //Linesize = input.int(3, title='Line Size', minval=1)
    BullishColor input.color(color.lime)
    BearishColor input.color(color.red)


    // Determine the color based on 21 DEMA Trend
    barColorBasedOnDEMATrend close sar1 and close sar12 and close sar and close ghla  BullishColor close sar1 and close sar12 and close sar and close ghla   BearishColor nz(lastBarColor[1])

    // Change bar color
    lastBarColor := barColorBasedOnDEMATrend
    barcolor
    (color=changebarcol barColorBasedOnDEMATrend na)

    ta.crossover(close,sar) and ta.crossover(close,sar1) and ta.crossover(close,sar12) and ta.crossover(close,ghla) and ta.crossover(close,scma) and ta.crossover(close,smdo1
    ta.crossunder(close,sar) and ta.crossunder(close,sar1) and ta.crossunder(close,sar12) and ta.crossunder(close,ghla) and ta.crossunder(close,scma) and ta.crossunder(close,smdo1)
    in_b ta.barssince(x)[1] < ta.barssince(y)[1]
    in_s ta.barssince(y)[1] < ta.barssince(x)[1]


    if 
    x
        strategy
    .entry("Long",strategy.long)
    if 
    y
        strategy
    .close("Long")

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

    //@version=5
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Tooltips {
    string t1 "The candle lookback length refers to the number of bars, starting from the current one, that will be examined in order to find a similar event in the past."
    string t2 "The amount of Forecast candles that should be displayed in the future."
    string t3 "Background color divider between price and forecast."
    string t4 "Displays the current events found"
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Inputs {
    Series   input.int(1,"Candle Series",1,20,tooltip=t1)
    Forecast input.int(166,"Forecast Candles",1,166,tooltip=t2)
    Divider  input.bool(true,"Forecast Divider",t3)
    Display  input.bool(true,"Display Event",t4)
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Types {
    type Event
        box currentEvent
        box pastEvent
        box prediction
        
    array<box>  candle
        
    array<linewick
    type Data
        
    array<int>   
        
    array<int>   d
        
    array<floato
        
    array<floath
        
    array<floatl
        
    array<floatc
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Variables & Arrays {
    bar_index
    var data  Data.new(array.new<int>(),
                         array.new<
    int>(),
                         array.new<
    float>(),
                         array.new<
    float>(),
                         array.new<
    float>(),
                         array.new<
    float>())
    var 
    event Event.new(box.new(na,na,na,na,chart.fg_color,border_style=line.style_dashed,bgcolor=color(na)),
                         
    box.new(na,na,na,na,chart.fg_color,border_style=line.style_dashed,bgcolor=color(na)),
                         
    box.new(na,na,na,na,chart.fg_color,border_style=line.style_dotted,
                          
    bgcolor=color.new(color.teal,75)),
                         array.new<
    box>(Forecast),
                         array.new<
    line>(Forecast))
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Methods {
    //Store Data
    method Store(Data x)=>
        
    int   B b
        int bin 
    close>open?1:close<open?-1:0
        float O 
    open
        float H 
    high
        float L 
    low
        float C 
    close
        x
    .b.unshift(B)
        
    x.d.unshift(bin)
        
    x.o.unshift(O)
        
    x.h.unshift(H)
        
    x.l.unshift(L)
        
    x.c.unshift(C)

    //Candle Plots
    method Candle(Event e,x,i)=>
        
    int dist   1
        float prev 
    x.c.get(i)
        
    float diff = ((close-prev)/prev)+1
        
    for j=i-1 to i-Forecast
            idx 
    j-i+Forecast
            
    if j<0
                
    break
            else
                
    pos x.d.get(j)
                
    top = (pos>0?x.c.get(j):x.o.get(j))*diff
                bot 
    = (pos>0?x.o.get(j):x.c.get(j))*diff
                hi  
    = (x.h.get(j))*diff
                lo  
    = (x.l.get(j))*diff
                col 
    pos==1?#26a69a:pos==-1?#ef5350:chart.fg_color
                
    candle e.candle.get(idx)
                if 
    na(candle)
                    
    e.candle.set(idx,box.new(b+dist,top,b+dist+2,bot,na,bgcolor=col))
                    
    e.wick.set(idx,line.new(b+dist+1,hi,b+dist+1,lo,color=col))
                else
                    
    box.set_lefttop(e.candle.get(idx),b+dist,top)
                    
    box.set_rightbottom(e.candle.get(idx),b+dist+2,bot)
                    
    box.set_bgcolor(e.candle.get(idx),col)
                    
    line.set_xy1(e.wick.get(idx),b+dist+1,hi)
                    
    line.set_xy2(e.wick.get(idx),b+dist+1,lo)
                    
    line.set_color(e.wick.get(idx),col)
            
    dist += 3

    //Events Display
    method Events(Event e,idx,h1,l1,h2,l2,fh,fl)=>
        
    int start idx.get(Series-1)
        
    int end   idx.get(0)
        
    e.currentEvent.set_lefttop(b-Series+1,h1.max())
        
    e.currentEvent.set_rightbottom(b,l1.min())
        
    e.pastEvent.set_lefttop(start,h2.max())
        
    e.pastEvent.set_rightbottom(end,l2.min())
        
    e.prediction.set_lefttop(end+1,fh.max())
        
    e.prediction.set_rightbottom(math.min(b,end+Forecast),fl.min())

    //Current Event
    method Series(Data x)=>
        
    data.Store()
        
    bool found false
        
    if barstate.islast
            events 
    x.d.slice(0,Series)
            for 
    i=Series to x.d.size()-Series
                elements 
    x.d.slice(i,i+Series)
                
    equal 0
                
    for [k,thisin elements
                    
    if this==events.get(k)
                        
    equal += 1
                
    if equal==Series
                    found 
    := true
                    event
    .Candle(data,i)
                    if 
    Display
                        bar 
    x.b.slice(i,i+Series)
                        
    h1  x.h.slice(0,Series)
                        
    l1  x.l.slice(0,Series)
                        
    h2  x.h.slice(i,i+Series)
                        
    l2  x.l.slice(i,i+Series)
                        
    fh  i-Forecast<0?x.h.slice(0,i-1):x.h.slice(i-Forecast,i-1)
                        
    fl  i-Forecast<0?x.l.slice(0,i-1):x.l.slice(i-Forecast,i-1)
                        
    event.Events(bar,h1,l1,h2,l2,fh,fl)
                    break
        if 
    barstate.islast and not found
            runtime
    .error("Couldn't find similar candle series event. \nFix: Decrease Candle Series length")
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Divider {
    //bgcolor(Divider and barstate.islast?color.new(chart.fg_color,80):na,1)
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    //~~ Run Code {
    data.Series()
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

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

    //@version=5

    //SAR

    SAR input(truetitle='*')
    OSAR input(truetitle='Other Time frame SAR')


    start88 input(0.05title="start"group="Parabolic SAR")
    increment88 input(0.075title="Increment"group="Parabolic SAR")
    maximum88 input(0.35title="Maximum"group="Parabolic SAR")
     
    out88 ta.sar(start88increment88maximum88)
     
    sarChange ta.change(out88<high)
     
    var 
    prevSar out88
     
    if(sarChange)
        
    prevSar := out88[1] + ((out88[1]/100)*0.002)
     
    plot(SAR and sarChange?na:prevSarstyle=plot.style_linebroffset=-1color=out88<high?color.green:color.redtitle="Kırılım"linewidth=1)
    plot(SAR and out88 out88 natitle='Sar-Trend'color=#ff990000, style=plot.style_circles, linewidth=2)
     

    //sar_15
    //15min sar
    startD_15 input(0.05title="start"group="Parabolic SAR")
    incrementD_15 input(0.075title="Increment"group="Parabolic SAR")
    maximumD_15 input(0.35title="Maximum"group="Parabolic SAR")
    outD_15 request.security(syminfo.ticker"1"ta.sar(startD_15incrementD_15,maximumD_15))
    sarChange5 ta.change(outD_15<high
    var 
    prevSar5 outD_15
     
    if(sarChange5)
        
    prevSar5 := outD_15[1] + ((outD_15[1]/100)*0.002)
     
    plot(SAR and sarChange5?na:prevSar5style=plot.style_linebroffset=-1color=outD_15<high?color.rgb(78238243100):color.rgb(78238243100), title="Kırılım-1"linewidth=1)
    plot(OSAR and outD_15 outD_15 natitle='Sar_1'color=#ff990000, style=plot.style_circles, linewidth=1)

    //sar_30
    //30min sar
    startD_30 input(0.05title="start"group="Parabolic SAR")
    incrementD_30 input(0.075title="Increment"group="Parabolic SAR")
    maximumD_30 input(0.35title="Maximum"group="Parabolic SAR")
     
    outD_30 request.security(syminfo.ticker"5"ta.sar(startD_30incrementD_30,maximumD_30))
    sarChange56 ta.change(outD_30<high
    var 
    prevSar56 outD_30
     
    if(sarChange56)
        
    prevSar56 := outD_30[1] + ((outD_30[1]/100)*0.002)
     
    plot(SAR and sarChange56?na:prevSar56style=plot.style_linebroffset=-1color=outD_30<high?color.rgb(78238243100):color.rgb(78238243100), title="Kırılım-5"linewidth=1)
    plot(OSAR and outD_30 outD_30 natitle='Sar_5'color=#ff990000, style=plot.style_circles, linewidth=1)

    //sar_01
    //01Hr sar
    startD_60 input(0.05title="start"group="Parabolic SAR")
    incrementD_60 input(0.075title="Increment"group="Parabolic SAR")
    maximumD_60 input(0.35title="Maximum"group="Parabolic SAR")
     
    outD_60 request.security(syminfo.ticker"15"ta.sar(startD_60incrementD_60,maximumD_60))
    sarChange567 ta.change(outD_60<high
    var 
    prevSar567 outD_60
     
    if(sarChange567)
        
    prevSar567 := outD_60[1] + ((outD_60[1]/100)*0.002)
     
    plot(SAR and sarChange567?na:prevSar567style=plot.style_linebroffset=-1color=outD_60<high?color.rgb(78238243100):color.rgb(78238243100), title="Kırılım-15"linewidth=1)
    plot(OSAR and outD_60 outD_60 natitle='Sar_15'color=#ff990000, style=plot.style_circles, linewidth=1)


    //sar_02
    //02Hr sar
    startD_120 input(0.05title="start"group="Parabolic SAR")
    incrementD_120 input(0.075title="Increment"group="Parabolic SAR")
    maximumD_120 input(0.35title="Maximum"group="Parabolic SAR")
     
    outD_120 request.security(syminfo.ticker"30"ta.sar(startD_120incrementD_120,maximumD_120))

    sarChange5678 ta.change(outD_120<high
    var 
    prevSar5678 outD_120
    if(sarChange5678)
        
    prevSar5678 := outD_120[1] + ((outD_120[1]/100)*0.002)
     
    plot(SAR and sarChange5678?na:prevSar5678style=plot.style_linebroffset=-1color=outD_120<high?color.rgb(78238243100):color.rgb(78238243100), title="Kırılım-30"linewidth=1)
    plot(OSAR and outD_120 outD_120 natitle='Sar_30'color=#ff990000, style=plot.style_circles, linewidth=1)

    //sar_03
    //03Hr sar
    startD_180 input(0.05title="start"group="Parabolic SAR")
    incrementD_180 input(0.075title="Increment"group="Parabolic SAR")
    maximumD_180 input(0.35title="Maximum"group="Parabolic SAR")
     
    outD_180 request.security(syminfo.ticker"60"ta.sar(startD_180incrementD_180,maximumD_180))
    sarChange56789 ta.change(outD_180<high
    var 
    prevSar56789 outD_180
     
    if(sarChange56789)
        
    prevSar56789 := outD_180[1] + ((outD_180[1]/100)*0.002)
     
    plot(SAR and sarChange56789?na:prevSar56789style=plot.style_linebroffset=-1color=outD_180<high?color.rgb(78238243100):color.rgb(78238243100), title="Kırılım-60"linewidth=1)
    plot(OSAR and outD_180 outD_180 natitle='Sar_60'color=#ff990000, style=plot.style_circles, linewidth=1)

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


Sayfa 196/308 İlkİlk ... 96146186194195196197198206246296 ... 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
  •