Sayfa 371/438 İlkİlk ... 271321361369370371372373381421 ... SonSon
Arama sonucu : 3502 madde; 2,961 - 2,968 arası.

Konu: Gold Rush

  1.  Alıntı Originally Posted by Dore Yazıyı Oku
    İlk müsait oldupum anda inceleyeceğim paylaşımlarınız..

    Teşkkürler Sn Yörük
    eyvallah...inş....işine yarar bir şeyler çıkar....

    eski çalışmalarım ve yenileri....
    buraya yedekleyerek paylaşacağım.....
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.

  2. zig zag temelli....
    pivot mantığıyla...olası destek ve dirençleri çizen kod.....
    PHP Code:
     // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © HeWhoMustNotBeNamed
    //                                       ░▒             
    //                                  ▒▒▒   ▒▒      
    //                              ▒▒▒▒▒     ▒▒      
    //                      ▒▒▒▒▒▒▒░     ▒     ▒▒          
    //                  ▒▒▒▒▒▒           ▒     ▒▒          
    //             ▓▒▒▒       ▒        ▒▒▒▒▒▒▒▒▒▒▒  
    //   ▒▒▒▒▒▒▒▒▒▒▒ ▒        ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒         
    //   ▒  ▒       ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░        
    //   ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒         
    //   ▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒                       
    //    ▒▒▒▒▒         ▒▒▒▒▒▒▒                            
    //                 ▒▒▒▒▒▒▒▒▒                           
    //                ▒▒▒▒▒ ▒▒▒▒▒                          
    //               ░▒▒▒▒   ▒▒▒▒▓      ████████╗██████╗ ███████╗███╗   ██╗██████╗  ██████╗ ███████╗ ██████╗ ██████╗ ██████╗ ███████╗
    //              ▓▒▒▒▒     ▒▒▒▒      ╚══██╔══╝██╔══██╗██╔════╝████╗  ██║██╔══██╗██╔═══██╗██╔════╝██╔════╝██╔═══██╗██╔══██╗██╔════╝
    //              ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒        ██║   ██████╔╝█████╗  ██╔██╗ ██║██║  ██║██║   ██║███████╗██║     ██║   ██║██████╔╝█████╗ 
    //             ▒▒▒▒▒       ▒▒▒▒▒       ██║   ██╔══██╗██╔══╝  ██║╚██╗██║██║  ██║██║   ██║╚════██║██║     ██║   ██║██╔═══╝ ██╔══╝  
    //            ▒▒▒▒▒         ▒▒▒▒▒      ██║   ██║  ██║███████╗██║ ╚████║██████╔╝╚██████╔╝███████║╚██████╗╚██████╔╝██║     ███████╗
    //             ▒▒             ▒                        
    //@version=5
    indicator("Next Pivot Projection [Trendoscope]""NPP[Trendoscope]"overlay=truemax_lines_count 500max_labels_count 500)
    import HeWhoMustNotBeNamed/mZigzag/12 as zg
    import HeWhoMustNotBeNamed
    /enhanced_ta/14 as eta
    import HeWhoMustNotBeNamed
    /arrays/as pa
    length 
    input.int(8'Length'group='Zigzag'display display.none)
    oscillatorType input.string("rsi"title="Oscillator"inline="osc"options=["cci""cmo""cog""mfi""roc""rsi"],
                         
    group='Oscillator'display display.none)
    oscLength input.int(14title=""inline="osc"group='Oscillator'display display.none)
    supertrendLength input.int(5'History'inline='st'group='Supertrend'display display.none)
    drawSupertrend input.bool(false"Draw Zigzag Supertrend"inline='st2'group='Supertrend'display display.none)

    showTable input.bool(false'Detailed Stats'inline='txt'group 'Stats and Display'display display.none)
    txtSize input.string(size.tiny'', [size.tinysize.smallsize.normalsize.largesize.huge],
                             
    inline='txt'group 'Stats and Display'display display.none)
    txtColor input.color(color.white''inline='txt'group 'Stats and Display'display display.none)

    showPivotLines input.bool(true'Pivot Lines'inline='pli'group 'Stats and Display'display display.none)
    showPivotLabel input.bool(false'Pivot Label'inline='pla'group 'Stats and Display'display display.none)
    fillAreas input.bool(true'Fill Bullish/Bearish Sentiments'inline='fil'group 'Stats and Display'display display.none)
    increment(mtxrowcolval=1)=>matrix.set(mtxrowcolmatrix.get(mtxrowcol)+val)
    gettrendindex(int priceint oscint trend)=>
        
    trendFactor trend 1
        priceFactor 
    math.abs(price) > 10
        oscFactor 
    math.abs(osc) > 10
        trendFactor
    *priceFactor*oscFactor


    getSentimentDetails
    (pDiroDirsDir) =>
        
    sentiment pDir == oDir sDir == pDir or sDir == -pDir ? -sDir sDir sDir == pDir or sDir == -oDir : (math.abs(oDir) > math.abs(pDir) ? sDir : -sDir) * (sDir == oDir 3)
        
    sentimentSymbol sentiment == '⬆' sentiment == -'⬇' sentiment == '↗' sentiment == -'↘' sentiment == '⤴' sentiment == -'⤵' sentiment == '⤒' sentiment == -'⤓' '▣'
        
    sentimentColor sentiment == color.green sentiment == -color.red sentiment == color.lime sentiment == -color.orange sentiment == color.rgb(202224130) : sentiment == -color.rgb(2501281140) : color.silver
        sentimentLabel 
    math.abs(sentiment) == 'C' math.abs(sentiment) == 'H' math.abs(sentiment) == 'D' 'I'
        
    [sentimentSymbolsentimentLabelsentimentColor]


    getStatus(int trendIndexint pivotDir)=>
        
    trendFactor int(trendIndex/4)
        
    remainder trendIndex 4
        priceFactor 
    int(remainder/2)+1
        oscFactor 
    = (remainder 2)+1
        trendChar 
    = (trendFactor == 0)? 'U' 'D'
        
    priceChar pivotDir 0? (priceFactor == 2'HH' 'LH') : (priceFactor == 2'LL' 'HL')
        
    oscChar pivotDir 0? (oscFactor == 2'HH' 'LH') : (oscFactor == 2'LL' 'HL')
        
    trendChar ' - ' priceChar '/'+oscChar

    draw_zg_line
    (idx1idx2zigzaglineszigzaglabelsvalueMatrixdirectionMatrixratioMatrix,  divergenceMatrixdoubleDivergenceMatrix,
                                             
    barArraytrendArraylineColorlineWidthlineStyle) =>
        if 
    matrix.rows(valueMatrix) > 2
            idxLen1 
    matrix.rows(valueMatrix)-idx1
            idxLen2 
    matrix.rows(valueMatrix)-idx2
            lastValues 
    matrix.row(valueMatrixidxLen1)
            
    llastValues matrix.row(valueMatrixidxLen2)
            
            
    lastDirections matrix.row(directionMatrixidxLen1)
            
    lastRatios matrix.row(ratioMatrixidxLen1)
            
    lastDivergence matrix.row(divergenceMatrixidxLen1)
            
    lastDoubleDivergence matrix.row(doubleDivergenceMatrixidxLen1)

            
    y1 = array.get(lastValues0)
            
    y2 = array.get(llastValues0)
            
    x1 = array.get(barArrayidxLen1)
            
    x2 = array.get(barArrayidxLen2)
            
    zline line.new(x1=x1y1=y1x2=x2y2=y2color=lineColorwidth=lineWidthstyle=lineStyle)
            
    currentDir y1 y2: -1
            
            priceDir 
    = array.get(lastDirections0)
            
    oscDir = array.get(lastDirections1)
            
    trendDir = array.get(trendArrayidxLen1)
            
    trendIndex gettrendindex(priceDiroscDirtrendDir)
            
    trendLabel getStatus(trendIndexcurrentDir)
            [
    sentimentSymbolsentimentLabelsentimentColor] = getSentimentDetails(priceDiroscDirtrendDir)

            
    labelStyle currentDir 0label.style_label_down label.style_label_up
            zlabel 
    showPivotLabel label.new(x=x1y=y1yloc=yloc.pricecolor=sentimentColorstyle=labelStyletext=sentimentSymbol ' ' trendLabel
                                         
    textcolor=color.blacksize size.smalltooltip=sentimentLabel) : na
            
    if array.size(zigzaglines) > 0
                lastLine 
    = array.get(zigzaglines, array.size(zigzaglines)-1)
                if 
    line.get_x2(lastLine) == x2 and line.get_x1(lastLine) <= x1
                    pa
    .pop(zigzaglines)
                    
    pa.pop(zigzaglabels)
            
            
    pa.push(zigzaglineszline500)
            
    pa.push(zigzaglabelszlabel500)

    draw(matrix<floatvalueMatrixmatrix<intdirectionMatrixmatrix<floatratioMatrix,  matrix<intdivergenceMatrixmatrix<intdoubleDivergenceMatrix, array<intbarArray, array<inttrendArray,
                     
    bool newZGbool doubleZGcolor lineColor color.blueint lineWidth 1string lineStyle line.style_solid)=>
        var 
    zigzaglines = array.new_line(0)
        var 
    zigzaglabels = array.new_label(0)
        if(
    newZG)
            if 
    doubleZG
                draw_zg_line
    (23zigzaglineszigzaglabelsvalueMatrixdirectionMatrixratioMatrixdivergenceMatrixdoubleDivergenceMatrixbarArraytrendArray,
                                 
    lineColorlineWidthlineStyle)

            if 
    matrix.rows(valueMatrix) >= 2
                draw_zg_line
    (12zigzaglineszigzaglabelsvalueMatrixdirectionMatrixratioMatrix,  divergenceMatrixdoubleDivergenceMatrixbarArraytrendArray,
                                 
    lineColorlineWidthlineStyle)
        [
    valueMatrixdirectionMatrixratioMatrixdivergenceMatrixdoubleDivergenceMatrixbarArrayzigzaglineszigzaglabels]

        

    indicatorHigh = array.new_float()
    indicatorLow = array.new_float()
    indicatorLabels = array.new_string()

    [
    oscHigh__] = eta.oscillator(oscillatorTypeoscLengthoscLengthoscLengthhigh)
    [
    oscLow__] = eta.oscillator(oscillatorTypeoscLengthoscLengthoscLengthlow)
    array.
    push(indicatorHighmath.round(oscHigh,2))
    array.
    push(indicatorLowmath.round(oscLow,2))
    array.
    push(indicatorLabelsoscillatorType+str.tostring(oscLength))


    [
    valueMatrixdirectionMatrixratioMatrixdivergenceMatrixdoubleDivergenceMatrixbarArraytrendArraysupertrendDirsupertrendnewZGdoubleZG] = 
                                                             
    zg.calculate(length, array.from(highlow), indicatorHighindicatorLowsupertrendLength supertrendLength)

    nextDirection matrix.rows(directionMatrix) > 0matrix.row(directionMatrixmatrix.rows(directionMatrix)-1) : array.new_int()
    lastDirection matrix.rows(directionMatrix) > 1matrix.row(directionMatrixmatrix.rows(directionMatrix)-2) : array.new_int()
    llastDirection matrix.rows(directionMatrix) > 2matrix.row(directionMatrixmatrix.rows(directionMatrix)-3) : array.new_int()
    lllastDirection matrix.rows(directionMatrix) > 3matrix.row(directionMatrixmatrix.rows(directionMatrix)-4) : array.new_int()

    var 
    pivotHighStats matrix.new<int>(6430)
    var 
    pivotLowStats matrix.new<int>(6430)

    var 
    pivotHighRatios matrix.new<float>(6430)
    var 
    pivotLowRatios matrix.new<float>(6430)

    var 
    pivotHighBars matrix.new<float>(6430)
    var 
    pivotLowBars matrix.new<float>(6430)

    currentTotalTrendIndex 0
    nextTotalTrendIndex 
    0
    currentDir 
    matrix.rows(directionMatrix) > 0matrix.get(directionMatrixmatrix.rows(directionMatrix)-10) : 0

    currentPDir 
    lastDirection.size() > lastDirection.first() : na
    changePriceDirection 
    ta.change(math.sign(currentPDir))
    if(array.
    size(lllastDirection) > 0)
        
    priceDirection = array.get(lastDirection0)
        
    priceRatio matrix.get(ratioMatrixmatrix.rows(ratioMatrix)-20)

        
    numberOfBars = array.get(barArray, array.size(barArray)-2) - array.get(barArray, array.size(barArray)-3)
        
    currentPriceDirection = array.get(lastDirection0)
        
    currentOscDirection = array.get(lastDirection1)
        
    currentTrend = array.get(trendArray, array.size(trendArray)-2)

        
    nextPriceDirection = array.get(nextDirection0)
        
    nextOscDirection = array.get(nextDirection1)
        
    nextTrend = array.get(trendArray, array.size(trendArray)-1)

        
    lastPriceDirection = array.get(llastDirection0)
        
    lastOscDirection = array.get(llastDirection1)
        
    lastTrend = array.get(trendArray, array.size(trendArray)-3)

        
    llastPriceDirection = array.get(lllastDirection0)
        
    llastOscDirection = array.get(lllastDirection1)
        
    llastTrend = array.get(trendArray, array.size(trendArray)-4)

        
    colLast math.abs(priceDirection) %2

        nextTrendIndex 
    gettrendindex(nextPriceDirectionnextOscDirectionnextTrend)
        
    currentTrendIndex gettrendindex(currentPriceDirectioncurrentOscDirectioncurrentTrend)
        
    lastTrendIndex gettrendindex(lastPriceDirectionlastOscDirectionlastTrend)
        
    llastTrendIndex gettrendindex(llastPriceDirectionllastOscDirectionllastTrend)

        
    totalIndex lastTrendIndex*llastTrendIndex
        currentTotalTrendIndex 
    := currentTrendIndex*lastTrendIndex
        nextTotalTrendIndex 
    := nextTrendIndex*currentTrendIndex

        matrixToSet 
    math.sign(priceDirection) > 0pivotHighStats pivotLowStats
        ratioMatrixToSet 
    math.sign(priceDirection) > 0pivotHighRatios pivotLowRatios
        barMatrixToSet 
    math.sign(priceDirection) > 0pivotHighBars pivotLowBars

        
    if(not na(currentPDir) and changePriceDirection != 0)
            
    increment(matrixToSettotalIndexcolLast)
            
    increment(ratioMatrixToSettotalIndexcolLastpriceRatio)
            
    increment(barMatrixToSettotalIndexcolLastnumberOfBars)

            
    increment(matrixToSettotalIndex2)
            
    increment(ratioMatrixToSettotalIndex2priceRatio)
            
    increment(barMatrixToSettotalIndex2numberOfBars)


    var 
    float hhValue na
    var float lhValue na

    var float llValue na
    var float hlValue na

    var float hhProbability na
    var float llProbability na

    var float htRatio na
    var float ltRatio na
    if(array.size(barArray) > 10)
        
    currentBar = array.get(barArray, array.size(barArray)-1)
        
    lastBar = array.get(barArray, array.size(barArray)-2)
        
    currentPrice matrix.get(valueMatrixmatrix.rows(valueMatrix)-10)
        
    lastPrice matrix.get(valueMatrixmatrix.rows(valueMatrix)-20)
        
    llastPrice matrix.get(valueMatrixmatrix.rows(valueMatrix)-30)
        
    startRow 2
        
    var statsTable showTable table.new(position=position.top_rightcolumns=10rows=64+startRowborder_color color.blackborder_width 2) : na
        
        phSortIndices 
    = array.sort_indices(matrix.col(pivotHighStats2), order.descending)
        
        
    phColStart currentDir 5
        
        
    if(showTable)
            
    table.clear(statsTable00964+startRow-1)
            
    table.cell(statsTablephColStart0'Pivot High Projection'text_color txtColortext_size txtSizebgcolor color.maroon)
            
    table.cell(statsTablephColStart1'Last Two Pivots'text_color txtColortext_size txtSizebgcolor color.maroon)
            
    table.cell(statsTablephColStart+21'HH'text_color txtColortext_size txtSizebgcolor color.maroon)
            
    table.cell(statsTablephColStart+31'LH'text_color txtColortext_size txtSizebgcolor color.maroon)
            
    table.cell(statsTablephColStart+41'T'text_color txtColortext_size txtSizebgcolor color.maroon)
            
    table.merge_cells(statsTablephColStart0phColStart+40)
            
    table.merge_cells(statsTablephColStart1phColStart+11)

        
    hlr startRow
        
    for i=0 to 63
            si 
    = array.get(phSortIndicesi)
            
    lastTrendIndex int(si/8)
            
    llastTrendIndex si%8

            lastPivotStatus 
    getStatus(lastTrendIndex, -1)
            
    llastPivotStatus getStatus(llastTrendIndex1)
            
    hhStats matrix.get(pivotHighStatssi0)
            
    lhStats matrix.get(pivotHighStatssi1)
            
    tStats matrix.get(pivotHighStatssi2)

            
    hhRatio math.round(matrix.get(pivotHighRatiossi0)/hhStats3)
            
    lhRatio math.round(matrix.get(pivotHighRatiossi1)/lhStats3)
            
    tRatio math.round(matrix.get(pivotHighRatiossi2)/tStats3)

            
    hhBars math.round(matrix.get(pivotHighBarssi0)/hhStats)
            
    lhBars math.round(matrix.get(pivotHighBarssi1)/lhStats)
            
    tBars math.round(matrix.get(pivotHighBarssi2)/tStats)
            
    highlight math.sign(currentDir) < nextTotalTrendIndex == si  currentTotalTrendIndex == si

            hhTooltip 
    'Average Ratio - '+str.tostring(hhRatio)+'\n'+'Average Bars - '+str.tostring(hhBars)
            
    lhTooltip 'Average Ratio - '+str.tostring(lhRatio)+'\n'+'Average Bars - '+str.tostring(lhBars)
            
    tTooltip 'Average Ratio - '+str.tostring(tRatio)+'\n'+'Average Bars - '+str.tostring(tBars)

            if(
    highlight)
                var 
    line hhLine na
                
    var line lhLine na
                
    var line tLine na
                
    var label hhLabel na
                
    var label lhLabel na
                
    var label tLabel na

                line
    .delete(hhLine)
                
    line.delete(lhLine)
                
    line.delete(tLine)
                
    label.delete(hhLabel)
                
    label.delete(lhLabel)
                
    label.delete(tLabel)
                
                
    x1 math.sign(currentDir) < currentBar lastBar
                hhX2 
    x1 hhBars
                lhX2 
    x1 lhBars
                tX2 
    x1 tBars

                y1 
    math.sign(currentDir) < currentPrice lastPrice
                prev 
    math.sign(currentDir) < lastPrice llastPrice
                hhY2 
    math.round_to_mintick(y1 math.abs(y1-prev)*hhRatio)
                
    lhY2 math.round_to_mintick(y1 math.abs(y1-prev)*lhRatio)
                
    tY2 math.round_to_mintick(y1 math.abs(y1-prev)*tRatio)
                
    hhLine := line.new(x1y1hhX2hhY2xloc=xloc.bar_indexcolor=color.greenstyle=line.style_arrow_right)
                
    lhLine := line.new(x1y1lhX2lhY2xloc=xloc.bar_indexcolor=color.limestyle=line.style_arrow_right)
                
    tLine := line.new(x1y1tX2tY2xloc=xloc.bar_indexcolor=color.yellowstyle=line.style_arrow_right)

                
    hhPercent str.tostring(hhStats*100/tStatsformat.percent)
                
    lhPercent str.tostring(lhStats*100/tStatsformat.percent)
                
    hhText 'Number of Historical References :'+str.tostring(hhStats)+'/'+str.tostring(tStats)+
                             
    '\nProbability of Higher High :'+hhPercent+
                             
    '\nAverage Higher High Ratio :'+str.tostring(hhRatio) +
                             
    '\nAverage Higher High Bars :'+str.tostring(hhBars)
                
    lhText 'Number of Historical References :'+str.tostring(lhStats)+'/'+str.tostring(tStats)+
                             
    '\nProbability of Lower High :'+lhPercent+
                             
    '\nAverage Lower High Ratio :'+str.tostring(lhRatio) +
                             
    '\nAverage Lower High Bars :'+str.tostring(lhBars)
                
    tText 'Number of Historical References :'+str.tostring(tStats)+
                             
    '\nAverage Fib Ratio :'+str.tostring(tRatio)+
                             
    '\nAverage Bars :'+str.tostring(tBars)
                
    hhLabel := label.new(hhX2hhY2str.tostring(hhY2)+ ' - ' +hhPercentstyle=label.style_label_lower_leftcolor=color.new(color.green70), textcolor color.whitesize=size.smalltooltip=hhText)
                
    lhLabel := label.new(lhX2lhY2str.tostring(lhY2)+ ' - ' +lhPercentstyle=label.style_label_upper_leftcolor=color.new(color.lime70), textcolor color.whitesize=size.smalltooltip=lhText)
                
    tLabel := label.new(tX2tY2str.tostring(tY2)+ '@'+str.tostring(tRatio), style=label.style_label_leftcolor=color.new(color.yellow70), textcolor color.whitesize=size.smalltooltip=tText)
                
    hhValue := hhY2
                lhValue 
    := lhY2
                hhProbability 
    := hhStats*100/tStats
                htRatio 
    := tRatio

            
    if(hhStats != and lhStats != 0) and showTable
                table
    .cell(statsTablephColStarthlrllastPivotStatustext_color txtColortext_size txtSizebgcolor color.new(color.lime60))
                
    table.cell(statsTablephColStart+1hlrlastPivotStatustext_color txtColortext_size txtSizebgcolor color.new(color.orange60))
                
    table.cell(statsTablephColStart+2hlrstr.tostring(hhStats)+' - '+str.tostring(hhRatio), text_color txtColortext_size txtSizebgcolor color.new(color.greenhighlight 50 90), tooltip hhTooltip)
                
    table.cell(statsTablephColStart+3hlrstr.tostring(lhStats)+' - '+str.tostring(lhRatio), text_color txtColortext_size txtSizebgcolor color.new(color.redhighlight50 90), tooltip lhTooltip)
                
    table.cell(statsTablephColStart+4hlrstr.tostring(tStats)+' - '+str.tostring(tRatio), text_color txtColortext_size txtSizebgcolor color.from_gradient(hhStats/tStats01color.redcolor.green), tooltip tTooltip)
                
    hlr+=1


        plColStart 
    currentDir 5
        
    if(showTable)
            
    table.cell(statsTableplColStart0'Pivot Low Projection'text_color txtColortext_size txtSizebgcolor color.maroon)
            
    table.cell(statsTableplColStart1'Last Two Pivots'text_color txtColortext_size txtSizebgcolor color.maroon)
            
    table.cell(statsTableplColStart+21'LL'text_color txtColortext_size txtSizebgcolor color.maroon)
            
    table.cell(statsTableplColStart+31'HL'text_color txtColortext_size txtSizebgcolor color.maroon)
            
    table.cell(statsTableplColStart+41'T'text_color txtColortext_size txtSizebgcolor color.maroon)
            
    table.merge_cells(statsTableplColStart0plColStart+40)
            
    table.merge_cells(statsTableplColStart1plColStart+11)
        
    plSortIndices = array.sort_indices(matrix.col(pivotLowStats2), order.descending)

        
    llr startRow
        
    for i=0 to 63
            si 
    = array.get(plSortIndicesi)
            
    lastTrendIndex int(si/8)
            
    llastTrendIndex si%8

            lastPivotStatus 
    getStatus(lastTrendIndex1)
            
    llastPivotStatus getStatus(llastTrendIndex, -1)
            
    llStats matrix.get(pivotLowStatssi0)
            
    hlStats matrix.get(pivotLowStatssi1)
            
    tStats matrix.get(pivotLowStatssi2)

            
    llRatio math.round(matrix.get(pivotLowRatiossi0)/llStats3)
            
    hlRatio math.round(matrix.get(pivotLowRatiossi1)/hlStats3)
            
    tRatio math.round(matrix.get(pivotLowRatiossi2)/tStats3)

            
    llBars math.round(matrix.get(pivotLowBarssi0)/llStats)
            
    hlBars math.round(matrix.get(pivotLowBarssi1)/hlStats)
            
    tBars math.round(matrix.get(pivotLowBarssi2)/tStats)

            
    highlight math.sign(currentDir) > nextTotalTrendIndex== si  currentTotalTrendIndex  == si

            llTooltip 
    'Average Ratio - '+str.tostring(llRatio)+'\n'+'Average Bars - '+str.tostring(llBars)
            
    hlTooltip 'Average Ratio - '+str.tostring(hlRatio)+'\n'+'Average Bars - '+str.tostring(hlBars)
            
    tTooltip 'Average Ratio - '+str.tostring(tRatio)+'\n'+'Average Bars - '+str.tostring(tBars)

            if(
    highlight)
                var 
    line llLine na
                
    var line hlLine na
                
    var line tLine na

                
    var label llLabel na
                
    var label hlLabel na
                
    var label tLabel na

                line
    .delete(llLine)
                
    line.delete(hlLine)
                
    line.delete(tLine)

                
    label.delete(llLabel)
                
    label.delete(hlLabel)
                
    label.delete(tLabel)

                
    x1 math.sign(currentDir) > currentBar lastBar
                llX2 
    x1 llBars
                hlX2 
    x1 hlBars
                tX2 
    x1 tBars

                y1 
    math.sign(currentDir) > currentPrice lastPrice
                prev 
    math.sign(currentDir) > lastPrice llastPrice
                llY2 
    math.round_to_mintick(y1 math.abs(y1-prev)*llRatio)
                
    hlY2 math.round_to_mintick(y1 math.abs(y1-prev)*hlRatio)
                
    tY2 math.round_to_mintick(y1 math.abs(y1-prev)*tRatio)
                
    llLine := line.new(x1y1llX2llY2xloc=xloc.bar_indexcolor=color.redstyle=line.style_arrow_right)
                
    hlLine := line.new(x1y1hlX2hlY2xloc=xloc.bar_indexcolor=color.orangestyle=line.style_arrow_right)
                
    tLine := line.new(x1y1tX2tY2xloc=xloc.bar_indexcolor=color.yellowstyle=line.style_arrow_right)

                
    llPercent str.tostring(llStats*100/tStatsformat.percent)
                
    hlPercent str.tostring(hlStats*100/tStatsformat.percent)
                
    llText 'Number of Historical References :'+str.tostring(llStats)+'/'+str.tostring(tStats)+
                             
    '\nProbability of Lower Low :'+llPercent+
                             
    '\nAverage Lower Low Ratio :'+str.tostring(llRatio) +
                             
    '\nAverage Lower Low Bars :'+str.tostring(llBars)
                
    hlText 'Number of Historical References :'+str.tostring(hlStats)+'/'+str.tostring(tStats)+
                             
    '\nProbability of Higher Low :'+hlPercent+
                             
    '\nAverage Higher Low Ratio :'+str.tostring(hlRatio) +
                             
    '\nAverage Higher Low Bars :'+str.tostring(hlBars)
                
    tText 'Number of Historical References :'+str.tostring(tStats)+
                             
    '\nAverage Fib Ratio :'+str.tostring(tRatio)+
                             
    '\nAverage Bars :'+str.tostring(tBars)
                
    llLabel := label.new(llX2llY2str.tostring(llY2)+ ' - ' +llPercentstyle=label.style_label_upper_leftcolor=color.new(color.red70), textcolor color.whitesize=size.smalltooltip=llText)
                
    hlLabel := label.new(hlX2hlY2str.tostring(hlY2)+ ' - ' +hlPercentstyle=label.style_label_lower_leftcolor=color.new(color.orange70), textcolor color.whitesize=size.smalltooltip=hlText)
                
    tLabel := label.new(tX2tY2str.tostring(tY2)+ '@'+str.tostring(tRatio), style=label.style_label_leftcolor=color.new(color.yellow70), textcolor color.whitesize=size.smalltooltip=tText)
                
    llValue := llY2
                hlValue 
    := hlY2
                llProbability 
    := llStats*100/tStats
                ltRatio 
    := tRatio

            
    if(llStats != and hlStats != 0) and showTable
                table
    .cell(statsTableplColStartllrllastPivotStatustext_color txtColortext_size txtSizebgcolor color.new(color.orange60))
                
    table.cell(statsTableplColStart+1llrlastPivotStatustext_color txtColortext_size txtSizebgcolor color.new(color.lime60))
                
    table.cell(statsTableplColStart+2llrstr.tostring(llStats)+' - '+str.tostring(llRatio), text_color txtColortext_size txtSizebgcolor color.new(color.redhighlight50 90), tooltip=llTooltip)
                
    table.cell(statsTableplColStart+3llrstr.tostring(hlStats)+' - '+str.tostring(hlRatio), text_color txtColortext_size txtSizebgcolor color.new(color.greenhighlight50 90), tooltip hlTooltip)
                
    table.cell(statsTableplColStart+4llrstr.tostring(tStats)+' - '+str.tostring(tRatio), text_color txtColortext_size txtSizebgcolor color.from_gradient(llStats/tStats01color.greencolor.red), tooltip tTooltip)
                
    llr+=1


    if showPivotLines
        draw
    (valueMatrixdirectionMatrixratioMatrix,  divergenceMatrixdoubleDivergenceMatrixbarArraytrendArraynewZGdoubleZG)

    plot(drawSupertrendsupertrend:nacolor=supertrendDir>0color.green:color.redstyle=plot.style_linebr)


    hhp plot(fillAreas?hhValue:na'Higher High Range'color.new(color.green100), 1)
    lhp plot(fillAreas?lhValue:na'Lower High Range'color.new(color.lime100), 1)
    llp plot(fillAreas?llValue:na'Lower Low Range'color.new(color.red100), 1)
    hlp plot(fillAreas?hlValue:na'Higher Low Range'color.new(color.orange100), 1)

    fill(hhplhpcolor=color.new(hhProbability 50 color.green hhProbability 50color.red color.silver90))
    fill(llphlpcolor=color.new(llProbability 50 color.red llProbability 50color.green color.silver90)) 
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.

  3. bu kod çok hoşuma gidiyor....
    bir çok tasarımda kullanırım.....

    çünkü dinamiktir.....
    uzunluğa değil....

    barlara göre....fibo hesaplar.....

    trade edenler için sistemlerde olması gerekir bence.....

    PHP Code:
     //Fib box for OTE on visible chart only (61.8% - 78.6%)
    //Thanks to Pinecoder's VisibleChart library (PineCoders/VisibleChart/4) from which i borrowed code to write the library used here
    //Fib extensions added: user input; choose if above or below the range
    //User input toggle to choose to anchor the range from wick high/low or candle body high/low
    //23rd Jan'23
    //@twingall

    //@version=5
    import twingall/BasicVisibleChart/1

    indicator
    ("OTE visible chart"overlay true)

    useBodies =input.bool(false"use Candle Bodies to anchor range")
    showFibBox input.bool(true"show Fib Box"group "OTE box"inline "2")
    boxColor input.color(color.new(color.yellow82), ""group "OTE box"inline "2")
    showText input.bool(false"show Text",group "OTE box"inline "2")
    showHighLowLines=input.bool(true"high/low lines"group "fib retracements",inline "3")
    lineColor input.color(color.rgb(21776217), ""group "fib retracements",inline "3")
    showMidline =input.bool(true"Midline"group "fib retracements",inline "3")
    midlineColor input.color(color.gray,""group "fib retracements",inline "3")
    show61eight=input.bool(false"show 61.8 line"group "fib retracements",inline "5")
    show78six=input.bool(false"show 78.6 line"group "fib retracements",inline "6")
    show88six=input.bool(false"show 88.6 line"group "fib retracements",inline "7")

    showfibExt1=input.bool(true,"Ext#1"group ="fib extensions",inline="9")
    fibExt1Color=input.color(color.red,""group ="fib extensions",inline="9")
    fibExt1=input.float(1.618""group ="fib extensions",inline="9")
    showfibExt2=input.bool(true,"Ext#2"group ="fib extensions",inline="9")
    fibExt2Color=input.color(color.red,""group ="fib extensions",inline="9")
    fibExt2=input.float(2.0""group ="fib extensions",inline="9")
    showfibExt3=input.bool(false,"Ext#3"group ="fib extensions",inline="10")
    fibExt3Color=input.color(color.red,""group ="fib extensions",inline="10")
    fibExt3=input.float(1.5""group ="fib extensions",inline="10")

    showfibExt4=input.bool(false,"Ext#4"group ="fib extensions",inline="10")
    fibExt4Color=input.color(color.red,""group ="fib extensions",inline="10")
    fibExt4=input.float(2.5""group ="fib extensions",inline="10")
    showfibExt5=input.bool(false,"Ext#5"group ="fib extensions",inline="11")
    fibExt5Color=input.color(color.red,""group ="fib extensions",inline="11")
    fibExt5=input.float(3.0""group ="fib extensions",inline="11")
    showfibExt6=input.bool(false,"Ext#6"group ="fib extensions",inline="11")
    fibExt6Color=input.color(color.red,""group ="fib extensions",inline="11")
    fibExt6=input.float(3.5""group ="fib extensions",inline="11")

    _88sixColor input.color(color.green""group "fib retracements",inline "7")
    _61eightColor input.color(color.green""group "fib retracements",inline "5")
    _78sixColor input.color(color.green""group "fib retracements",inline "6")



    colorNone color.new(color.white,100)

    showExtLabels=input.bool(false,"Show Labels (Fib extensions)"group ="fib extensions",inline="11")
    flipInvertExts=input.bool(false,"flip/invert extensions"group ="fib extensions",inline="12")
    showFibLabels input.bool(false"Show Labels (Fib retracements)"group="fib retracements"inline="8")

    // Calling Library functions to get: high/low, body high / body low, timings, bull/bear
    float chartHigh  useBodiesBasicVisibleChart.highestBody():BasicVisibleChart.high()
    float chartLow   =useBodies?BasicVisibleChart.lowestBody():BasicVisibleChart.low()
    int   highTime   BasicVisibleChart.highBarTime()
    int   lowTime    BasicVisibleChart.lowBarTime()
    int   leftTime   math.min(highTimelowTime)
    int   rightTime  math.max(highTimelowTime)
    bool  isBull     lowTime highTime

    // Function to manage fib lines. It declares fib lines and label the first time it is called, then sets their properties on subsequent calls. 
    fibLine(series color fibColorseries float fibLevelbool _showPriceLabels) => 
        
    float fibRatio 1-(fibLevel 100)
        
    float fibPrice isBull chartLow  + ((chartHigh chartLow) * fibRatio) : 
                                  
    chartHigh - ((chartHigh chartLow) * fibRatio)
        
    float _fibLabel fibLevel /100
        
    var line  fibLine  =  line.new(nanananaxloc.bar_timeextend.rightfibColor,  line.style_dotted,  2)
        
    line.set_xy1(fibLine,  leftTime,  fibPrice)
        
    line.set_xy2(fibLine,  rightTimefibPrice)
        var 
    label fibLabel label.new(nana"",     xloc.bar_timeyloc.price,  color(na), label.style_label_up_showPriceLabelsfibColor:colorNone)
        
    label.set_xy(fibLabelint(math.avg(leftTimerightTime)), fibPrice)
        
    label.set_text(fibLabelstr.tostring(fibPriceformat.mintick))
        
    //label.set_text(fibLabel, str.format("{0, number, #.###} ({1})", _fibLabel , str.tostring(fibPrice, format.mintick)))

    //Function for Fib Extension lines..
    fibExt(series color fibColorseries float fibLevel,  bool _showExt) => 
        
    float fibRatio fibLevel 100
        float fibPrice 
    isBull chartLow  - ((chartHigh chartLow) * fibRatio) : 
                                  
    chartHigh + ((chartHigh chartLow) * fibRatio)
        
    float fibLabel not flipInvertExts? -(fibLevel /100) :(fibLevel /100)+1  //getting both normal and inverted ext labels to display as positive numbers
        
    var line  fibLine  =  line.new(nanananaxloc.bar_timeextend.rightfibColor,  line.style_dotted,  2)
        
    line.set_xy1(fibLine,  leftTime,  fibPrice)
        
    line.set_xy2(fibLine,  rightTimefibPrice)
        var 
    label fibExtLabel label.new(nana"",     xloc.bar_timeyloc.price,  color(na), label.style_label_up_showExtfibColor:colorNone)
        
    label.set_xy(fibExtLabelint(math.avg(leftTimerightTime)), fibPrice)
        
    label.set_text(fibExtLabelstr.format("{0, number, #.###} ({1})"fibLabel str.tostring(fibPriceformat.mintick)))

    //Fib Box function; similar to the above but highlighting the area between 2 fib levels
    fibBox(series color fibColorseries float fibLevel_1series float fibLevel_2) =>
        
    float fibRatio_1 1-(fibLevel_1 100)
        
    float fibPrice_1 isBull chartLow  + ((chartHigh chartLow) * fibRatio_1) : chartHigh - ((chartHigh chartLow) * fibRatio_1)
        
    float fibRatio_2 1-(fibLevel_2 100)
        
    float fibPrice_2 isBull chartLow  + ((chartHigh chartLow) * fibRatio_2) : chartHigh - ((chartHigh chartLow) * fibRatio_2)
        var 
    box.new(nanananaxloc=xloc.bar_timeborder_style=line.style_dashedextend extend.rightborder_color=colorNonetext_color=color.new(color.gray,70), text_halign=text.align_right)
        
    box.set_lefttop(bleftTimefibPrice_1)
        
    box.set_rightbottom(brightTime,fibPrice_2)
        
    box.set_bgcolor(b,  fibColor)
        
    box.set_text(btext showText"OTE":"")
        
    // Display code that only runs on the last bar but displays visuals on visible bars, wherever they might be in the dataset.
    if barstate.islast
        
    //Declare fib lines and fib box
        
    fibLine(lineColor,  100,showFibLabels )
        
    fibLine(showMidline?midlineColor :colorNone50,showFibLabels )
        
    fibLine(lineColor,  0,showFibLabels )
        
    fibBox(showFibBox?boxColor:colorNone78.661.8)
        
    fibLine(show88six?_88sixColor:colorNone88.6,showFibLabels )
        
    fibLine(show61eight?_61eightColor:colorNone61.8,showFibLabels )
        
    fibLine(show78six?_78sixColor:colorNone78.6,showFibLabels )
            
    //more fib lines
        //fibLine(_88sixColor, 11.4)
        //fibLine(_61eightColor, 38.2)
        //fibLine(_78sixColor, 21.4)

        //Declare Fib extensions
    if barstate.islast and showfibExt1 and flipInvertExts
        fibExt
    (fibExt1Color, (fibExt1*100)-100showExtLabels)
    if 
    barstate.islast and showfibExt2 and flipInvertExts
        fibExt
    (fibExt2Color, (fibExt2*100)-100showExtLabels)
    if 
    barstate.islast and showfibExt3 and flipInvertExts
        fibExt
    (fibExt3Color, (fibExt3*100)-100showExtLabels)
    if 
    barstate.islast and showfibExt4 and flipInvertExts
        fibExt
    (fibExt4Color, (fibExt4*100)-100showExtLabels)
    if 
    barstate.islast and showfibExt5 and flipInvertExts
        fibExt
    (fibExt5Color, (fibExt5*100)-100showExtLabels)
    if 
    barstate.islast and showfibExt6 and flipInvertExts
        fibExt
    (fibExt6Color, (fibExt6*100)-100showExtLabels)

    if 
    barstate.islast and showfibExt1 and not flipInvertExts
        fibExt
    (fibExt1Color, -(fibExt1*100), showExtLabels)
    if 
    barstate.islast and showfibExt2 and not flipInvertExts
        fibExt
    (fibExt2Color, -(fibExt2*100), showExtLabels)
    if 
    barstate.islast and showfibExt3 and not flipInvertExts
        fibExt
    (fibExt3Color, -(fibExt3*100), showExtLabels)
    if 
    barstate.islast and showfibExt4 and not flipInvertExts
        fibExt
    (fibExt4Color, -(fibExt4*100), showExtLabels)
    if 
    barstate.islast and showfibExt5 and not flipInvertExts
        fibExt
    (fibExt5Color, -(fibExt5*100), showExtLabels)
    if 
    barstate.islast and showfibExt6 and not flipInvertExts
        fibExt
    (fibExt6Color, -(fibExt6*100), showExtLabels
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.

  4. bu kod ise....
    kombinedir.....

    barların sinyalleri olduğu gibi.....

    ayı-boğa ilişkisini gösterir.....

    ayrıca.... olası bar hareketlerini hesaplar gösterir.....

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

    // ╠═══════════════════════════ Anıl Özekşi Library ═══════════════════════════╣

    // 1) OTT            [31.05.2019]    Optimized Trend Tracker
    // 2) TOTT           [01.05.2020]    Twin Ott (Ott Bands)
    // 3) OTT CHANNEL    [19.03.2021]    Ott Channel (Half Channel & Fibonacci Channel)
    // 4) RISOTTO        [16.04.2021]    Rsi-Ott 
    // 5) SOTT           [18.04.2021]    Stochastic Ott
    // 6) HOTT-LOTT      [06.03.2022]    Highest-Lowest Ott & Sum Version [07.04.2022] 
    // 7) ROTT           [19.05.2022]    Relative Ott       
    // 8) FT             [24.06.2022]    "Fırsatçı Trend"
    // 9) RTR            [26.09.2022]    Relative True Range

    // "TOTTO" and "OTTO" are not included in the script.
    //      TOTTO and TOTT have the same calculations, the only difference is the length parameter.
    //      OTTO has been created by another (K. H. Alpay).
    // Special thanks to Kıvanç Özbilgiç for Pine Script design and calculation examples of OTT.

    //@version=5
    indicator("!"precision=2max_lines_count 100max_labels_count 100overlay=true)

    // ╠═════════════════════════════════ Inputs ══════════════════════════════════╣

    gr_sys "╠═══════════════ SYSTEM ══════════════╣"
    system input.string(title="System "defval="OTT"group=gr_sysoptions=
      [
    "OTT""TOTT""OTT CHANNEL""RISOTTO""SOTT""HOTT-LOTT""ROTT""FT""RTR"])
    tt_p "Enable repating signals.\n" 
      
    "(This option allows you to display consecutive signals in the same direction for TOTT & HOTT-LOTT. " 
      
    "It also effects the colour of bars.)"
    tt_bars "Bars option is available for :\nOTT, TOTT, OTT CHANNEL, HOTT-LOTT, FT."  
    pyr input.bool(title="Pyramiding"defval=falsegroup=gr_systooltip=tt_p)
    gr_dis "╠═══════════════ DISPLAY ══════════════╣"
    sh_signal input.bool(title="Signals****"defval=truegroup=gr_disinline="1")
    sh_bar_color input.bool(title="Barcolor****"defval=truegroup=gr_disinline="1")
    sh_bar input.bool(title="Bars"defval=truegroup=gr_disinline="1"tooltip=tt_bars)
    col_sup #00bcd4
    col_tar #ff9800
    col_l   #00ff00
    col_s   #ff0000
    col_n   #333333

    // ╔═══════════════════════════════════════════════════════════════════════════╗
    // ║                                 FUNCTIONS                                 ║
    // ╚═══════════════════════════════════════════════════════════════════════════╝

    // ╠═══════════════════════════════════ VAR ═══════════════════════════════════╣

    // Variable Index Dynamic Adaptive Moving Average - Tushar Chande
    f_var(series float dataseries int length) =>
        
    ta.sma(datalength)
        
    math.abs(ta.change(data9))                                                          // Momentum
        
    math.sum(math.abs(ta.change(data)), 9)                                                // Volatility
        
    != 0                                                                    // Efficiency Ratio
        
    / (length 1)
        
    0.0:= length == data na(r[1]) ? * (data nz(r[1])) + nz(r[1])    // Matriks design
        // r = 0.0, r := d * e * (data - nz(r[1])) + nz(r[1])                                     // Output used in previously published versions on Tradingview 
    //

    // ╠═══════════════════════════════════ OTT ═══════════════════════════════════╣

    // Optimized Trend Tracker - Anıl Özekşi
    f_ott(series float dataseries float multiplier) =>
        
    multiplier 100
        b 
    data adata bdata b
        c 
    := nz(c[1]) or data nz(c[1]) ? nz(c[1])
        
    := nz(d[1]) or data nz(d[1]) ? nz(d[1])
        
    0.0:= data nz(e[1]) ? data nz(e[1]) ? nz(e[1])    // MOST - by Anıl Özekşi :)
        
    2
        g 
    2
        h 
    data g
        r 
    nz(h[2])
    //

    // ╔═══════════════════════════════════════════════════════════════════════════╗
    // ║                               CALCULATIONS                                ║
    // ╚═══════════════════════════════════════════════════════════════════════════╝

    // ╠═══════════════════════════════════ OTT ═══════════════════════════════════╣

    // Inputs
    string gr_ott "╠═══════════════ OTT ════════════════╣"
    ott_u input.int(title="Length "defval=20step=5group=gr_otttooltip="MA Length [20, 60]")
    ott_k input.float(title="Multiplier "defval=1.5step=0.1group=gr_otttooltip="OTT Multiplier")

    // Calcs
    ott_support f_var(closeott_u)
    ott_line    f_ott(ott_supportott_k)

    // Signals
    ott_long  ott_support ott_line    // ta.crossover(ott_support,  ott_line)
    ott_short ott_support ott_line    // ta.crossunder(ott_support, ott_line)

    // ╠══════════════════════════════════ TOTT ═══════════════════════════════════╣

    // Inputs
    string gr_tott "╠═══════════════ TOTT ═══════════════╣"
    tott_u  input.int(title="Length "defval=35step=5group=gr_totttooltip="MA Length [15, 45]")
    tott_k1 input.float(title="Multiplier "defval=0.5step=0.1group=gr_totttooltip="OTT Multiplier [0.3, 0.6]")
    tott_k2 input.float(title="Band Multiplier "defval=0.0006step=0.0001group=gr_totttooltip="[0.0004, 0.0006]")

    // Calcs
    tott_support f_var(closeint(tott_u 2))
    tott_up      f_ott(f_var(tott_support2), tott_k1) * (tott_k2)
    tott_dn      f_ott(f_var(tott_support2), tott_k1) * (tott_k2)

    // Signals
    tott_long  tott_support tott_up   // ta.crossover(tott_support,  tott_up)
    tott_short tott_support tott_dn   // ta.crossunder(tott_support, tott_dn)

    // ╠═══════════════════════════════ OTT CHANNEL ═══════════════════════════════╣

    // Inputs
    string gr_ottc "╠════════════ OTT CHANNEL ════════════╣"
    string ottc_t1 "You can use this parameter to optimize '[Channel] Upper Line' manually."
    string ottc_t2 "You can use this parameter to optimize '[Channel] Lower Line' manually."
    string ottc_t3 "It is recommended to hide the channel levels to see the trends correctly while you're setting the manuel parameter optimization."
    ottc_t  input.string(title="Channel Type"defval="Half Channel"options=["Half Channel""Fibonacci Channel""Both"], group=gr_ottc)
    ottc_u  input.int(title="Length "defval=2group=gr_ottctooltip="MA Length")
    ottc_k1 input.float(title="Multiplier "defval=1.4group=gr_ottctooltip="OTT Multiplier")
    ottc_k2 input.float(title="Upper Line Multiplier"defval=0.01step=0.01group=gr_ottctooltip=ottc_t1)
    ottc_k3 input.float(title="Lower Line Multiplier"defval=0.01step=0.01group=gr_ottctooltip=ottc_t2)
    ottc_h1 input.bool(title="Hide Upper & Lower Lines"defval=falsegroup=gr_ottc)
    ottc_h2 input.bool(title="Hide Channel Lines"defval=falsegroup=gr_ottctooltip=ottc_t3)

    // Ottc Mid Line
    ottc_m f_ott(f_var(closeottc_u), ottc_k1)

    // Channel Calcs
    ottc_1 ottc_m * (ottc_k2)
    ottc_2 ottc_m * (ottc_k2 0.618)
    ottc_3 ottc_m * (ottc_k2 0.500)
    ottc_4 ottc_m * (ottc_k2 0.382)
    ottc_5 ottc_m * (ottc_k3 0.382)
    ottc_6 ottc_m * (ottc_k3 0.500)
    ottc_7 ottc_m * (ottc_k3 0.618)
    ottc_8 ottc_m * (ottc_k3)

    // Signals
    // There're no any referenced conditions to generate signals for Ott Channel. 
    // It is recommended to use Channels as support and resistance levels. 

    // ╠═════════════════════════════════ RISOTTO ═════════════════════════════════╣

    // Inputs
    string gr_risotto "╠═════════════ RISOTTO ═══════════════╣"
    risotto_u1 input.int(title="Length 1"defval=100group=gr_risottotooltip="RSI Length"
    risotto_u2 input.int(title="Length 2"defval=50group=gr_risottotooltip="MA Length")
    risotto_k  input.float(title="Multiplier "defval=0.2group=gr_risottotooltip="OTT Multiplier")

    // Calcs
    risotto_support f_var(ta.rsi(closerisotto_u1), risotto_u2) + 1000
    risotto_line    
    f_ott(f_var(risotto_support2), risotto_k)

    // Signals
    risotto_long  risotto_support risotto_line    // ta.crossover(risotto_support,  risotto_line)
    risotto_short risotto_support risotto_line    // ta.crossunder(risotto_support, risotto_line)

    // ╠══════════════════════════════════ SOTT ═══════════════════════════════════╣

    // Inputs
    string gr_sott "╠═══════════════ SOTT ═══════════════╣"
    sott_u1 input.int(title="Length 1"defval=500group=gr_sotttooltip="Stochastic %k Length"
    sott_u2 input.int(title="Length 2"defval=200group=gr_sotttooltip="Stochastic %d Length")
    sott_k  input.float(title="Multiplier "defval=0.5group=gr_sotttooltip="OTT Multiplier")

    // Calcs
    sott_support f_var(ta.stoch(closehighlowsott_u1), sott_u2) + 1000
    sott_line    
    f_ott(f_var(sott_support2), sott_k)

    // Signals
    sott_long  sott_support sott_line   // ta.crossover(sott_support,  sott_line)
    sott_short sott_support sott_line   // ta.crossunder(sott_support, sott_line)

    // ╠═══════════════════════════════ HOTT & LOTT ═══════════════════════════════╣

    // Inputs
    string gr_hl "╠════════════ HOTT & LOTT ═════════════╣"
    string hl_t1 "If you activate this option, signals will be generated according to the confirmation concept for N bars. \n\n" 
      
    "Long : If the 'High' price is higher than Hott for N bars.\n\n" +
      
    "Short : If the 'Low' price is lower than Lott for N bars."
    hl_u     input.int(title="Length "defval=10step=5group=gr_hltooltip="ta.highest() & ta.lowest() Length\n[10, 30]")
    hl_k     input.float(title="Multiplier "defval=0.6step=0.1group=gr_hltooltip="OTT Multiplier [0.3, 0.6]")
    hl_sum   input.bool(title="Sum N bars"defval=falsegroup=gr_hlinline="1")
    hl_sum_n input.int(title="**********"defval=3group=gr_hlinline="1"tooltip=hl_t1)

    // Calcs
    hott f_ott(f_var(ta.highest(hl_u), 2), hl_k)
    lott f_ott(f_var(ta.lowest(hl_u),  2), hl_k)

    // Signals
    hl_long  not hl_sum high hott math.sum(high hott 0hl_sum_n) == hl_sum_n   // ta.crossover(high, hott)
    hl_short not hl_sum low  lott math.sum(low  lott 0hl_sum_n) == hl_sum_n   // ta.crossunder(low, lott)

    // ╠══════════════════════════════════ ROTT ═══════════════════════════════════╣

    // Inputs
    string gr_rott "╠═══════════════ ROTT ═══════════════╣"
    rott_u input.int(title="Length "defval=200group=gr_rotttooltip="MA Length [100, 300]")
    rott_k input.float(title="Multiplier "defval=1.0group=gr_rotttooltip="OTT Multiplier")

    // Calcs
    rott_support f_var(closerott_u) * 2
    rott_line    
    f_ott(f_var(rott_support2), rott_k)

    // Signals
    rott_long  rott_support rott_line   // ta.crossover(rott_support,  rott_line)
    rott_short rott_support rott_line   // ta.crossunder(rott_support, rott_line)

    // ╠═══════════════════════════════════ FT ════════════════════════════════════╣

    // Inputs
    string gr_ft "╠════════════════ FT ════════════════╣"
    ft_u  input.int(title="Length "defval=30step=10group=gr_fttooltip="MA Length [20, 40]")
    ft_k1 input.float(title="Major Multiplier"defval=3.6group=gr_fttooltip="Major OTT Multiplier")
    ft_k2 input.float(title="Minor Multiplier"defval=1.8group=gr_fttooltip="Minor OTT Multiplier")

    // Calcs
    ft_support   f_var(closeft_u)
    major_trend  f_ott(ft_supportft_k1)
    minor_trend  f_ott(ft_supportft_k2)
    ft_line      = (minor_trend + (minor_trend major_trend)[100]) / 2

    // Signals
    ft_long  ft_support ft_line   // ta.crossover(ft_support,  ft_line)
    ft_short ft_support ft_line   // ta.crossunder(ft_support, ft_line)

    // ╠═══════════════════════════════════ RTR ═══════════════════════════════════╣

    // Inputs
    string gr_rtr "╠═══════════════ RTR ════════════════╣"
    rtr_u1 input.int(title="Length 1"defval=10group=gr_rtrtooltip="ATR Length [10, 20]")
    rtr_u2 input.int(title="Length 2"defval=200group=gr_rtrtooltip="MA Length [200, 500]")

    // Calcs
    rtr_line close f_var(close ta.atr(rtr_u1), rtr_u2)

    // Signals
    // There're no any referenced conditions to generate signals for Relative True Range. 
    // It is recommended to use RTR as a volatility indicator.

    // ╔═══════════════════════════════════════════════════════════════════════════╗
    // ║                                  RETURN                                   ║
    // ╚═══════════════════════════════════════════════════════════════════════════╝

    // ╠═════════════════════════════ Support & Lines ═════════════════════════════╣

    _support 
      
    system == "OTT"     ott_support     :  
      
    system == "TOTT"    tott_support    :  
      
    system == "RISOTTO" risotto_support 
      
    system == "SOTT"    sott_support    
      
    system == "ROTT"    rott_support    
      
    system == "FT"      ft_support      
      
    na
    //

    _target 
      
    system == "OTT"     ott_line     :
      
    system == "RISOTTO" risotto_line :
      
    system == "SOTT"    sott_line    :
      
    system == "ROTT"    rott_line    :
      
    system == "FT"      ft_line      :
      
    system == "RTR"     rtr_line     :
      
    na
    //

    _line_up 
      
    system == "TOTT"      tott_up :  
      
    system == "HOTT-LOTT" hott    
      
    na
    //

    _line_dn 
      
    system == "TOTT"      tott_dn :  
      
    system == "HOTT-LOTT" lott    
      
    na
    //

    // ╠═════════════════════════════════ Signals ═════════════════════════════════╣

    long 
      
    system == "OTT"       ott_long     
      
    system == "TOTT"      tott_long    
      
    system == "RISOTTO"   risotto_long 
      
    system == "SOTT"      sott_long    
      
    system == "HOTT-LOTT" hl_long      
      
    system == "ROTT"      rott_long    
      
    system == "FT"        ft_long      
      
    na
    //

    short 
      
    system == "OTT"       ott_short     
      
    system == "TOTT"      tott_short    
      
    system == "RISOTTO"   risotto_short 
      
    system == "SOTT"      sott_short    
      
    system == "HOTT-LOTT" hl_short      
      
    system == "ROTT"      rott_short    
      
    system == "FT"        ft_short      
      
    na
    //

    // Fix Signal
    var bool l na
    var bool s na
    ls 
    not s and long
    ss 
    not l and short
    if ls
        l 
    := false
        s 
    := true
    if ss
        l 
    := true
        s 
    := false
    int dir 
    0
    dir 
    := pyr long short ? -ls ss ? -nz(dir[1])
    long_signal  pyr not long[1]  and long  ls 
    short_signal 
    pyr not short[1] and short ss 
    total_signals 
    ta.cum(long_signal or short_signal 0)

    // ╠═══════════════════════════════ Plotshapes ════════════════════════════════╣

    plotshape(sh_signal long_signal na,  "Long Signal",  shape.triangleup,   location.bottomcol_lsize=size.normal)
    plotshape(sh_signal short_signal na"Short Signal"shape.triangledownlocation.top,    col_ssize=size.normal)

    // ╠══════════════════════════ Plot Support & Lines ═══════════════════════════╣

    plot(_supportcolor=col_suptitle=". ")
    plot(_target,  color=col_tartitle="..")
    //plot(_line_up, color=#00bb00, title="Upper Line")
    //plot(_line_dn, color=#fb0000, title="Lower Line")

    // ╠══════════════════════════════ Plot Channels ══════════════════════════════╣

    bool ottc_none system != "OTT CHANNEL"
    bool ottc_half ottc_t == "Both" or ottc_t == "Half Channel"
    bool ottc_fibo ottc_t == "Both" or ottc_t == "Fibonacci Channel"

    //plot(ottc_none or ottc_h1 ? na : ottc_1,                  color=#00bb00, title="[Channel] Upper Line")
    //plot(ottc_none or ottc_h2 ? na : ottc_fibo ? ottc_2 : na, color=#8c00ff, title="[Channel] ⮝ 0.618") 
    //plot(ottc_none or ottc_h2 ? na : ottc_half ? ottc_3 : na, color=#00bcd4, title="[Channel] ⮝ Half Line")
    //plot(ottc_none or ottc_h2 ? na : ottc_fibo ? ottc_4 : na, color=#1848cc, title="[Channel] ⮝ 0.382")
    //plot(ottc_none or ottc_h2 ? na : ottc_m,                  color=#787B86, title="[Channel] Mid Line")
    //plot(ottc_none or ottc_h2 ? na : ottc_fibo ? ottc_5 : na, color=#945100, title="[Channel] ⮟ 0.382")
    //plot(ottc_none or ottc_h2 ? na : ottc_half ? ottc_6 : na, color=#ff9800, title="[Channel] ⮟ Half Line")
    //plot(ottc_none or ottc_h2 ? na : ottc_fibo ? ottc_7 : na, color=#a4a600, title="[Channel] ⮟ 0.618")
    //plot(ottc_none or ottc_h1 ? na : ottc_8,                  color=#fb0000, title="[Channel] Lower Line")

    // ╠════════════════════════════════ Barcolor ═════════════════════════════════╣

    no_color system == "OTT CHANNEL" or system == "RTR"
    bar_color 
      
    no_color na 
      
    dir == col_l dir == -col_s col_n
    barcolor
    (sh_bar_color bar_color natitle="Barcolor")

    // ╠═══════════════════════════════ Plotcandle ════════════════════════════════╣

    no_bars system == "RISOTTO" or system == "SOTT" or system == "ROTT" or system == "RTR"  
    candle_color close>open #08998175 : close<open ? #f2364575 : #33333375
    plotshape(barstate.isfirsttitle="╠═════ OHLC ═════╣"location=location.bottomcolor=#00000000, editable=false) 
    plotcandle(
      
    no_bars na sh_bar open  na
      
    no_bars na sh_bar high  na
      
    no_bars na sh_bar low   na
      
    no_bars na sh_bar close na
      
    title="Bars"color=candle_colorbordercolor=candle_colorwickcolor=candle_color)
    //

    // ╠═══════════════════════════════ Parameters ════════════════════════════════╣

    p_ott 
      
    "Length : " str.tostring(ott_u) + "\n\n" 
      
    "Multiplier : " str.tostring(ott_k)
    p_tott 
      
    "Length : " str.tostring(tott_u) + "\n\n" 
      
    "Multiplier : " str.tostring(tott_k1) + "\n\n" 
      
    "Band Multiplier : " str.tostring(tott_k2)
    p_ottc 
      
    "Length : " str.tostring(ottc_u) + "\n\n" +  
      
    "Multiplier : " str.tostring(ottc_k1) + "\n\n" 
      
    "Upper Line Multiplier : " str.tostring(ottc_k2) + "\n\n" 
      
    "Lower Line Multiplier : " str.tostring(ottc_k3)
    p_risotto 
      
    "Rsi Length : " str.tostring(risotto_u1) + "\n\n" 
      
    "Ott Length : " str.tostring(risotto_u2) + "\n\n" 
      
    "Multplier : " str.tostring(risotto_k
    p_sott 
      
    "Stochastic %k Length : " str.tostring(sott_u1) + "\n\n" 
      
    "Stochastic %d Length : " str.tostring(sott_u2) + "\n\n" 
      
    "Multplier : " str.tostring(sott_k)    
    pp_sum 
      
    hl_sum "Sum Option : On" "\n\n" "Sum N Bars : " str.tostring(hl_sum_n) : "" 
    p_hl 
      
    "Length : " str.tostring(hl_u) + "\n\n" +     
      
    "Multiplier : " str.tostring(hl_k) + "\n\n" +
      
    pp_sum
    p_rott 

      
    "Length : " str.tostring(rott_u)+ "\n\n" +
      
    "Multiplier : " str.tostring(rott_k)
    p_ft 
      
    "Length : " str.tostring(ft_u) + "\n\n" +
      
    "Major Multiplier : " str.tostring(ft_k1) + "\n\n" +
      
    "Minor Multiplier : " str.tostring(ft_k2)
    p_rtr 
      
    "Atr Length : " str.tostring(rtr_u1) + "\n\n" +
      
    "Var Length : " str.tostring(rtr_u2)
    //

    parameter 
      
    system == "OTT"         p_ott     
      
    system == "TOTT"        p_tott    
      
    system == "OTT CHANNEL" p_ottc    
      
    system == "RISOTTO"     p_risotto 
      
    system == "SOTT"        p_sott    
      
    system == "HOTT-LOTT"   p_hl      
      
    system == "ROTT"        p_rott    
      
    system == "FT"          p_ft    
      
    system == "RTR"         p_rtr     
      
    na
    //

    // ╠══════════════════════════════════ Table ══════════════════════════════════╣

    var tb table.new(position.top_right110)
    if 
    barstate.islast
        table
    .cell(tb00ottc_none "\n\n" system "\n\n" system "\n\n[" ottc_t "]"text_color=color.bluetext_halign=text.align_left)
        
    table.cell(tb01parametertext_color=#686868, text_halign=text.align_left)
        
    table.cell(tb02"\n\nChart Info"text_color=color.bluetext_halign=text.align_left)
        
    table.cell(tb03"Bars : " str.tostring(bar_index 1), text_color=#686868, text_halign=text.align_left)
        
    table.cell(tb04"Signals : " str.tostring(total_signals), text_color=#686868, text_halign=text.align_left)
    //

    // ╠═══════════════════════════════════ Out ═══════════════════════════════════╣

    // Direction
    plot(dirtitle="Direction"display=display.data_windoweditable=false)

    // Entry & Exit
    long_entry  dir == 1  and dir[1] != 1
    long_exit   
    dir != 1  and dir[1] == 1
    short_entry 
    dir == -and dir[1] != -1
    short_exit  
    dir !=-1  and dir[1] == -1

    // Out
    plot(long_entry  0"Long Entry",  display=display.data_windoweditable=false)
    plot(long_exit   0"Long Exit",   display=display.data_windoweditable=false)
    plot(short_entry 0"Short Entry"display=display.data_windoweditable=false)
    plot(short_exit  0"Short Exit",  display=display.data_windoweditable=false)

    // Alert
    freq alert.freq_once_per_bar_close
    if long_entry
        alert
    (system "\nLong Entry !",  freq)
    if 
    long_exit
        alert
    (system "\nLong Exit !",   freq)
    if 
    short_entry
        alert
    (system "\nShort Entry !"freq)
    if 
    short_exit
        alert
    (system "\nShort Exit !",  freq)
    //

    // Bitti :)
    plotshape(barstate.isfirsttitle="@ dg_factor"location=location.bottomcolor=#00000000, editable=false)

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

    //@version=5


    var g_STR "Structure"
    ps input.int(1"Pivot Strength"group g_STR)
    color_trend input.bool(true"Trend Candles"inline "TREND"group g_STR)
    show_labels input.bool(true"Show Structure Labels"inline "MSS"group g_STR)
    label_type input.string("All"""options = ['MSS''BOS''All'], inline "MSS"group g_STR)

    var 
    g_PHL "Protected Highs & Lows"
    show_phl input.bool(true"Show Protected Highs & Lows"inline "PHL"group g_PHL)
    trail_phl input.bool(false"Show Protected Trail"inline "TRAIL"group g_PHL)
    trail_width input.int(1""inline "TRAIL"group g_PHL)

    ph_color input.color(color.rgb(2532374), ""inline "PHL"group g_PHL)
    pl_color input.color(color.rgb(2532374), ""inline "PHL"group g_PHL)

    bull_color input.color(color.rgb(612484), ""inline "TREND"group g_STR)
    bear_color input.color(color.rgb(25033), ""inline "TREND"group g_STR)

    var 
    bool bull na

    var float trail_price na
    var color trail_color na

    var ph = array.new_float()
    var 
    pl = array.new_float()

    var 
    pht = array.new_int()
    var 
    plt = array.new_int()

    var 
    float last_high na
    var float last_low na

    var int last_high_idx na
    var int last_low_idx na

    var float track_high na
    var float track_low na

    var int track_high_idx na
    var int track_low_idx na

    type dwg
        label
    [] _label
        label
    [] _phl
        line
    [] _line
        bool
    [] _bull

    method dwg_add
    (dwg dlabel LBlabel PHLline LNbool BL) =>
        
    d._label.unshift(LB)
        
    d._phl.unshift(PHL)
        
    d._line.unshift(LN)
        
    d._bull.unshift(BL)

    clear_all() =>
        
    pl.clear()
        
    plt.clear()    
        
    ph.clear()
        
    pht.clear()

    if 
    ta.pivotlow(lowpsps) and pl.size() == 0
        pl
    .unshift(low[ps])
        
    plt.unshift(time[ps])

        if 
    na(last_low)
            
    last_low := low[ps]
            
    last_low_idx := bar_index ps
        
    else
            if 
    low[ps] < last_low
                last_low 
    := low[ps]
                
    last_low_idx := bar_index ps
    if ta.pivothigh(highpsps) and ph.size() == 0
        ph
    .unshift(high[ps])
        
    pht.unshift(time[ps])
        
        if 
    na(last_high)
            
    last_high := high[ps]
            
    last_high_idx := bar_index ps
        
    else
            if 
    high[ps] > last_high
                last_high 
    := high[ps]
                
    last_high_idx := bar_index ps
        
    if (high[ps] > track_high or na(track_high) or last_low_idx >= track_high_idx) and not na(ta.pivothigh(highpsps))
        
    track_high := high[ps]
        
    track_high_idx := bar_index ps
    if (low[ps] < track_low or na(track_low) or last_high_idx >= track_low_idx) and not na(ta.pivotlow(lowpsps))
        
    track_low := low[ps]
        
    track_low_idx := bar_index ps

    bos_bear 
    false
    bos_bull 
    false
    mss_bear 
    false
    mss_bull 
    false
    change 
    false

    var dwgs dwg.new(array.new_label(), array.new_label(), array.new_line(), array.new_bool())

    if 
    ph.size() > 
        
    if close ph.get(0)
            
    label _label na
            label _phl 
    na

            
    if show_labels
                save 
    false
                
    if label_type == 'MSS' and not bull
                    save 
    := true
                
    else if label_type == 'BOS' and bull
                    save 
    := true
                
    else if label_type == 'All'
                    
    save := true
                
    if save    
                    _label 
    := label.new(math.floor(math.avg(timepht.get(0))), ph.get(0), bull "AYILAR" "BOĞALAR"xloc xloc.bar_timestyle label.style_label_downcolor #ffffff00, textcolor = na)

            
    if bull
                bos_bull 
    := true
            
    else
                
    mss_bull := true

            _line 
    line.new(pht.get(0), ph.get(0), timeph.get(0), color naxloc xloc.bar_timestyle line.style_dashed)
            
    bull := true
            change 
    := true

            clear_all
    ()

            if 
    not na(track_low)
                if 
    show_phl
                    _phl 
    := label.new(time[bar_index track_low_idx], track_low"AL"xloc xloc.bar_timestyle label.style_label_uptextcolor color.yellowcolor #ffffff00)

                
    pl.unshift(track_low)
                
    plt.unshift(time[bar_index track_low_idx])
                
    last_high := na

            dwgs
    .dwg_add(_label_phl_linebull)

    if 
    pl.size() > 0
        
    if close pl.get(0)
            
    label _label na
            label _phl 
    na

            
    if show_labels
                save 
    false
                
    if label_type == 'MSS' and bull
                    save 
    := true
                
    else if label_type == 'BOS' and not bull
                    save 
    := true
                
    else if label_type == 'All'
                    
    save := true
                
    if save    
                    _label 
    := label.new(math.floor(math.avg(timeplt.get(0))), pl.get(0), not bull "AYILAR" "BOĞALAR"xloc xloc.bar_timestyle label.style_label_upcolor #ffffff00, textcolor = na)

            
    if not bull
                bos_bear 
    := true
            
    else
                
    mss_bear := true

            _line 
    line.new(plt.get(0), pl.get(0), timepl.get(0), color naxloc xloc.bar_timestyle line.style_dashed)
            
    bull := false
            change 
    := true
                    
            clear_all
    ()

            if 
    not na(track_high)
                if 
    show_phl
                    _phl 
    := label.new(time[bar_index track_high_idx], track_high"SAT"xloc xloc.bar_timestyle label.style_label_downtextcolor color.yellowcolor #ffffff00)

                
    ph.unshift(track_high)
                
    pht.unshift(time[bar_index track_high_idx])                
                
    last_low := na
                
            dwgs
    .dwg_add(_label_phl_linebull)

    if 
    change[1]
        if 
    bos_bear[1] or mss_bear[1]
            
    trail_price := track_high
            trail_color 
    := ph_color
        
    else if bos_bull[1] or mss_bull[1]
            
    trail_price := track_low
            trail_color 
    := pl_color
            
        _bull 
    dwgs._bull.get(0)
        
    dwgs._label.get(0).set_textcolor(_bull bull_color bear_color)
        
    dwgs._phl.get(0).set_textcolor(_bull pl_color ph_color)
        
    dwgs._line.get(0).set_color(_bull bull_color bear_color)

    //barcolor(color_trend ? (bull ? bull_color : bear_color) : na)

    plot(trail_phl trail_price nacolor trail_colorlinewidth trail_width)

    alertcondition(bos_bear[1] or bos_bull[1], "BOS Any")
    alertcondition(mss_bear[1] or mss_bull[1], "MSS Any")

    alertcondition(bos_bear[1], "BOS Bear")
    alertcondition(bos_bull[1], "BOS Bull")

    alertcondition(mss_bear[1], "MSS Bear")
    alertcondition(mss_bull[1], "MSS Bull")


    //@version=5

    import Steversteves/SPTS_StatsPakLib/as spts 

    t1 
    "This will plot a line from the first Result to the last Result for the forecast length"
    t2 "Showing results and variances will plot both the results (blue) and the standard errors based on the variance in the dataset. Only plotting reuslts will only plot the most likely outcome without the variance."

    // Inputs 
    src input.source(close"Forecast Source"),      train input.int(150"Train Time"),        len input.int(14"Forecast Length"),    
    typ input.string("Line Plot""Scatter Plot Type", ["Line Plot""Scatter Plot"]),            show_stats input.bool(false"Show Model Statistics")
    line_bf input.bool(true"Show Trendline"tooltip t1),       show_others input.string("Show Results Only","Show Results/Variance", ["Show Results and Variances""Show Results Only"], tooltip t2)
    // Arrays 
    results = array.new_float() 
    ucl = array.new_float() 
    lcl = array.new_float() 

    // Forecast 
    [abc] = spts.f_forecast(srcsrc[1], trainlenresultsucllcl)

    // Model Statistics 
    cor ta.correlation(srcsrc[len], train
    r2 math.pow(cor,2
    max_val = array.max(ucl
    min_val = array.min(lcl


    // Plots 
    var table data table.new(position.middle_right26bgcolor color.blueframe_color color.rgb(000), frame_width 4)
    if 
    show_stats 
        table
    .cell(data11text "Model Data"bgcolor color.bluetext_color color.white
        
    table.cell(data12text "Correlation: " str.tostring(math.round(cor,2)), bgcolor color.bluetext_color color.white
        
    table.cell(data13text "R2: " str.tostring(math.round(r23)), bgcolor color.bluetext_color color.white
        
    table.cell(data14text "Max Forecasted Value: " str.tostring(math.round(max_val2)), bgcolor color.bluetext_color color.white
        
    table.cell(data15text "Min Forecasted Value: " str.tostring(math.round(min_val2)), bgcolor color.bluetext_color color.white
    if 
    barstate.islast and typ == "Line Plot"
        
    for 0 to len 
            line
    .new(bar_index iy1 = array.get(resultsi), x2 bar_index iy2 = array.get(resultsi), color color.bluewidth 3)
            if 
    show_others == "Show Results and Variances"
                
    line.new(bar_index iy1 = array.get(ucli), x2 bar_index iy2 = array.get(ucli), color color.limewidth 3)
                
    line.new(bar_index iy1 = array.get(lcli), x2 bar_index iy2 = array.get(lcli), color color.redwidth 3)

    if 
    barstate.islast and typ == "Scatter Plot" 
        
    for 0 to len 
            label
    .new(bar_index i, array.get(resultsi), text ""color color.bluestyle label.style_circlesize size.tiny)
            if 
    show_others == "Show Results and Variances"
                
    label.new(bar_index i, array.get(ucli), text ""color color.limestyle label.style_circlesize size.tiny)
                
    label.new(bar_index i, array.get(lcli), text ""color color.redstyle label.style_circlesize size.tiny)


    var 
    line trendline na 
    if barstate.islast and line_bf 
        line
    .delete(trendline
        
    trendline := line.new(bar_index[1], y1 = array.get(results0), x2 bar_index + array.size(results) - 1y2 = array.get(results, array.size(results) - 1), color color.purplewidth  3
    içinde yok yok...
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.

  5. bu kod...
    sar kullanarak....
    barları renklendirir...
    beyaz renk...konsilide...diğerleri belli.....

    PHP Code:
     // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © joelly3d
    //All my scripts are part of a suite called Papercuts.

    //Dual PSAR is a trend following script that uses auto-higher timeframe calculation of the current timeframe to create a dual Parabolic Stop And Release.
    //This is useful because it can determine periods of transition or indecision and can flag those periods with which way it is learning even though it is undecided, what i call "Wait Zones".
    //When both PSARS are not in alignment, it uses the lower timeframe one to determine which way the wait zone is learning.

    //You can see below in the chart shows some good trends and some wait zones. 
    //A wait zone can have bullish indication, but then still have a bearish continuation.
    //A wait zone can have bullish indication, and then enter a bull trend.

    //Typically I won't make trades in wait zones, and I will exit trades when entering one.

    //Just wanted to try this out and see how it did.  Figured I'd share.



    //@version=5
    indicator('v01'overlay=truemax_bars_back=500)

    //-----------------------------------------------------------------Shared Functions
    //-----------------------------------------------------------------Shared Functions
    //-----------------------------------------------------------------Shared Functions

    // —————————————————————————————————————————
    // ————— Function returning `_color` with `_transp` transparency.
    // —————————————————————————————————————————
    f_colorNew(_color_transp) =>
        var 
    _r color.r(_color)
        var 
    _g color.g(_color)
        var 
    _b color.b(_color)
        
    color _return color.rgb(_r_g_b_transp)
        
    _return


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

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

    //-----------------------------------------------------------------Shared Functions
    //-----------------------------------------------------------------Shared Functions
    //-----------------------------------------------------------------Shared Functions


    /// --------------------------------------------- Dual Parabolic Stop and Reverse Options
    //PSAR inputs
    grpin '⚙=====-----'
    grpout '-----=====⚙'
    grpPSAR grpin 'Dual PSAR Options:' grpout
    colorBull 
    input.color(defval=#8afc07, group=grpPSAR, title='Bullish Color')  //Light Blue
    colorBear input.color(defval=#fc0505, group=grpPSAR, title='Bearish Color')  //yellow
    colorWait input.color(defval=#dbdbdb, group=grpPSAR, title='Wait Color')  //grey
    showRecolorCandles input.bool(true'Show Trend Full-Candle Recoloring?'group=grpPSARtooltip='Recolor the full candle including wick and border with trend color.')
    psar_start input.float(defval=0group=grpPSARtitle='PSAR: Start'minval=0maxval=2step=0.01)
    psar_accel input.float(defval=0.1group=grpPSARtitle='PSAR: Acceleration  Factor'minval=0.01maxval=2step=0.01)
    psar_maximum input.float(defval=0.1group=grpPSARtitle='PSAR: Extreme Point'minval=0.01maxval=2)


    f_psar() =>
        
    ta.sar(psar_startpsar_accelpsar_maximum)

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


    longZone psar_ctf low and psar_htf low
    shortZone 
    psar_ctf high and psar_htf high
    waitZone 
    not longZone and not shortZone

    trendSupportColor 
    longZone colorBull shortZone colorBear colorWait
    plotcandle
    (showRecolorCandles open nahighlowclosecolor=trendSupportColorwickcolor=trendSupportColorbordercolor=trendSupportColortitle='Plot Candles Trend-Recolor')
    barcolor(trendSupportColor)

    //plot when dual supported otherwise hide it
    //plot(longZone ? low : shortZone ? high : na, color=color.new(longZone ? colorBull : shortZone ? colorBear : na, 50), style=plot.style_stepline, linewidth=3, title='Dual PSAR Support Line')
    //plot(waitZone ? psar_ctf : na, color=color.new(psar_ctf < low ? colorBull : colorBear, 0), style=plot.style_circles, linewidth=7, title='Single PSAR Support Dots')

    /// --------------------------------------------- Dual Parabolic Stop and Reverse Options 
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.

  6. parabol sarı...
    aynı anda onlu hesaplayan kod.....

    PHP Code:
     //@version=5
    indicator('Parabolic Glitter''.'overlay=true)

    init input.float(0.1title='Initial Start'step=0.1)
    fi input.float(0.1title='Increment/Start Ratio'step=0.1)
    fm input.float(0.2title='Max/Start Ratio'step=0.1)
    ac input(falsetitle='Adaptive Coloring')

    sar01 ta.sar(init 01init fi 01init fm 01)
    sar02 ta.sar(init 02init fi 02init fm 02)
    sar03 ta.sar(init 03init fi 03init fm 03)
    sar04 ta.sar(init 04init fi 04init fm 04)
    sar05 ta.sar(init 05init fi 05init fm 05)
    sar06 ta.sar(init 06init fi 06init fm 06)
    sar07 ta.sar(init 07init fi 07init fm 07)
    sar08 ta.sar(init 08init fi 08init fm 08)
    sar09 ta.sar(init 09init fi 09init fm 09)
    sar10 ta.sar(init 10init fi 10init fm 10)

    plot(sar01title=' 01'style=plot.style_circlescolor=ac sar01 close color.rgb(2558282100) : color.rgb(7617579100) : color.silverlinewidth=1)
    plot(sar02title=' 02'style=plot.style_circlescolor=ac sar02 close color.rgb(2558282100) : color.rgb(7617579100) : color.silverlinewidth=1)
    plot(sar03title=' 03'style=plot.style_circlescolor=ac sar03 close color.rgb(2558282100) : color.rgb(7617579100) : color.silverlinewidth=1)
    plot(sar04title=' 04'style=plot.style_circlescolor=ac sar04 close color.rgb(2558282100) : color.rgb(7617579100) : color.silverlinewidth=1)
    plot(sar05title=' 05'style=plot.style_circlescolor=ac sar05 close color.fuchsia color.white color.silverlinewidth=3)
    plot(sar06title=' 06'style=plot.style_circlescolor=ac sar06 close color.rgb(2558282100) : color.rgb(7617579100) : color.silverlinewidth=1)
    plot(sar07title=' 07'style=plot.style_circlescolor=ac sar07 close color.rgb(2558282100) : color.rgb(7617579100) : color.silverlinewidth=1)
    plot(sar08title=' 08'style=plot.style_circlescolor=ac sar08 close color.rgb(2558282100) : color.rgb(7617579100) : color.silverlinewidth=1)
    plot(sar09title=' 09'style=plot.style_circlescolor=ac sar09 close color.rgb(2558282100) : color.rgb(7617579100) : color.silverlinewidth=1)
    plot(sar10title=' 10'style=plot.style_circlescolor=ac sar10 close color.rgb(2558282100) : color.rgb(7617579100) : color.silverlinewidth=1
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.

  7. belirttiğiniz uzunluğa otomatik paralel çizdirir.....
    PHP Code:
    //@version=5
    indicator('Parallel Pivot Lines [Firegenie]'overlay=truemax_bars_back=500)

    // User Settings
    length input.int(50group='Indicator Settings'tooltip='Pivot length. Higher values will connect to more significant pivots')
    lookback input.int(1minval=1group='Indicator Settings'tooltip='Number of lines connecting a pivot high/low')
    Slope input.float(1.minval=-1maxval=1step=0.01group='Indicator Settings'tooltip='Multiplies the linear regression with a number between -1 and 1')

    // Style Settings
    ph_col input.color(#2157f3, 'Pivot High Lines Colour', group='Style Settings')
    pl_col input.color(#ff1100, 'Pivot Low Lines Colour', group='Style Settings')
    pm_col input.color(#f6e017, 'Pivot Low Lines Colour', group='Style Settings')

    // Functions 

    Sma(srcp) =>
        
    ta.cum(src)
        (
    a[math.max(p0)]) / math.max(p0)

    Variance(srcp) =>
        
    _sma Sma(src srcp)
        
    == _sma math.pow(Sma(srcp), 2)

    Covariance(xyp) =>
        
    Sma(yp) - Sma(xp) * Sma(yp)

    bar_index
    ph 
    ta.pivothigh(lengthlength)
    pl ta.pivotlow(lengthlength)

    varip ph_array = array.new_float(0)
    varip pl_array = array.new_float(0)
    varip ph_n_array = array.new_int(0)
    varip pl_n_array = array.new_int(0)
    if 
    not na(ph
        array.
    insert(ph_array0ph)
        array.
    insert(ph_n_array0n)
    if 
    not na(pl)
        array.
    insert(pl_array0pl)
        array.
    insert(pl_n_array0n)
        
    val_ph ta.valuewhen(not na(ph) , lengthlookback 1)
    val_pl ta.valuewhen(not na(pl) , lengthlookback 1)
    val math.min(val_phval_pl)
    val val 2
    slope 
    Covariance(closenk) / Variance(nk) * Slope
    var line ph_l na
    var line pl_l na
    var line pm_l na
    if barstate.islast
        
    for 0 to lookback 1 by 1
            ph_y2 
    = array.get(ph_arrayi)
            
    ph_x1 = array.get(ph_n_arrayi) - length
            pl_y2 
    = array.get(pl_arrayi)
            
    pl_x1 = array.get(pl_n_arrayi) - length
            ph_l 
    := line.new(ph_x1ph_y2ph_x1 1ph_y2 slopeextend=extend.bothcolor=ph_col)
            
    pl_l := line.new(pl_x1pl_y2pl_x1 1pl_y2 slopeextend=extend.bothcolor=pl_col)
            
    pm_l := line.new((pl_x1 ph_x1) / 2, (pl_y2 ph_y2) / 2, (pl_x1 ph_x1 1) / 2, (pl_y2 slope ph_y2 slope) / 2extend=extend.bothcolor=pm_col)
            
    pm_l 
    trend kanalları gibi düşünün....
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.

  8. pivot çizdirmece....
    ama...
    saatlik en yükseği.....seanslık en düşüğü.... ve 15 dakkalık kapanış kullanarak.....
    destek ve dirençler için....
    PHP Code:
     //@version=5
    ////////////////////////////////////////////////////////////
    //  Copyright by HPotter v1.0 10/07/2014
    // Pivot points simply took the high, low, and closing price from the previous period and 
    // divided by 3 to find the pivot. From this pivot, traders would then base their 
    // calculations for three support, and three resistance levels. The calculation for the most 
    // basic flavor of pivot points, known as ‘floor-trader pivots’, along with their support and 
    // resistance levels.
    ////////////////////////////////////////////////////////////
    indicator(title='Pivot Point'shorttitle='Pivot Point'overlay=true)
    width input.int(1minval=1)
    xHigh request.security(syminfo.tickerid'60'high[1])
    xLow request.security(syminfo.tickerid'240'low[1])
    xClose request.security(syminfo.tickerid'15'close[1])
    vPP = (xHigh xLow xClose) / 3
    vR1 
    vPP vPP xLow
    vS1 
    vPP - (xHigh vPP)
    vR2 vPP xHigh xLow
    vS2 
    vPP - (xHigh xLow)
    vR3 xHigh * (vPP xLow)
    vS3 xLow * (xHigh vPP)
    plot(vS1color=color.new(#ff0000, 0), title='S1', style=plot.style_steplinebr, linewidth=width)
    plot(vS2color=color.new(#ff002a, 0), title='S2', style=plot.style_steplinebr, linewidth=width)
    plot(vS3color=color.new(#ff014a, 0), title='S3', style=plot.style_steplinebr, linewidth=width)
    plot(vR1color=color.new(#009600, 0), title='R1', style=plot.style_steplinebr, linewidth=width)
    plot(vR2color=color.new(#006F00, 0), title='R2', style=plot.style_steplinebr, linewidth=width)
    plot(vR3color=color.new(#004900, 0), title='R3', style=plot.style_steplinebr, linewidth=width) 
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.

Sayfa 371/438 İlkİlk ... 271321361369370371372373381421 ... 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
  •