Sayfa 65/272 İlkİlk ... 1555636465666775115165 ... SonSon
Arama sonucu : 2172 madde; 513 - 520 arası.

Konu: Tradingview


  1. son çalışma ve son derleme örneğidir....
    normal üyelikle, tradingwievde tek ekran, üç kod olarak düzenlenmiştir....

    birinci bölümde birleştirilen kodların birincisi:
    yıllık-aylık-haftalık fibanacci değerleri kullanılarak hesaplanan dinamik pivotlardır.
    ekranda iki beyaz çizgi olarak kullanılırken...periyot düşürüldüğünde aylık turuncu...haftalık mavi olur....

    ikinci kod ise hlc/3 ve 5 gün smoot ile aylık-haftalık-günlük birleşerek dinamik pivotlarla destek-dirençler...
    ekranda en sonda çizgi olarak gözüküyor....

    üçüncü ise fiyat ihlalinin ortalama şeklinde görülmesi için median ile belirleyerek kapanıştan iz sürme...
    ekranda ise gözükmeyen, ? işaretli değer....

    dördüncü ise 50 left-5 right pivot tepe ve diplerle alsat belirleyerek, tepe ve diplerle trend çizgileri çektirme....
    çizgiler siyah, pivatlar barlarda sarı renkli label olarak....

    beşinci ise stokastich momentum ındex hesaplamasının aynı eksende kullanılması....
    ekranda çizgiler yok....veriler table olarak....

    değerler ve stil ayarları değiştirilebilir....
    görüntü
    günlük

    saatlik


    birleştirilmiş kod örneği
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © Vallahualem
    //@version=4 .................................................. ............................................
    study(title="Dinamik Pivotlar", shorttitle="?", overlay=true, format=format.inherit)

    //TimeFrame Selections
    Year_SR = timeframe.isdaily or timeframe.isintraday
    Month_SR = timeframe.period == '3' or timeframe.period == '5' or timeframe.period == '10' or timeframe.period == '15' or timeframe.period == '26' or timeframe.period == '30' or timeframe.period == '60' or timeframe.period == '120'
    Week_SR = timeframe.period == '1' or timeframe.period == '3' or timeframe.period == '5' or timeframe.period == '10' or timeframe.period == '15'

    //Time Setting for Label Placements
    Monthly_SR = timeframe.period == "180" or timeframe.period == "240" or timeframe.period == "300" or timeframe.isdaily
    Weekly_SR = timeframe.period == "26" or timeframe.period == "30" or timeframe.period == "60"
    Daily_SR = timeframe.period == "1" or timeframe.period == "3"or timeframe.period == "5" or timeframe.period == "10" or timeframe.period == "15"

    changePeriod = Daily_SR ? (abs(time("D") - time_close("D"))) / 3 :
    Weekly_SR ? (abs(time("W") - time_close("W"))) / 3 :
    Monthly_SR ? (abs(time("M") - time_close("M"))) / 3 :
    na

    start = Daily_SR ? time("D") + changePeriod :
    Weekly_SR ? time("W") + changePeriod :
    Monthly_SR ? time("M") + changePeriod :
    na

    //Colors for S/R Lines
    yearColor = input(title="Yıllık", type=input.color, defval=color.white)
    monthColor = input(title="Aylık", type=input.color, defval=color.orange)
    weekColor = input(title="Haftalık", type=input.color, defval=color.blue)

    //Style line

    // STEP 1. Make the input with pull-down menu
    styleOption = input(title="Line Style", type=input.string,
    options=["dashed (╌)","solid (─)"], defval="solid (─)")

    // STEP 2. Convert the input to a proper line style value
    lineStyle = (styleOption == "solid (─)") ? line.style_solid :
    (styleOption == "dashed (╌)") ? line.style_dashed :
    line.style_solid

    /////////////////////
    // Get HLC for Yearly Pivots//
    [yphigh, yplow, ypclose] = security(syminfo.tickerid, '12M', [high[1], low[1], close[1]], lookahead = true)

    //Yearly Pivot Points
    ypivot = (yphigh + yplow + ypclose) / 3
    yr7 = ypivot + (yphigh - yplow) * 2.000
    yr6 = ypivot + (yphigh - yplow) * 1.618
    yr5 = ypivot + (yphigh - yplow) * 1.414
    yr4 = ypivot + (yphigh - yplow) * 1.272
    yr3 = ypivot + (yphigh - yplow) * 1.000
    yrc = ypivot + (yphigh - yplow) * 0.764
    yr2 = ypivot + (yphigh - yplow) * 0.618
    yrb = ypivot + (yphigh - yplow) * 0.500
    yr1 = ypivot + (yphigh - yplow) * 0.382
    yra = ypivot + (yphigh - yplow) * 0.236
    ysa = ypivot - (yphigh - yplow) * 0.236
    ys1 = ypivot - (yphigh - yplow) * 0.382
    ysb = ypivot - (yphigh - yplow) * 0.500
    ys2 = ypivot - (yphigh - yplow) * 0.618
    ysc = ypivot - (yphigh - yplow) * 0.764
    ys3 = ypivot - (yphigh - yplow) * 1.000
    ys4 = ypivot - (yphigh - yplow) * 1.272
    ys5 = ypivot - (yphigh - yplow) * 1.414
    ys6 = ypivot - (yphigh - yplow) * 1.618
    ys7 = ypivot - (yphigh - yplow) * 2.000

    // Get HLC for Monthly Pivots//
    [mphigh, mplow, mpclose] = security(syminfo.tickerid, 'M', [high[1], low[1], close[1]], lookahead = true)

    //Monthly Pivot Points
    mpivot = (mphigh + mplow + mpclose) / 3
    mr7 = mpivot + (mphigh - mplow) * 2.000
    mr6 = mpivot + (mphigh - mplow) * 1.618
    mr5 = mpivot + (mphigh - mplow) * 1.414
    mr4 = mpivot + (mphigh - mplow) * 1.272
    mr3 = mpivot + (mphigh - mplow) * 1.000
    mrc = mpivot + (mphigh - mplow) * 0.764
    mr2 = mpivot + (mphigh - mplow) * 0.618
    mrb = mpivot + (mphigh - mplow) * 0.500
    mr1 = mpivot + (mphigh - mplow) * 0.382
    mra = mpivot + (mphigh - mplow) * 0.236
    msa = mpivot - (mphigh - mplow) * 0.236
    ms1 = mpivot - (mphigh - mplow) * 0.382
    msb = mpivot - (mphigh - mplow) * 0.500
    ms2 = mpivot - (mphigh - mplow) * 0.618
    msc = mpivot - (mphigh - mplow) * 0.764
    ms3 = mpivot - (mphigh - mplow) * 1.000
    ms4 = mpivot - (mphigh - mplow) * 1.272
    ms5 = mpivot - (mphigh - mplow) * 1.414
    ms6 = mpivot - (mphigh - mplow) * 1.618
    ms7 = mpivot - (mphigh - mplow) * 2.000

    // Get HLC for Weekly Pivots//
    [wphigh, wplow, wpclose] = security(syminfo.tickerid, 'W', [high[1], low[1], close[1]], lookahead = true)

    //Weekly Pivot Points
    wpivot = (wphigh + wplow + wpclose) / 3
    wr7 = wpivot + (wphigh - wplow) * 2.000
    wr6 = wpivot + (wphigh - wplow) * 1.618
    wr5 = wpivot + (wphigh - wplow) * 1.414
    wr4 = wpivot + (wphigh - wplow) * 1.272
    wr3 = wpivot + (wphigh - wplow) * 1.000
    wrc = wpivot + (wphigh - wplow) * 0.764
    wr2 = wpivot + (wphigh - wplow) * 0.618
    wrb = wpivot + (wphigh - wplow) * 0.500
    wr1 = wpivot + (wphigh - wplow) * 0.382
    wra = wpivot + (wphigh - wplow) * 0.236
    wsa = wpivot - (wphigh - wplow) * 0.236
    ws1 = wpivot - (wphigh - wplow) * 0.382
    wsb = wpivot - (wphigh - wplow) * 0.500
    ws2 = wpivot - (wphigh - wplow) * 0.618
    wsc = wpivot - (wphigh - wplow) * 0.764
    ws3 = wpivot - (wphigh - wplow) * 1.000
    ws4 = wpivot - (wphigh - wplow) * 1.272
    ws5 = wpivot - (wphigh - wplow) * 1.414
    ws6 = wpivot - (wphigh - wplow) * 1.618
    ws7 = wpivot - (wphigh - wplow) * 2.000


    //Mid level pivots

    //PIVOT LEVEL CONDITIONS
    closex = security(syminfo.tickerid, timeframe.period, close[1], gaps = barmerge.gaps_off, lookahead = barmerge.lookahead_on)

    //WEEK LEVEL CONFIGURATION

    // The notes are applicable to the other forumulas for the other time frames
    // so I did not duplicate them further down

    //Week Bull Rules
    wcloseHigh10 = closex > wr6 and closex < wr7 //closex is above than wr6 and below wr7
    wcloseHigh9 = closex > wr5 and closex < wr6 //closex is above than wr5 and below wr6
    wcloseHigh8 = closex > wr4 and closex < wr5 //closex is above than wr4 and below wr5
    wcloseHigh7 = closex > wr3 and closex < wr4 //closex is above than wr3 and below wr4
    wcloseHigh6 = closex > wrc and closex < wr3 //closex is above than wrc and below wr3
    wcloseHigh5 = closex > wr2 and closex < wrc //closex is above than wr2 and below wrc
    wcloseHigh4 = closex > wrb and closex < wr2 //closex is above than wrb and below wr2
    wcloseHigh3 = closex > wr1 and closex < wrb //closex is above than wr1 and below wrb
    wcloseHigh2 = closex > wra and closex < wr1 //closex is above than wra and below wr1
    wcloseHigh1 = closex > wpivot and closex < wra //closex is above than wpivot and below wra

    //Week Bear Rules
    wcloseLow1 = closex > wsa and closex < wpivot //closex is above than wsa and below wpivot
    wcloseLow2 = closex > ws1 and closex < wsa //closex is above than ws1 and below wsa
    wcloseLow3 = closex > wsb and closex < ws1 //closex is above than wsb and below ws1
    wcloseLow4 = closex > ws2 and closex < wsb //closex is above than ws2 and below wsb
    wcloseLow5 = closex > wsc and closex < ws2 //closex is above than wsc and below ws2
    wcloseLow6 = closex > ws3 and closex < wsc //closex is above than ws3 and below wsc
    wcloseLow7 = closex > ws4 and closex < ws3 //closex is above than ws4 and below ws3
    wcloseLow8 = closex > ws5 and closex < ws4 //closex is above than ws5 and below ws4
    wcloseLow9 = closex > ws6 and closex < ws5 //closex is above than ws6 and below ws5
    wcloseLow10 = closex > ws7 and closex < ws6 //closex is above than ws7 and below ws6

    //WEEK PRICE LEVELS//

    //Week Resistance Price Levels
    var float weekResistanceLevel = na

    //output of resistance pivot level based on conditions above
    weekResistanceLevel := wcloseHigh10 ? wr7 :
    wcloseHigh9 ? wr6 :
    wcloseHigh8 ? wr5 :
    wcloseHigh7 ? wr4 :
    wcloseHigh6 ? wr3 :
    wcloseHigh5 ? wrc :
    wcloseHigh4 ? wr2 :
    wcloseHigh3 ? wrb :
    wcloseHigh2 ? wr1 :
    wcloseHigh1 ? wra :
    wcloseLow1 ? wpivot :
    wcloseLow2 ? wsa :
    wcloseLow3 ? ws1 :
    wcloseLow4 ? wsb :
    wcloseLow5 ? ws2 :
    wcloseLow6 ? wsc :
    wcloseLow7 ? ws3 :
    wcloseLow8 ? ws4 :
    wcloseLow9 ? ws5 :
    wcloseLow10 ? ws6 :
    weekResistanceLevel

    //Week Support Price Levels
    var float weekSupportLevel = na

    //output of support pivot level based on conditions above
    weekSupportLevel := wcloseHigh10 ? wr6 :
    wcloseHigh9 ? wr5 :
    wcloseHigh8 ? wr4 :
    wcloseHigh7 ? wr3 :
    wcloseHigh6 ? wrc :
    wcloseHigh5 ? wr2 :
    wcloseHigh4 ? wrb :
    wcloseHigh3 ? wr1 :
    wcloseHigh2 ? wra :
    wcloseHigh1 ? wpivot :
    wcloseLow1 ? wsa :
    wcloseLow2 ? ws1 :
    wcloseLow3 ? wsb :
    wcloseLow4 ? ws2 :
    wcloseLow5 ? wsc :
    wcloseLow6 ? ws3 :
    wcloseLow7 ? ws4 :
    wcloseLow8 ? ws5 :
    wcloseLow9 ? ws6 :
    wcloseLow10 ? ws7 :
    weekSupportLevel

    //WEEK LABEL PLOTS//

    //Week Resistance Labels
    var string weekResistanceLabel = na

    //corresponding labels for pivot levels
    weekResistanceLabel := wcloseHigh10 ? "WR7" :
    wcloseHigh9 ? "WR6" :
    wcloseHigh8 ? "WR5" :
    wcloseHigh7 ? "WR4" :
    wcloseHigh6 ? "WR3" :
    wcloseHigh5 ? "WR-C" :
    wcloseHigh4 ? "WR2" :
    wcloseHigh3 ? "WR-B" :
    wcloseHigh2 ? "WR1" :
    wcloseHigh1 ? "WR-A" :
    wcloseLow1 ? "WPi" :
    wcloseLow2 ? "WS-A" :
    wcloseLow3 ? "WS1" :
    wcloseLow4 ? "WS-B" :
    wcloseLow5 ? "WS2" :
    wcloseLow6 ? "WS-C" :
    wcloseLow7 ? "WS3" :
    wcloseLow8 ? "WS4" :
    wcloseLow9 ? "WS5" :
    wcloseLow10 ? "WS6" :
    weekResistanceLabel

    //Week Support Labels
    var string weekSupportLabel = na

    weekSupportLabel := wcloseHigh10 ? "WR6" :
    wcloseHigh9 ? "WR5" :
    wcloseHigh8 ? "WR4" :
    wcloseHigh7 ? "WR3" :
    wcloseHigh6 ? "WR-C" :
    wcloseHigh5 ? "WR2" :
    wcloseHigh4 ? "WR-C" :
    wcloseHigh3 ? "WR1" :
    wcloseHigh2 ? "WR-A" :
    wcloseHigh1 ? "WPi" :
    wcloseLow1 ? "WS-A" :
    wcloseLow2 ? "WS1" :
    wcloseLow3 ? "WS-B" :
    wcloseLow4 ? "WS2" :
    wcloseLow5 ? "WS-C" :
    wcloseLow6 ? "WS3" :
    wcloseLow7 ? "WS4" :
    wcloseLow8 ? "WS5" :
    wcloseLow9 ? "WS6" :
    wcloseLow10 ? "WS7" :
    weekSupportLabel

    //To remove the zero line level

    //Week S/R Line & Label Plots
    var line weekRLevel = na
    var line weekSLevel = na
    var label weekRLabel = na
    var label weekSLabel = na

    if Week_SR
    weekRLevel := line.new(
    x1 = bar_index[1],
    y1 = weekResistanceLevel,
    x2 = bar_index,
    y2 = weekResistanceLevel,
    extend = extend.both,
    color = weekColor,
    style = lineStyle,
    width = 2)
    line.delete(weekRLevel[1])

    weekSLevel := line.new(
    x1 = bar_index[1],
    y1 = weekSupportLevel,
    x2 = bar_index,
    y2 = weekSupportLevel,
    extend = extend.both,
    color = weekColor,
    style = lineStyle,
    width = 2)
    line.delete(weekSLevel[1])

    weekRLabel := label.new(
    x = start,
    y = weekResistanceLevel,
    text = weekResistanceLabel,
    xloc = xloc.bar_time,
    yloc = yloc.price,
    style = label.style_none,
    textcolor = color.white)
    label.delete(weekRLabel[1])

    weekSLabel := label.new(
    x = start,
    y = weekSupportLevel,
    text = weekSupportLabel,
    xloc = xloc.bar_time,
    yloc = yloc.price,
    style = label.style_none,
    textcolor = color.white)
    label.delete(weekSLabel[1])

    //END OF WEEK CONFIGURATION//


    //MONTH LEVEL CONFIGURATION

    //Month Bull Rules
    mcloseHigh1 = closex > mpivot and closex < mra
    mcloseHigh2 = closex > mra and closex < mr1
    mcloseHigh3 = closex > mr1 and closex < mrb
    mcloseHigh4 = closex > mrb and closex < mr2
    mcloseHigh5 = closex > mr2 and closex < mrc
    mcloseHigh6 = closex > mrc and closex < mr3
    mcloseHigh7 = closex > mr3 and closex < mr4
    mcloseHigh8 = closex > mr4 and closex < mr5
    mcloseHigh9 = closex > mr5 and closex < mr6
    mcloseHigh10 = closex > mr6 and closex < mr7

    //Month Bear Rules
    mcloseLow1 = closex > msa and closex < mpivot
    mcloseLow2 = closex > ms1 and closex < msa
    mcloseLow3 = closex > msb and closex < ms1
    mcloseLow4 = closex > ms2 and closex < msb
    mcloseLow5 = closex > msc and closex < ms2
    mcloseLow6 = closex > ms3 and closex < msc
    mcloseLow7 = closex > ms4 and closex < ms3
    mcloseLow8 = closex > ms5 and closex < ms4
    mcloseLow9 = closex > ms6 and closex < ms5
    mcloseLow10 = closex > ms7 and closex < ms6

    //MONTH PRICE LEVELS//

    //Month Resistance Price Levels
    var float monthResistanceLevel = na

    monthResistanceLevel := mcloseHigh10 ? mr7 :
    mcloseHigh9 ? mr6 :
    mcloseHigh8 ? mr5 :
    mcloseHigh7 ? mr4 :
    mcloseHigh6 ? mr3 :
    mcloseHigh5 ? mrc :
    mcloseHigh4 ? mr2 :
    mcloseHigh3 ? mrb :
    mcloseHigh2 ? mr1 :
    mcloseHigh1 ? mra :
    mcloseLow1 ? mpivot :
    mcloseLow2 ? msa :
    mcloseLow3 ? ms1 :
    mcloseLow4 ? msb :
    mcloseLow5 ? ms2 :
    mcloseLow6 ? msc :
    mcloseLow7 ? ms3 :
    mcloseLow8 ? ms4 :
    mcloseLow9 ? ms5 :
    mcloseLow10 ? ms6 :
    monthResistanceLevel

    //Month Support Price Levels
    var float monthSupportLevel = na

    monthSupportLevel := mcloseHigh10 ? mr6 :
    mcloseHigh9 ? mr5 :
    mcloseHigh8 ? mr4 :
    mcloseHigh7 ? mr3 :
    mcloseHigh6 ? mrc :
    mcloseHigh5 ? mr2 :
    mcloseHigh4 ? mrb :
    mcloseHigh3 ? mr1 :
    mcloseHigh2 ? mra :
    mcloseHigh1 ? mpivot :
    mcloseLow1 ? msa :
    mcloseLow2 ? ms1 :
    mcloseLow3 ? msb :
    mcloseLow4 ? ms2 :
    mcloseLow5 ? msc :
    mcloseLow6 ? ms3 :
    mcloseLow7 ? ms4 :
    mcloseLow8 ? ms5 :
    mcloseLow9 ? ms6 :
    mcloseLow10 ? ms7 :
    monthSupportLevel

    //MONTH LABEL PLOTS//

    //Resistance Label Plots
    var string monthResistanceLabel = na

    //Bull Resistance Titles
    monthResistanceLabel := mcloseHigh10 ? "MR7" :
    mcloseHigh9 ? "MR6" :
    mcloseHigh8 ? "MR5" :
    mcloseHigh7 ? "MR4" :
    mcloseHigh6 ? "MR3" :
    mcloseHigh5 ? "MR-C" :
    mcloseHigh4 ? "MR2" :
    mcloseHigh3 ? "MR-B" :
    mcloseHigh2 ? "MR1" :
    mcloseHigh1 ? "MR-A" :
    monthResistanceLabel

    //Bear Resistance Titles
    monthResistanceLabel := mcloseLow1 ? "MPi" :
    mcloseLow2 ? "MS-A" :
    mcloseLow3 ? "MS1" :
    mcloseLow4 ? "MS-B" :
    mcloseLow5 ? "MS2" :
    mcloseLow6 ? "MS-C" :
    mcloseLow7 ? "MS3" :
    mcloseLow8 ? "MS4" :
    mcloseLow9 ? "MS5" :
    mcloseLow10 ? "MS6" :
    monthResistanceLabel

    //Support Label Plots
    var string monthSupportLabel = na

    //Bull Support Titles
    monthSupportLabel := mcloseHigh10 ? "MR6" :
    mcloseHigh9 ? "MR5" :
    mcloseHigh8 ? "MR4" :
    mcloseHigh7 ? "MR3" :
    mcloseHigh6 ? "MR-C" :
    mcloseHigh5 ? "MR2" :
    mcloseHigh4 ? "MR-B" :
    mcloseHigh3 ? "MR1" :
    mcloseHigh2 ? "MR-A" :
    mcloseHigh1 ? "MPib" :
    monthSupportLabel

    //Bear Support Titles
    monthSupportLabel := mcloseLow1 ? "MS-A" :
    mcloseLow2 ? "MS1" :
    mcloseLow3 ? "MS-B" :
    mcloseLow4 ? "MS2" :
    mcloseLow5 ? "MS-C" :
    mcloseLow6 ? "MS3" :
    mcloseLow7 ? "MS4" :
    mcloseLow8 ? "MS5" :
    mcloseLow9 ? "MS6" :
    mcloseLow10 ? "MS7" :
    monthSupportLabel

    //Month S/R Line & Label Plots
    var line monthRLevel = na
    var line monthSLevel = na
    var label monthRLabel = na
    var label monthSLabel = na

    if Month_SR
    monthRLevel := line.new(
    x1 = bar_index[1],
    y1 = monthResistanceLevel,
    x2 = bar_index,
    y2 = monthResistanceLevel,
    extend = extend.both,
    color = monthColor,
    style = lineStyle,
    width = 2)
    line.delete(monthRLevel[1])

    monthSLevel := line.new(
    x1 = bar_index[1],
    y1 = monthSupportLevel,
    x2 = bar_index,
    y2 = monthSupportLevel,
    extend = extend.both,
    color = monthColor,
    style = lineStyle,
    width = 2)
    line.delete(monthSLevel[1])

    monthRLabel := label.new(
    x = start,
    y = monthResistanceLevel,
    text = monthResistanceLabel,
    xloc = xloc.bar_time,
    yloc = yloc.price,
    style = label.style_none,
    textcolor = color.white)
    label.delete(monthRLabel[1])

    monthSLabel := label.new(
    x = start,
    y = monthSupportLevel,
    text = monthSupportLabel,
    xloc = xloc.bar_time,
    yloc = yloc.price,
    style = label.style_none,
    textcolor = color.white)
    label.delete(monthSLabel[1])

    //END OF MONTH CONFIGURATION//


    //YEAR LEVEL CONFIGURATION//

    //Year Bull Rules
    ycloseHigh1 = closex > ypivot and closex < yra
    ycloseHigh2 = closex > yra and closex < yr1
    ycloseHigh3 = closex > yr1 and closex < yrb
    ycloseHigh4 = closex > yrb and closex < yr2
    ycloseHigh5 = closex > yr2 and closex < yrc
    ycloseHigh6 = closex > yrc and closex < yr3
    ycloseHigh7 = closex > yr3 and closex < yr4
    ycloseHigh8 = closex > yr4 and closex < yr5
    ycloseHigh9 = closex > yr5 and closex < yr6
    ycloseHigh10 = closex > yr6 and closex < yr7

    //Year Bear Rules
    ycloseLow1 = closex > ysa and closex < ypivot
    ycloseLow2 = closex > ys1 and closex < ysa
    ycloseLow3 = closex > ysb and closex < ys1
    ycloseLow4 = closex > ys2 and closex < ysb
    ycloseLow5 = closex > ysc and closex < ys2
    ycloseLow6 = closex > ys3 and closex < ysc
    ycloseLow7 = closex > ys4 and closex < ys3
    ycloseLow8 = closex > ys5 and closex < ys4
    ycloseLow9 = closex > ys6 and closex < ys5
    ycloseLow10 = closex > ys7 and closex < ys6


    //YEAR PRICE LEVELS//

    //Year Resistance Price Levels
    var float yearResistanceLevel = na

    yearResistanceLevel := ycloseHigh10 ? yr7 :
    ycloseHigh9 ? yr6 :
    ycloseHigh8 ? yr5 :
    ycloseHigh7 ? yr4 :
    ycloseHigh6 ? yr3 :
    ycloseHigh5 ? yrc :
    ycloseHigh4 ? yr2 :
    ycloseHigh3 ? yrb :
    ycloseHigh2 ? yr1 :
    ycloseHigh1 ? yra :
    ycloseLow1 ? ypivot :
    ycloseLow2 ? ysa :
    ycloseLow3 ? ys1 :
    ycloseLow4 ? ysb :
    ycloseLow5 ? ys2 :
    ycloseLow6 ? ysc :
    ycloseLow7 ? ys3 :
    ycloseLow8 ? ys4 :
    ycloseLow9 ? ys5 :
    ycloseLow10 ? ys6 :
    yearResistanceLevel

    //Year Support Price Levels
    var float yearSupportLevel = na

    yearSupportLevel := ycloseHigh10 ? yr6 :
    ycloseHigh9 ? yr5 :
    ycloseHigh8 ? yr4 :
    ycloseHigh7 ? yr3 :
    ycloseHigh6 ? yrc :
    ycloseHigh5 ? yr2 :
    ycloseHigh4 ? yrb :
    ycloseHigh3 ? yr1 :
    ycloseHigh2 ? yra :
    ycloseHigh1 ? ypivot :
    ycloseLow1 ? ysa :
    ycloseLow2 ? ys1 :
    ycloseLow3 ? ysb :
    ycloseLow4 ? ys2 :
    ycloseLow5 ? ysc :
    ycloseLow6 ? ys3 :
    ycloseLow7 ? ys4 :
    ycloseLow8 ? ys5 :
    ycloseLow9 ? ys6 :
    ycloseLow10 ? ys7 :
    yearSupportLevel

    //YEAR LABEL PLOTS//

    //Year Resistance Labels
    var string yearResistanceLabel = na

    yearResistanceLabel := ycloseHigh10 ? "YWR7" :
    ycloseHigh9 ? "YWR6" :
    ycloseHigh8 ? "YWR5" :
    ycloseHigh7 ? "YWR4" :
    ycloseHigh6 ? "YWR3" :
    ycloseHigh5 ? "YWR-C" :
    ycloseHigh4 ? "YWR2" :
    ycloseHigh3 ? "YWR-B" :
    ycloseHigh2 ? "YWR1" :
    ycloseHigh1 ? "YWR-A" :
    ycloseLow1 ? "YWPi" :
    ycloseLow2 ? "YWS-A" :
    ycloseLow3 ? "YWS1" :
    ycloseLow4 ? "YWS-B" :
    ycloseLow5 ? "YWS2" :
    ycloseLow6 ? "YWS-C" :
    ycloseLow7 ? "YWS3" :
    ycloseLow8 ? "YWS4" :
    ycloseLow9 ? "YWS5" :
    ycloseLow10 ? "YWS6" :
    yearResistanceLabel

    //Year Support Labels
    var string yearSupportLabel = na

    yearSupportLabel := ycloseHigh10 ? "YR6" :
    ycloseHigh9 ? "YR5" :
    ycloseHigh8 ? "YR4" :
    ycloseHigh7 ? "YR3" :
    ycloseHigh6 ? "YR-C" :
    ycloseHigh5 ? "YR2" :
    ycloseHigh4 ? "YR-B" :
    ycloseHigh3 ? "YR1" :
    ycloseHigh2 ? "YR-A" :
    ycloseHigh1 ? "YPi" :
    ycloseLow1 ? "YS-A" :
    ycloseLow2 ? "YS1" :
    ycloseLow3 ? "YS-B" :
    ycloseLow4 ? "YS2" :
    ycloseLow5 ? "YS-C" :
    ycloseLow6 ? "YS3" :
    ycloseLow7 ? "YS4" :
    ycloseLow8 ? "YS5" :
    ycloseLow9 ? "YS6" :
    ycloseLow10 ? "YS7" :
    yearSupportLabel

    //Year S/R Line & Label Plots
    var line yearRLevel = na
    var line yearSLevel = na
    var label yearRLabel = na
    var label yearSLabel = na

    if Year_SR
    yearRLevel := line.new(
    x1 = bar_index[1],
    y1 = yearResistanceLevel,
    x2 = bar_index,
    y2 = yearResistanceLevel,
    extend = extend.both,
    color = yearColor,
    style = lineStyle,
    width = 2)
    line.delete(yearRLevel[1])

    yearSLevel := line.new(
    x1 = bar_index[1],
    y1 = yearSupportLevel,
    x2 = bar_index,
    y2 = yearSupportLevel,
    extend = extend.both,
    color = yearColor,
    style = lineStyle,
    width = 2)
    line.delete(yearSLevel[1])

    yearRLabel := label.new(
    x = start,
    y = yearResistanceLevel,
    text = yearResistanceLabel,
    xloc = xloc.bar_time,
    yloc = yloc.price,
    style = label.style_none,
    textcolor = color.white)
    label.delete(yearRLabel[1])

    yearSLabel := label.new(
    x = start,
    y = yearSupportLevel,
    text = yearSupportLabel,
    xloc = xloc.bar_time,
    style = label.style_none,
    textcolor = color.white)
    label.delete(yearSLabel[1])

    //END OF SCRIPT



    // Parameter
    //************************************************** ************************************************** ********

    indiSet = input(false, "â•â•â•â•â•â•â•â•â• MRC Parameter â•â•â•â•â•â•â•â•")
    source = input(hlc3, title="Price Source", type=input.source)
    type = input("SuperSmoother", title="Filter Type", options=["SuperSmoother", "Ehlers EMA", "Gaussian", "Butterworth", "BandStop", "SMA", "EMA", "RMA"])
    length = input(5, title="Lookback Period",minval=1)
    innermult = input(1.0, title="Inner Channel Size Multiplier", minval = 0.1)
    outermult = input(2.415, title="Outer Channel Size Multiplier", minval = 0.1)

    ChartSet = input(false, "â•â•â•â•â•â•â•â•â• Chart Setting â•â•â•â•â•â•â•â•")
    drawchannel = input(false, title="Draw Channel")
    displayzone = input(false, title="Draw Zone (With Channel)")
    zonetransp = input(0, title="Zone Transparency", minval=0, maxval=100)
    displayline = input(true, title="Display Line Extension")

    MTFSet = input(false, "â•â•â•â•â•â•â•â•â• MTF Setting â•â•â•â•â•â•â•â•")
    enable_mtf = input(false, title="Enable Multiple TimeFrame Analysis")
    mtf_disp_typ= input("On Hover", title="MTF Display Type", options=["Always Display", "On Hover"])
    mtf_typ = input("Auto", title="Multiple TimeFrame Type", options=["Auto", "Custom"])
    mtf_lvl1 = input("D", title="Custom MTF Level 1", type=input.resolution)
    mtf_lvl2 = input("W", title="Custom MTF Level 2", type=input.resolution)

    //************************************************** ************************************************** ********
    // Functions Start {
    //************************************************** ************************************************** ********
    var pi = 2 * asin(1)
    var mult = pi * innermult
    var mult2 = pi * outermult
    var gradsize = 0.5
    var gradtransp = zonetransp

    //-----------------------
    // Ehler SwissArmyKnife Function
    //-----------------------
    SAK_smoothing(_type, _src, _length) =>
    c0 = 1.0
    c1 = 0.0
    b0 = 1.0
    b1 = 0.0
    b2 = 0.0
    a1 = 0.0
    a2 = 0.0
    alpha = 0.0
    beta = 0.0
    gamma = 0.0
    cycle = 2 * pi / _length

    if _type == "Ehlers EMA"
    alpha := (cos(cycle) + sin(cycle) - 1) / cos(cycle)
    b0 := alpha
    a1 := 1 - alpha
    if _type == "Gaussian"
    beta := 2.415 * (1 - cos(cycle))
    alpha := -beta + sqrt((beta * beta) + (2 * beta))
    c0 := alpha * alpha
    a1 := 2 * (1 - alpha)
    a2 := -(1 - alpha) * (1 - alpha)
    if _type == "Butterworth"
    beta := 2.415 * (1 - cos(cycle))
    alpha := -beta + sqrt((beta * beta) + (2 * beta))
    c0 := alpha * alpha / 4
    b1 := 2
    b2 := 1
    a1 := 2 * (1 - alpha)
    a2 := -(1 - alpha) * (1 - alpha)
    if _type == "BandStop"
    beta := cos(cycle)
    gamma := 1 / cos(cycle*2*0.1) // delta default to 0.1. Acceptable delta -- 0.05<d<0.5
    alpha := gamma - sqrt((gamma * gamma) - 1)
    c0 := (1 + alpha) / 2
    b1 := -2 * beta
    b2 := 1
    a1 := beta * (1 + alpha)
    a2 := -alpha
    if _type == "SMA"
    c1 := 1 / _length
    b0 := 1 / _length
    a1 := 1
    if _type == "EMA"
    alpha := 2/(_length+1)
    b0 := alpha
    a1 := 1 - alpha
    if _type == "RMA"
    alpha := 1 / _length
    b0 := alpha
    a1 := 1 - alpha

    _Input = _src
    _Output = 0.0
    _Output := (c0 * ((b0 * _Input) + (b1 * nz(_Input[1])) + (b2 * nz(_Input[2])))) + (a1 * nz(_Output[1])) + (a2 * nz(_Output[2])) - (c1 * nz(_Input[_length]))

    //-----------------------
    // SuperSmoother Function
    //-----------------------
    supersmoother(_src, _length) =>
    s_a1 = exp(-sqrt(2) * pi / _length)
    s_b1 = 2 * s_a1 * cos(sqrt(2) * pi / _length)
    s_c3 = -pow(s_a1, 2)
    s_c2 = s_b1
    s_c1 = 1 - s_c2 - s_c3
    ss = 0.0
    ss := s_c1 * _src + s_c2 * nz(ss[1], _src[1]) + s_c3 * nz(ss[2], _src[2])

    //-----------------------
    // Auto TimeFrame Function
    //-----------------------
    // ————— Converts current chart resolution into a float minutes value.
    f_resInMinutes() =>
    _resInMinutes = timeframe.multiplier * (
    timeframe.isseconds ? 1. / 60 :
    timeframe.isminutes ? 1. :
    timeframe.isdaily ? 60. * 24 :
    timeframe.isweekly ? 60. * 24 * 7 :
    timeframe.ismonthly ? 60. * 24 * 30.4375 : na)

    get_tf(_lvl)=>
    y = f_resInMinutes()
    z = timeframe.period
    if(mtf_typ=="Auto")
    if y < 1
    z := _lvl == 1 ? "1" : _lvl == 2 ? "5" : z
    else if y <= 3
    z := _lvl == 1 ? "5" : _lvl == 2 ? "15" : z
    else if y <= 10
    z := _lvl == 1 ? "15" : _lvl == 2 ? "60" : z
    else if y <= 30
    z := _lvl == 1 ? "60" : _lvl == 2 ? "240" : z
    else if y <= 120
    z := _lvl == 1 ? "240" : _lvl == 2 ? "D" : z
    else if y <= 240
    z := _lvl == 1 ? "D" : _lvl == 2 ? "W" : z
    else if y <= 1440
    z := _lvl == 1 ? "W" : _lvl == 2 ? "M" : z
    else if y <= 10080
    z := _lvl == 1 ? "M" : z
    else
    z := z
    else
    z := _lvl == 1 ? mtf_lvl1 : _lvl == 2 ? mtf_lvl2 : z

    z

    //-----------------------
    // Mean Reversion Channel Function
    //-----------------------
    get_mrc()=>
    v_condition = 0
    v_meanline = source
    v_meanrange = supersmoother(tr, length)

    //-- Get Line value
    if(type == "SuperSmoother")
    v_meanline := supersmoother(source, length)

    if(type != "SuperSmoother")
    v_meanline := SAK_smoothing(type, source, length)

    v_upband1 = v_meanline+(v_meanrange*mult)
    v_loband1 = v_meanline-(v_meanrange*mult)
    v_upband2 = v_meanline+(v_meanrange*mult2)
    v_loband2 = v_meanline-(v_meanrange*mult2)

    //-- Check Condition
    if(close > v_meanline)
    v_upband2_1 = v_upband2 + (v_meanrange * gradsize * 4)
    v_upband2_9 = v_upband2 + (v_meanrange * gradsize * -4)
    if(high >= v_upband2_9 and high < v_upband2)
    v_condition := 1
    else if(high >= v_upband2 and high < v_upband2_1)
    v_condition := 2
    else if(high >= v_upband2_1)
    v_condition := 3
    else if(close <= v_meanline+v_meanrange)
    v_condition := 4
    else
    v_condition := 5

    if(close < v_meanline)
    v_loband2_1 = v_loband2 - (v_meanrange * gradsize * 4)
    v_loband2_9 = v_loband2 - (v_meanrange * gradsize * -4)
    if(low <= v_loband2_9 and low > v_loband2)
    v_condition := -1
    else if(low <= v_loband2 and low > v_loband2_1)
    v_condition := -2
    else if(low <= v_loband2_1)
    v_condition := -3
    else if(close >= v_meanline+v_meanrange)
    v_condition := -4
    else
    v_condition := -5

    [v_meanline, v_meanrange, v_upband1, v_loband1, v_upband2, v_loband2, v_condition]

    //-----------------------
    // MTF Analysis
    //-----------------------

    get_stat(_cond) =>
    ret = "Price at Mean Line\n"
    if (_cond == 1)
    ret := "Overbought (Weak)\n"
    else if (_cond == 2)
    ret := "Overbought\n"
    else if (_cond == 3)
    ret := "Overbought (Strong)\n"
    else if (_cond == 4)
    ret := "Price Near Mean\n"
    else if (_cond == 5)
    ret := "Price Above Mean\n"
    else if (_cond == -1)
    ret := "Oversold (Weak)\n"
    else if (_cond == -2)
    ret := "Oversold\n"
    else if (_cond == -3)
    ret := "Oversold (Strong)\n"
    else if (_cond == -4)
    ret := "Price Near Mean\n"
    else if (_cond == -5)
    ret := "Price Below Mean\n"
    ret

    //-----------------------
    // Chart Drawing Function
    //-----------------------
    format_price(x) =>
    y = tostring(x, "0.00000")
    if(x>10)
    y := tostring(x, "0.000")
    if(x>1000)
    y := tostring(x, "0.00")
    y

    f_PriceLine(_ref, linecol) =>
    line.new(
    x1 = bar_index, x2 = bar_index - 1,
    y1 = _ref, y2 = _ref,
    extend = extend.left,
    color = linecol)

    f_MTFLabel(_txt, _yloc) =>
    label.new(
    x = time + round(change(time)*20),
    y = _yloc,
    xloc = xloc.bar_time,
    text = mtf_disp_typ == "Always Display" ? _txt : "Check MTF",
    tooltip = mtf_disp_typ == "Always Display" ? "" : _txt,
    color = color.black,
    textcolor = color.white,
    size = size.normal,
    style = mtf_disp_typ == "On Hover" and displayline ? label.style_label_lower_left : label.style_label_left,
    textalign = text.align_left)

    //} Function End

    //************************************************** ************************************************** ********
    // Calculate Channel
    //************************************************** ************************************************** ********
    var tf_0 = timeframe.period
    var tf_1 = get_tf(1)
    var tf_2 = get_tf(2)

    [meanline, meanrange, upband1, loband1, upband2, loband2, condition] = get_mrc()
    [mtf1_meanline, mtf1_meanrange, mtf1_upband1, mtf1_loband1, mtf1_upband2, mtf1_loband2, mtf1_condition] = security(syminfo.tickerid, tf_1, get_mrc())
    [mtf2_meanline, mtf2_meanrange, mtf2_upband1, mtf2_loband1, mtf2_upband2, mtf2_loband2, mtf2_condition] = security(syminfo.tickerid, tf_2, get_mrc())

    //************************************************** ************************************************** ********
    // Drawing Start {
    //************************************************** ************************************************** ********
    float p_meanline = drawchannel ? meanline : na
    float p_upband1 = drawchannel ? upband1 : na
    float p_loband1 = drawchannel ? loband1 : na
    float p_upband2 = drawchannel ? upband2 : na
    float p_loband2 = drawchannel ? loband2 : na

    z = plot(p_meanline, color=#FFCD00, style=plot.style_line, title=" Mean", linewidth=2)
    x1 = plot(p_upband1, color=color.green, style=plot.style_circles, title=" R1", linewidth=1, transp=50)
    x2 = plot(p_loband1, color=color.green, style=plot.style_circles, title=" S1", linewidth=1, transp=50)
    y1 = plot(p_upband2, color=color.red, style=plot.style_line, title=" R2", linewidth=1, transp=50)
    y2 = plot(p_loband2, color=color.red, style=plot.style_line, title=" S2", linewidth=1, transp=50)

    //-----------------------
    // Draw zone
    //-----------------------
    //---
    var color1 = #FF0000, var color2 = #FF4200, var color3 = #FF5D00, var color4 = #FF7400, var color5 = #FF9700, var color6 = #FFAE00, var color7 = #FFC500, var color8 = #FFCD00
    //---
    float upband2_1 = drawchannel and displayzone ? upband2 + (meanrange * gradsize * 4) : na, float loband2_1 = drawchannel and displayzone ? loband2 - (meanrange * gradsize * 4) : na
    float upband2_2 = drawchannel and displayzone ? upband2 + (meanrange * gradsize * 3) : na, float loband2_2 = drawchannel and displayzone ? loband2 - (meanrange * gradsize * 3) : na
    float upband2_3 = drawchannel and displayzone ? upband2 + (meanrange * gradsize * 2) : na, float loband2_3 = drawchannel and displayzone ? loband2 - (meanrange * gradsize * 2) : na
    float upband2_4 = drawchannel and displayzone ? upband2 + (meanrange * gradsize * 1) : na, float loband2_4 = drawchannel and displayzone ? loband2 - (meanrange * gradsize * 1) : na
    float upband2_5 = drawchannel and displayzone ? upband2 + (meanrange * gradsize * 0) : na, float loband2_5 = drawchannel and displayzone ? loband2 - (meanrange * gradsize * 0) : na
    float upband2_6 = drawchannel and displayzone ? upband2 + (meanrange * gradsize * -1) : na, float loband2_6 = drawchannel and displayzone ? loband2 - (meanrange * gradsize * -1) : na
    float upband2_7 = drawchannel and displayzone ? upband2 + (meanrange * gradsize * -2) : na, float loband2_7 = drawchannel and displayzone ? loband2 - (meanrange * gradsize * -2) : na
    float upband2_8 = drawchannel and displayzone ? upband2 + (meanrange * gradsize * -3) : na, float loband2_8 = drawchannel and displayzone ? loband2 - (meanrange * gradsize * -3) : na
    float upband2_9 = drawchannel and displayzone ? upband2 + (meanrange * gradsize * -4) : na, float loband2_9 = drawchannel and displayzone ? loband2 - (meanrange * gradsize * -4) : na
    //-----------------------
    // Plot Extension
    //-----------------------
    if(displayline and enable_mtf and mtf_disp_typ == "Always Display")
    displayline := false

    var line mean = na, line.delete(mean), mean := displayline ? f_PriceLine(meanline, #FFCD00) : na
    var line res1 = na, line.delete(res1), res1 := displayline ? f_PriceLine(upband1, color.green) : na
    var line sup1 = na, line.delete(sup1), sup1 := displayline ? f_PriceLine(loband1, color.green) : na
    var line res2 = na, line.delete(res2), res2 := displayline ? f_PriceLine(upband2, color.red) : na
    var line sup2 = na, line.delete(sup2), sup2 := displayline ? f_PriceLine(loband2, color.red) : na

    //--------------
    // Prep MTF Label
    //--------------
    var brl = "\n--------------------------------------"
    dist_0 = "Distance from Mean: "+ tostring(((close-meanline)/close)*100, "#.##") + " %"
    dist_1 = "Distance from Mean: "+ tostring(((close-mtf1_meanline)/close)*100, "#.##") + " %"
    dist_2 = "Distance from Mean: "+ tostring(((close-mtf2_meanline)/close)*100, "#.##") + " %"

    var title = "Mean Reversion Channel\nMultiple TimeFrame Analysis" + brl
    tf0 =
    "\n\nTimeframe: "+ tf_0 + " (Current)\n\nStatus: " + get_stat(condition) + dist_0 + brl

    tf1 = not timeframe.ismonthly ?
    "\n\nTimeframe: "+ tf_1 + "\n\nStatus: " + get_stat(mtf1_condition) + dist_1 + brl : ""

    tf2 = not timeframe.isweekly and not timeframe.ismonthly ?
    "\n\nTimeframe: "+ tf_2 + "\n\nStatus: " + get_stat(mtf2_condition) + dist_2 + brl : ""

    mtf_lbl = title+tf0+tf1+tf2
    var label label_mtf = na, label.delete(label_mtf), label_mtf := enable_mtf ? f_MTFLabel(mtf_lbl, meanline) : na

    //} Drawing End


    src = input(close)
    len = input(5)

    k = input(2.9652)

    dispOR = input(false, title="Display outlier range")
    dispBB = input(false, title="Use filtered SMA & MAD to create BB ?")
    BBk = input(2.9652, title="BB mult")

    median = percentile_nearest_rank(src,len,50)
    MAD = percentile_nearest_rank(abs(src - median), len, 50)


    up = median + MAD * k
    dn = median - MAD * k

    outlier = src >= up or src <= dn

    sumsrc = 0.0
    count = 0

    for i = 0 to 5 * len
    sumsrc := outlier[i] ? sumsrc : sumsrc + src[i]
    count := outlier[i] ? count : count + 1
    if count == len
    break

    meanx = sumsrc / count

    plot(meanx, linewidth=2, color=color.white, title="?", transp=100)


    input = input(close),robust = input(true)
    //----
    b=0.,sc=0.,a=0.
    sc := robust ? abs(input - nz(b[1]))/(abs(input - nz(b[1])) + nz(a[1])) : 1
    src11 = sc*input+(1-sc)*nz(b[1],input)
    //----
    n = cum(1)-1
    a := cum(abs(src11 - nz(b[1],src11)))/n*(iff(robust,1,0)+sc)
    b := src11 > nz(b[1],src11) + a ? src11 : src11 < nz(b[1],src11) - a ? src11 : nz(b[1],src11)
    //----
    plot(b,color=#E040FB ,linewidth=2,transp=0)

    //@version=4

    lb = input(50, title="Left Bars", minval=1)
    rb = input(5, title="Right Bars", minval=1)
    showpivot = input(true, title="Show Pivot Points")
    chdashed = input(false, title="Show Old Line as Dashed")
    ucolor = input(defval = color.black, title = "Uptrend line color")
    dcolor = input(defval = color.black, title = "Downtrend line color")

    mb = lb + rb + 1

    float top = na
    float bot = na
    top := iff(not na(high[mb]), iff(highestbars(high, mb) == -rb, high[rb], na), na) // Pivot High
    bot := iff(not na(low[mb]), iff(lowestbars(low, mb) == -rb, low[rb], na), na) // Pivot Low

    plotshape(top and showpivot, text="PVS", style=shape.labeldown, color=color.yellow, textcolor=color.black, location=location.abovebar, offset = -rb)
    plotshape(bot and showpivot, text="PVA", style=shape.labeldown, color=color.yellow, textcolor=color.black, location=location.belowbar, offset = -rb)

    ltop = valuewhen(top, top, 1)
    bst = 0
    bst := top ? 1 : nz(bst[1]) + 1
    float t_angle = 0.0
    t_angle := t_angle[1]
    if not na(ltop) and not na(top)
    line tline = na
    if ltop > top
    tline := line.new(bar_index - bst[1] - rb, high[bst[1] + rb], bar_index - rb, high[rb], color = dcolor, extend = extend.right)
    t_angle := (high[bst[1] + rb] - high[rb]) / bst[1]
    if t_angle < t_angle[1] and t_angle[1] != 0
    line.set_extend(tline[1], extend = extend.none)
    if t_angle > t_angle[1] and t_angle[1] != 0
    line.set_extend(tline, extend = extend.none)
    if ltop <= top
    t_angle := 0.0
    if chdashed
    line.set_style(tline[1], style = line.style_dashed)

    lbot = valuewhen(bot, bot, 1)
    bsb = 0
    bsb := bot ? 1 : nz(bsb[1]) + 1
    float b_angle = 0.0
    b_angle := b_angle[1]
    if not na(lbot) and not na(bot)
    line bline = na
    if lbot < bot
    bline := line.new(bar_index - bsb[1] - rb, low[bsb[1] + rb], bar_index - rb, low[rb], color = ucolor, extend = extend.right)
    b_angle := (low[bsb[1] + rb] - low[rb]) / bsb[1]
    if b_angle > b_angle[1] and b_angle[1] != 0
    line.set_extend(bline[1], extend = extend.none)
    if b_angle < b_angle[1] and b_angle[1] != 0
    line.set_extend(bline, extend = extend.none)
    if lbot >= bot
    b_angle := 0.0
    if chdashed
    line.set_style(bline[1], style = line.style_dashed)


    // @version = 4
    //////////////////////////////////////////////////////////////////////////////
    // Inputs and global variable declarations

    i_srcPrice = input ( close, "SMI Price Source", input.source )
    i_SMI_len = input ( 4, "SMI Length", input.integer, minval = 1 )
    i_smth1 = input ( 8, "Smooth Length 1", input.integer, minval = 1 )
    i_smth2 = input ( 2, "Smooth Length 2", input.integer, minval = 1 )
    i_sigLen = input ( 32, "Signal Length", input.integer, minval = 1 )
    i_alrtInfo = input ( true, "Show Alert Levels Info", input.bool )
    i_alrtHi = input ( 40, "Upper Alert Level", input.float, minval = -100, maxval = 100)
    i_midLine = input ( 0, "Midline", input.integer, minval = -100, maxval = 100)
    i_alrtLo = input ( -40, "Lower Alert Level", input.float, minval = -100, maxval = 100)
    i_alrtLines = input ( false, "Show Alert Level Lines", input.bool )
    i_infoBox = input ( true, "Show Info Box", input.bool )
    i_decimalP = input ( 2, "Prices Decimal Places", input.integer, minval = 0, maxval = 10)
    i_boxOffSet = input ( 5, "Info Box Offset", input.integer, minval = 1, maxval = 50)

    ScaleHi = 100
    ScaleLo = -100

    var label Infobox = na

    ///////////////////////////////////////////////////////////////////////////////
    // Declare Functions

    f_truncdNum ( Val, DecPl ) =>
    Fact = pow ( 10, DecPl )
    int( Val * Fact) / Fact

    // decimal truncation

    a11(x) => 2 / (x + 1)

    // exponentially weighted multiplier

    f_reverse_SMI ( P, U, W, X, Y, Z ) =>
    V = 0.5
    H = highest(W)
    L = lowest(W)
    D = ema (( P - V * ( H + L )), X )[1]
    E = ema ((( a11(X)* ( P - V * ( H + L )))+( D -D*a11(X))), Y )[1]
    F = ema ( H - L , X )[1]
    G = ema ((( a11(X)*( H -L ) + F*( 1 -a11(X)))), Y )[1]
    J = 100 * (( a11(Y)* ( ( a11(X)* ( P - V * ( H + L ))) + ( D - D*a11(X)))) + ( E * ( 1 -a11(Y)) )) / ( V * (a11(Y)*((a11(X)*( H -L ) + F*( 1 -a11(X)))) + ( G*( 1 -a11(Y)))))[1]
    K = ema ( ( 100 * (( a11(Y)* ( ( a11(X)* ( P - V * ( H + L ))) + ( D - D*a11(X)))) + ( E * ( 1 -a11(Y)) )) / ( V * (a11(Y)*((a11(X)*( H -L ) + F*( 1 -a11(X)))) + ( G*( 1 -a11(Y)))))), Z )[1]
    rawReturn = ( V*U*(a11(Y)*a11(X)*H -a11(Y)*a11(X)*L -a11(Y)*F*a11(X) +a11(Y)*F -G*a11(Y) + G) + 100*(a11(Y)*a11(X)*V*H +a11(Y)*a11(X)*V*L -a11(Y)*D +a11(Y)*D*a11(X) +E*a11(Y) -E)) / ( 100*a11(Y)*a11(X))
    return = rawReturn > 0 ? rawReturn : 0

    // returns price where Stochastic Momentum Index is equal to input value "U"
    // e.g. f_reverse_SMI ( close, 0, 13, 25, 2, 12 )
    // would return the next closing price which would make SMI = 0
    // the user can infer from this that.....
    // closing above this price will cause the Stochastic Momentum Index to cross above the mid line
    // and closing below it will cause the Stochastic Momentum Index to cross below the mid line
    // This may also be used to give the SMI eq price (the price which would make the SMI equal to its prior value)
    // this is done by inputing the prior value of the SMI (SMI[1]) as the "U" value
    // e.g. f_reverse_SMI ( close, SMI[1], 13, 25, 2, 12 )
    // The user can infer from this that.....
    // closing above this price will cause the Stochastic Momentum Index to increase
    // and closing below it will cause the Stochastic Momentum Index to decrease
    // has a Return filter to replace any values below zero with zero

    f_reverse_SMI_cross ( P, W, X, Y, Z ) =>
    V = 0.5
    H = highest(W)
    L = lowest(W)
    D = ema (( P - V * ( H + L )), X )[1]
    E = ema (((a11(X)* ( P - V * ( H + L )))+( D -D*a11(X))), Y )[1]
    F = ema ( H - L , X )[1]
    G = ema (((a11(X)*( H -L ) + F*( 1 -a11(X)))), Y )[1]
    J = 100 * (( a11(Y)* ( ( a11(X)* ( P - V * ( H + L ))) + ( D - D*a11(X)))) + ( E * ( 1 -a11(Y)) )) / ( V * (a11(Y)*((a11(X)*( H -L ) + F*( 1 -a11(X)))) + ( G*( 1 -a11(Y)))))[1]
    K = ema ( ( 100 * (( a11(Y)* ( ( a11(X)* ( P - V * ( H + L ))) + ( D - D*a11(X)))) + ( E * ( 1 -a11(Y)) )) / ( V * (a11(Y)*((a11(X)*( H -L ) + F*( 1 -a11(X)))) + ( G*( 1 -a11(Y)))))), Z )[1]
    rawReturn = ( a11(Y)*(100*( a11(Z)*(-a11(X)*V*H -a11(X)*V*L +D -D*a11(X) -a11(X) -E) +a11(X)*V*H +a11(X)*V*L -D +D*a11(X) +E) +V*K*(a11(X)*(-H*a11(Z) +H +L*a11(Z) -L +F*a11(Z) -F) -F*a11(Z) +F +G*a11(Z) -G)) +100*(a11(Z)*E-E) -V*K*G*a11(Z) +V*K*G)/(100*a11(Y)*a11(X)*(-a11(Z)+1))
    return = rawReturn > 0 ? rawReturn : 0

    // returns price where Stochastic Momentum Index is equal to the signal line
    // the user can infer from this that.....
    // closing above this price will cause the Stochastic Momentum Index to cross above the signal line
    // and closing below it will cause the Stochastic Momentum Index to cross below the signal line
    // has a Return filter to replace any values below zero with zero

    f_delta ( P, X ) => X - P > 0

    f_negVal ( X, D ) => X > 0 ? tostring ( f_truncdNum ( X, D )) : "İmkansız"

    text_eq ( p, x, d ) => p > x ? "Boğa Devam (eq) : " + tostring(int(x*pow(10,d))/pow(10,d)) : "Ayı Devam (Eq) :" + tostring(int(x*pow(10,d))/pow(10,d))

    f_crossText ( P, X, T, D ) => f_delta ( P, X ) ? "Yukarı Kesme " + T + " : " + f_negVal ( X, D ) + "\n" : "Aşağı Kesme " + T + " : " + f_negVal ( X, D ) + "\n"

    //////////////////////////////////////////////////////////////////////////////
    // Calculations

    SMINumerator = ema ( ema ( i_srcPrice - 0.5 * ( highest (i_SMI_len) + lowest (i_SMI_len)), i_smth1 ), i_smth2 )
    SMIDenominator = 0.5 * ema ( ema ( highest (i_SMI_len) - lowest (i_SMI_len), i_smth1 ), i_smth2 )
    SMI = 100 * SMINumerator / SMIDenominator
    SMI_eq = f_reverse_SMI ( i_srcPrice, SMI[1], i_SMI_len, i_smth1, i_smth2, i_sigLen )
    alrtHilineCross = f_reverse_SMI ( i_srcPrice, i_alrtHi, i_SMI_len, i_smth1, i_smth2, i_sigLen )
    zerolineCross = f_reverse_SMI ( i_srcPrice, 0, i_SMI_len, i_smth1, i_smth2, i_sigLen )
    alrtLolineCross = f_reverse_SMI ( i_srcPrice, i_alrtLo, i_SMI_len, i_smth1, i_smth2, i_sigLen )
    signalCross = f_reverse_SMI_cross ( i_srcPrice, i_SMI_len, i_smth1, i_smth2, i_sigLen )


    ///////////////////////////////////////////////////////////////////////////////
    // Compute Info Label

    labelXLoc = time_close + ( i_boxOffSet * ( time_close - time_close[1] ) )
    crossSignalText = f_crossText ( i_srcPrice, signalCross, "Sinyal", i_decimalP )
    SMIeq = text_eq ( i_srcPrice, SMI_eq, i_decimalP )
    crossZeroText = f_crossText ( i_srcPrice, zerolineCross, "0 Noktası", i_decimalP )
    crossAlrtHiText = f_crossText ( i_srcPrice, alrtHilineCross, "Tepe Alarm", i_decimalP )
    crossAlrtLoText = f_crossText ( i_srcPrice, alrtLolineCross, "Dip Alarm", i_decimalP )
    infoBoxText = i_alrtInfo ? "Yörük\n\n" + SMIeq + "\n\n" + crossAlrtHiText + "\n" + crossSignalText + "\n" + crossZeroText + "\n" + crossAlrtLoText : "Yörük\n\n" + SMIeq + "\n\n" + crossSignalText + "\n" + crossZeroText

    ///////////////////////////////////////////////////////////////////////////////
    // InfoBox Plot

    if i_infoBox
    Infobox := label.new ( labelXLoc, close, infoBoxText, xloc.bar_time, yloc.price, #000000ff, label.style_label_left, color.yellow )

    label.delete ( Infobox[1] )

    ///////////////////////////////////////////////////////////////////////////////
    // SMI Plots & Fills

    p_alrtHiPlot = plot ( i_alrtLines ? alrtHilineCross : na, "High", color.**ua, 1, plot.style_linebr, transp = 100 )
    p_alrtLoPlot = plot ( i_alrtLines ? alrtLolineCross : na, "Low ", color.purple, 1, plot.style_linebr, transp = 100 )
    p_SMI_eqPlot = plot ( SMI_eq, "Durum", SMI_eq < i_srcPrice ? color.green: color.red, 2, plot.style_linebr, transp = 100)
    p_smiPlot = plot ( signalCross, "SinyalTakip", signalCross < i_srcPrice ? #0ebb23 : #FF0000, 2, plot.style_linebr, transp = 100)
    p_MidLinePlot = plot ( zerolineCross, "O Noktası", color.white, 1, plot.style_linebr, transp = 100)

    ///////////////////////////////////////////////////////////////////////////////
    // End
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.

  2. ikinci bölümün ilk kodu ise fiyatın yüksek ve düşüğünden trigger ile trend yönü belirleme için...
    ekranda sarı üçgenler fiyat tepe-dip, diğer yeşil-kırmızı üçgenler ise trigger al sat sinyalleri...

    ikinci kod ise 3 değeriyle aylık-haftalık-günlük döngüleri, label olarak görmek ve durumda trendi görmek...

    üçüncü kod ise watermark...

    görüntü


    birleşmiş kod örneği
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © Vallahualem
    //@version=4
    study(title="Sıkılaşma Durumları", shorttitle="*", overlay=true, format=format.inherit)

    TSR() =>

    // start with uptrend
    var uptrend = true
    var EP = high // extreme price - high or low depending on trend
    var SP = low // setup price
    var TP = float(na) // trigger price


    var setup = low
    var trigger = float(na)

    if barstate.isnew
    setup := low
    trigger = float(na)

    extreme_candle = false
    first_extreme_candle = false
    setup_candle = false
    trigger_candle = false

    waiting_for_setup = false
    waiting_for_trigger = false

    var since_extreme = 0
    var since_setup = 0

    waiting_for_setup := not extreme_candle and not na(SP)
    waiting_for_trigger := not na(TP)

    if not barstate.isfirst
    if barstate.isnew and extreme_candle[1]
    trigger := float(na)
    if barstate.isnew and setup_candle[1]
    setup := float(na)
    if barstate.isnew and waiting_for_trigger
    since_setup := since_setup + 1
    trigger := TP
    if barstate.isnew and waiting_for_setup
    since_extreme := since_extreme + 1
    setup := SP
    if uptrend

    if extreme_candle
    EP := high
    SP := low
    else
    if high > EP
    extreme_candle := true
    EP := high
    SP := low
    since_extreme := 0
    since_setup := 0
    else
    if waiting_for_setup
    if barstate.isconfirmed
    if close < SP
    setup_candle := true
    SP := float(na)
    TP := low
    if waiting_for_trigger
    if low < TP
    trigger_candle := true
    extreme_candle := true
    EP := low
    SP := high
    TP := float(na)
    uptrend := false
    since_extreme := 0
    since_setup := 0
    else
    if barstate.isconfirmed and extreme_candle
    TP := float(na)
    trigger := float(na)

    else
    if extreme_candle
    EP := low
    SP := high
    else
    if low < EP
    extreme_candle := true
    EP := low
    SP := high
    since_extreme := 0
    since_setup := 0
    else
    if waiting_for_setup
    if barstate.isconfirmed
    if close > SP
    setup_candle := true
    SP := float(na)
    TP := high
    if waiting_for_trigger
    if high > TP
    trigger_candle := true
    extreme_candle := true
    EP := high
    SP := low
    TP := float(na)
    uptrend := true
    since_extreme := 0
    since_setup := 0
    else
    if barstate.isconfirmed and extreme_candle
    TP := float(na)
    trigger := float(na)


    [trigger_candle, trigger, since_setup, setup_candle, setup, since_extreme, extreme_candle, uptrend]


    [TC, T, SS, SC, S, SE, EC, up] = TSR()

    plotshape(SC and not up, color = color.yellow, style = shape.triangleup, location = location.belowbar, size = size.small, transp = 0, title = "Setup to Buy")
    plotshape(TC and up, color = color.green, style = shape.triangleup, location = location.belowbar, size = size.small, title = "Trigger to Buy")
    plotshape(SC and up, color = color.yellow, style = shape.triangledown, location = location.abovebar, size = size.small, transp = 0, title = "Setup to Sell")
    plotshape(TC and not up, color = color.red, style = shape.triangledown, location = location.abovebar, size = size.small, title = "Trigger to Sell")
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © Vallahualem
    t_length = input(3, title="Fractal Length", type=input.integer, minval=1)
    getPoint(candles) =>
    newHigherHigh = high > highest(candles)[1]
    newLowerLow = low < lowest(candles)[1]
    closeAboveLowerLow = close > highest(low, candles)[1]
    closeBelowHigherHigh = close < lowest(high, candles)[1]
    newHigherHigh and closeAboveLowerLow ? 1 : newLowerLow and closeBelowHigherHigh ? -1 : 0


    getDirection(length) =>
    point = getPoint(length)
    int dir = na
    dir := point != 0 ? point : dir[1]
    reverse = dir != dir[1] ? dir : na
    [dir, reverse]

    is_newbar(res) =>
    t = time(res)
    not na(t) and (na(t[1]) or t > t[1])

    getDirectionRes(res, c_dir, c_reverse) =>
    int dir = na
    dir := is_newbar(res) ? security(syminfo.tickerid, res, c_dir) : dir[1]
    reverse = is_newbar(res) ? security(syminfo.tickerid, res, c_reverse) : na
    [dir, reverse]


    [c_dir, c_reverse] = getDirection(t_length)
    [d_dir, d_reverse] = getDirectionRes('D', c_dir, c_reverse)
    [w_dir, w_reverse] = getDirectionRes('W', c_dir, c_reverse)
    [m_dir, m_reverse] = getDirectionRes('M', c_dir, c_reverse)

    periodFactor() =>
    timeframe.isintraday ? (timeframe.multiplier) : timeframe.isdaily ? (timeframe.multiplier * 60 * 24) : timeframe.isweekly ? (timeframe.multiplier * 7 * 60 * 24) : (timeframe.multiplier * 4 * 7 * 60 * 24)

    testPeriod(res) =>
    current = periodFactor()
    test = security(syminfo.tickerid, res, periodFactor())
    current < test

    d_period = testPeriod('D')
    w_period = testPeriod('W')
    m_period = testPeriod('M')

    plotshape(d_reverse == 1 and d_period, title='Daily Up', text='Gün', style=shape.labelup, location=location.belowbar, color=color.green, textcolor=color.white, size=size.tiny)
    plotshape(d_reverse == -1 and d_period, title='Daily Down', text='Gün', style=shape.labeldown, location=location.abovebar, color=color.red, textcolor=color.white, size=size.tiny)

    plotshape(w_reverse == 1 and w_period, title='Weekly Up', text='Hft', style=shape.labelup, location=location.belowbar, color=color.green, textcolor=color.white, size=size.small)
    plotshape(w_reverse == -1 and w_period, title='Weekly Down', text='Hft', style=shape.labeldown, location=location.abovebar, color=color.red, textcolor=color.white, size=size.small)

    plotshape(m_reverse == 1 and m_period, title='Monthly Up', text='Ay', style=shape.labelup, location=location.belowbar, color=color.green, textcolor=color.white, size=size.large)
    plotshape(m_reverse == -1 and m_period, title='Monthly Down', text='Ay', style=shape.labeldown, location=location.abovebar, color=color.red, textcolor=color.white, size=size.large)


    // panel
    p_offsetx = input(defval=40,type=input.integer, title="Panel X")
    p_offsety = input(defval=-350,type=input.integer, title="Panel Y")

    p_x = timenow + (round(change(time)) * p_offsetx)
    p_y = highest(20) + p_offsety * syminfo.mintick * syminfo.pointvalue

    p_showPanel = input(true, "Show Panel")

    if (p_showPanel)
    p_text = "Durum: " + (c_dir == 1 ? "â–²" : "â–¼") + (d_period ? "\nGünlük: " + (d_dir == 1 ? "â–²" : "â–¼") : "") + (w_period ? "\nHaftalık: " + (w_dir == 1 ? "â–²" : "â–¼") : "") + (m_period ? "\nAylık: " + (m_dir == 1 ? "â–²" : "â–¼") : "")
    var label _la = na
    label.delete(_la)
    _la := label.new(p_x, p_y, text=p_text, xloc=xloc.bar_time, yloc=yloc.price,
    color=color.black, style=label.style_labelup, textcolor=color.white, size=size.normal)




    string i_text1 = input(istediğinizi yazın", "Text 1", inline = "11")
    string i_text2 = input("", "Text 2", inline = "11", tooltip = "Clear 'Text 2' to prevent animation.")
    string i_tableYpos = input("bottom", "Position", inline = "12", options = ["top", "middle", "bottom"])
    string i_tableXpos = input("center", "", inline = "12", options = ["left", "center", "right"])
    int i_height = input(10, "Height", minval = 1, maxval = 100, inline = "13")
    int i_width = input(100, "Width", minval = 1, maxval = 100, inline = "13", tooltip = "1-100")
    color i_c_text = input(color.new(color.white, 30), "Text", inline = "14")
    string i_textSize = input("normal", "Size", inline = "14", options = ["tiny", "small", "normal", "large", "huge", "auto"])
    color i_c_bg = input(color.new(color.black, 50), "Background")

    // We use `var` to only initialize the table on the first bar.
    var table watermark = table.new(i_tableYpos + "_" + i_tableXpos, 1, 1)

    // We only populate the table on the last bar; it's more efficient.
    if barstate.islast
    // This `varip` variable will preserve its value across realtime updates.
    varip bool _changeText = true
    // Toggle this value on each update.
    _changeText := not _changeText
    // If there's a "Text 2" string in inputs and it's time to flip, change the text.
    string _txt = str.length(i_text2) != 0 and _changeText ? i_text2 : i_text1
    // Populate our table cell.
    table.cell(watermark, 0, 0, _txt, i_width, i_height, i_c_text, text_size = i_textSize, bgcolor = i_c_bg)



    değerler ve stil ayarlarını kendinize göre değiştirebilirsiniz....
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.

  3. son bölümün ilk kodu ise bar açılış kapanışına göre hazır strateji.....

    ikinci kod ise 0dan başlatılan günlük-seanslık-saatlik psar mtf ler....
    üçüncü kod ise yavaşlatılmış psarlar....
    dördüncü ise ekranda görülen psar hesaplaması....
    5-1 değeriyle bar açılış kapanışlara göre takip çizgiler....
    son olarak 3-1 mov hesaplaması....

    görüntü


    birleşmiş kod örneği

    //@version=3
    //
    //
    // Revision: 5
    // Original Author: @JayRogers
    // Revision Author: JustUncleL revisions 3, 4, 5
    //
    // *** USE AT YOUR OWN RISK ***
    // - There are drawing/painting issues in pinescript when working across resolutions/timeframes that I simply
    // cannot fix here.. I will not be putting any further effort into developing this until such a time when
    // workarounds become available.
    // NOTE: Re-painting has been observed infrequently with default settings and seems OK up to Alternate
    // multiplier of 5.
    // Non-repainting mode is available by setting "Delay Open/Close MA" to 1 or more, but the reported
    // performance will drop dramatically.
    //
    // R5.1 Changes by JustUncleL
    // - Upgraded to Version 3 Pinescript.
    // - Added option to select Trade type (Long, Short, Both or None)
    // - Added bar colouring work around patch.
    // - Small code changes to improve efficiency.
    // - NOTE: To enable non-Repainting mode set "Delay Open/Close MA" to 1 or more.
    // 9-Aug-2017
    // - Correction on SuperSmooth MA calculation.
    //
    // R5 Changes by JustUncleL
    // - Corrected cross over calculations, sometimes gave false signals.
    // - Corrected Alternate Time calculation to allow for Daily,Weekly and Monthly charts.
    // - Open Public release.
    // R4 Changes By JustUncleL
    // - Change the way the Alternate resolution in selected, use a Multiplier of the base Time Frame instead,
    // this makes it easy to switch between base time frames.
    // - Added TMA and SSMA moving average options. But DEMA is still giving the best results.
    // - Using "calc_on_every_tick=false" ensures results between backtesting and real time are similar.
    // - Added Option to Disable the coloring of the bars.
    // - Updated default settings.
    //
    // R3 Changes by JustUncleL:
    // - Returned a simplified version of the open/close channel, it shows strength of current trend.
    // - Added Target Profit Option.
    // - Added option to reduce the number of historical bars, overcomes the too many trades limit error.
    // - Simplified the strategy code.
    // - Removed Trailing Stop option, not required and in my opion does not work well in Trading View,
    // it also gives false and unrealistic performance results in backtesting.
    //
    // R2 Changes:
    // - Simplified and cleaned up plotting, now just shows a Moving Average derived from the average of open/close.
    // - Tried very hard to alleviate painting issues caused by referencing alternate resolution..
    //
    // Description:
    // - Strategy based around Open-Close Crossovers.
    // Setup:
    // - I have generally found that setting the strategy resolution to 3-4x that of the chart you are viewing
    // tends to yield the best results, regardless of which MA option you may choose (if any) BUT can cause
    // a lot of false positives - be aware of this
    // - Don't aim for perfection. Just aim to get a reasonably snug fit with the O-C band, with good runs of
    // green and red.
    // - Option to either use basic open and close series data, or pick your poison with a wide array of MA types.
    // - Optional trailing stop for damage mitigation if desired (can be toggled on/off)
    // - Positions get taken automagically following a crossover - which is why it's better to set the resolution
    // of the script greater than that of your chart, so that the trades get taken sooner rather than later.
    // - If you make use of the stops, be sure to take your time tweaking the values. Cutting it too fine
    // will cost you profits but keep you safer, while letting them loose could lead to more drawdown than you
    // can handle.
    // - To enable non-Repainting mode set "Delay Open/Close MA" to 1 or more.
    //
    strategy(title = "Psar ve Bar Stratejisi", shorttitle = "!", overlay = true,
    pyramiding = 0, default_qty_type = strategy.percent_of_equity, default_qty_value = 10, calc_on_every_tick=false)
    // === INPUTS ===
    useRes = input(defval = true, title = "Use Alternate Resolution?")
    intRes = input(defval = 3, title = "Multiplier for Alernate Resolution")
    stratRes = ismonthly? tostring(interval*intRes,"###M") : isweekly? tostring(interval*intRes,"###W") : isdaily? tostring(interval*intRes,"###D") : isintraday ? tostring(interval*intRes,"####") : '60'
    basisType = input(defval = "ALMA", title = "MA Type: ", options=["SMA", "EMA", "DEMA", "TEMA", "WMA", "VWMA", "SMMA", "HullMA", "LSMA", "ALMA", "SSMA", "TMA"])
    basisLen = input(defval = 5, title = "MA Period", minval = 1)
    offsetSigma = input(defval = 4, title = "Offset for LSMA / Sigma for ALMA", minval = 0)
    offsetALMA = input(defval = 1.85, title = "Offset for ALMA", minval = 0, step = 0.01)
    scolor = input(false, title="Show coloured Bars to indicate Trend?")
    delayOffset = input(defval = 0, title = "Delay Open/Close MA (Forces Non-Repainting)", minval = 0, step = 1)
    tradeType = input("BOTH", title="What trades should be taken : ", options=["LONG", "SHORT", "BOTH", "NONE"])
    // === /INPUTS ===

    // Constants colours that include fully non-transparent option.
    green100 = #008000FF
    lime100 = #00FF00FF
    red100 = #FF0000FF
    blue100 = #0000FFFF
    **ua100 = #00FFFFFF
    darkred100 = #8B0000FF
    gray100 = #808080FF

    // === BASE FUNCTIONS ===
    // Returns MA input selection variant, default to SMA if blank or typo.
    variant(type, src, len, offSig, offALMA) =>
    v1 = sma(src, len) // Simple
    v2 = ema(src, len) // Exponential
    v3 = 2 * v2 - ema(v2, len) // Double Exponential
    v4 = 3 * (v2 - ema(v2, len)) + ema(ema(v2, len), len) // Triple Exponential
    v5 = wma(src, len) // Weighted
    v6 = vwma(src, len) // Volume Weighted
    v7 = 0.0
    v7 := na(v7[1]) ? sma(src, len) : (v7[1] * (len - 1) + src) / len // Smoothed
    v8 = wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len))) // Hull
    v9 = linreg(src, len, offSig) // Least Squares
    v10 = alma(src, len, offALMA, offSig) // Arnaud Legoux
    v11 = sma(v1,len) // Triangular (extreme smooth)
    // SuperSmoother filter
    // © 2013 John F. Ehlers
    a1 = exp(-1.414*3.14159 / len)
    b1 = 2*a1*cos(1.414*3.14159 / len)
    c2 = b1
    c3 = (-a1)*a1
    c1 = 1 - c2 - c3
    v12 = 0.0
    v12 := c1*(src + nz(src[1])) / 2 + c2*nz(v12[1]) + c3*nz(v12[2])
    type=="EMA"?v2 : type=="DEMA"?v3 : type=="TEMA"?v4 : type=="WMA"?v5 : type=="VWMA"?v6 : type=="SMMA"?v7 : type=="HullMA"?v8 : type=="LSMA"?v9 : type=="ALMA"?v10 : type=="TMA"?v11: type=="SSMA"?v12: v1

    // security wrapper for repeat calls
    reso(exp, use, res) => use ? security(tickerid, res, exp, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_on) : exp

    // === /BASE FUNCTIONS ===

    // === SERIES SETUP ===
    closeSeries = variant(basisType, close[delayOffset], basisLen, offsetSigma, offsetALMA)
    openSeries = variant(basisType, open[delayOffset], basisLen, offsetSigma, offsetALMA)
    // === /SERIES ===

    // === PLOTTING ===

    // Get Alternate resolution Series if selected.
    closeSeriesAlt = reso(closeSeries, useRes, stratRes)
    openSeriesAlt = reso(openSeries, useRes, stratRes)
    //
    trendColour = (closeSeriesAlt > openSeriesAlt) ? green : red
    bcolour = (closeSeries > openSeriesAlt) ? lime100 : red100
    // === ALERT conditions
    xlong = crossover(closeSeriesAlt, openSeriesAlt)
    xshort = crossunder(closeSeriesAlt, openSeriesAlt)
    longCond = xlong // alternative: longCond[1]? false : (xlong or xlong[1]) and close>closeSeriesAlt and close>=open
    shortCond = xshort // alternative: shortCond[1]? false : (xshort or xshort[1]) and close<closeSeriesAlt and close<=open
    // === /ALERT conditions.

    // === STRATEGY ===
    // stop loss
    slPoints = input(defval = 0, title = "Initial Stop Loss Points (zero to disable)", minval = 0)
    tpPoints = input(defval = 0, title = "Initial Target Profit Points (zero for disable)", minval = 0)
    // Include bar limiting algorithm
    ebar = input(defval = 1000, title="Number of Bars for Back Testing", minval=0)
    dummy = input(false, title="- SET to ZERO for Daily or Longer Timeframes" )
    //
    // Calculate how many mars since last bar
    tdays = (timenow-time)/60000.0 // number of minutes since last bar
    tdays := ismonthly? tdays/1440.0/5.0/4.3/interval : isweekly? tdays/1440.0/5.0/interval : isdaily? tdays/1440.0/interval : tdays/interval // number of bars since last bar
    //
    //set up exit parameters
    TP = tpPoints>0?tpPoints:na
    SL = slPoints>0?slPoints:na

    // Make sure we are within the bar range, Set up entries and exit conditions
    if ((ebar==0 or tdays<=ebar) and tradeType!="NONE")
    strategy.entry("Al", strategy.long, when=longCond==true and tradeType!="SHORT")
    strategy.entry("Sat", strategy.short, when=shortCond==true and tradeType!="LONG")
    strategy.close("Al", when = shortCond==true and tradeType=="LONG")
    strategy.close("Sat", when = longCond==true and tradeType=="SHORT")
    strategy.exit("XL", from_entry = "Al", profit = TP, loss = SL)
    strategy.exit("XS", from_entry = "Sat", profit = TP, loss = SL)

    // === /STRATEGY ===The End

    // ÖZEL PSARLAR
    start32 = input(0)
    inc32 = input(0.1)
    max32 = input(0.2)
    start_232 = input(0.1)
    inc_232 = input(0.02)
    max_232 = input(0.2)
    sar132 = sar(start32, inc32, max32)
    sar232 = sar(start_232, inc_232, max_232)
    y60 = security(tickerid, '60', sar132)
    y240 = security(tickerid, '240', sar132)
    yd = security(tickerid, 'D', sar132)
    acx32 = input(true, title="Adaptive Coloring", type=bool)
    plot(y60, title="Saat", style=circles, color=acx32?(y60>high?red:**ua):silver, transp=100, linewidth=1)
    plot(y240, title="Seans", style=circles, color=acx32?(y240>y60?red:**ua):silver, transp=100, linewidth=1)
    plot(yd, title="Gün", style=circles, color=acx32?(yd>y240?red:**ua):silver, transp=100, linewidth=1)
    // ÖZEL PSARLAR
    s3232 = sar(0.0,0.01,0.2)
    m3232 = sar(0.0,0.19,0.2)
    f3232 = sar(0.0,0.001,0.2)
    plot(s3232, title="İ2", style=circles, color=acx32?(s3232>close?**ua:red):silver, transp=100, linewidth=1)
    plot(m3232, title="İ1", style=circles, color=acx32?(m3232>close?**ua:red):silver, transp=100, linewidth=1)
    plot(f3232, title="İ3", style=circles, color=acx32?(f3232>close?**ua:red):silver, transp=100, linewidth=1)
    // ÖZEL PSARLAR
    start44 = input(0, minval=0, maxval=1, title="Start - Default = 2 - Multiplied by .01")
    increment44 = input(0.9, minval=0, maxval=1, title="Step Setting (Sensitivity) - Default = 2 - Multiplied by .01" )
    maximum44 = input(1, minval=0, maxval=1, title="Maximum Step (Sensitivity) - Default = 2 - Multiplied by .10")
    sus = input(true, "Show Up Trending Parabolic Sar")
    sds = input(true, "Show Down Trending Parabolic Sar")
    disc = input(false, title="Start and Step settings are *.01 so 2 = .02 etc, Maximum Step is *.10 so 2 = .2")
    startCalc = start44 * .01
    incrementCalc = increment44 * .01
    maximumCalc = maximum44 * .10
    sarUp = sar(startCalc, incrementCalc, maximumCalc)
    sarDown = sar(startCalc, incrementCalc, maximumCalc)
    colUp = close >= sarDown ? lime : na
    colDown = close <= sarUp ? red : na
    plot(sus and sarUp ? sarUp : na, title="S-Al", style=circles, linewidth=2, color=colUp)
    plot(sds and sarDown ? sarDown : na, title="S-Sat", style=circles, linewidth=2,color=colDown)
    // ÖZEL PSARLAR
    len1=input(5, "long length")
    len2=input(1, "short length")
    up=highest(high,len1)
    down=lowest(low,len1)
    sup=highest(high,len2)
    sdown=lowest(low,len2)
    K1=iff(barssince(close>up[1])<=barssince(close<down[1]),down,up)
    K2=iff(barssince(close>up[1])<=barssince(close<down[1]),sdown,sup)
    K3=iff(close>K1,down,na)
    K4=iff(close<K1,up,na)
    plot(K1, title="O1", color=blue, linewidth=1, style=2, transp=0)
    plot(K2, title="O2", color=yellow, linewidth=1, style=2, transp=0)
    //---------------------------------------------------------

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

    //Created by user ChrisMoody 4-24-2014
    //Plots The Majority of Moving Averages
    //Defaults to Current Chart Time Frame --- But Can Be Changed to Higher Or Lower Time Frames
    //2nd MA Capability with Show Crosses Feature

    //inputs
    src = close
    useCurrentRes = input(true, title="Use Current Chart Resolution?")
    resCustom = input(title="Use Different Timeframe? Uncheck Box Above", type=resolution, defval="D")
    len = input(3, title="Moving Average Length - LookBack Period")
    atype = input(1,minval=7,maxval=7,title="1=SMA, 2=EMA, 3=WMA, 4=HullMA, 5=VWMA, 6=RMA, 7=TEMA")
    cc = input(true,title="Change Color Based On Direction?")
    smoothe = input(3, minval=1, maxval=10, title="Color Smoothing - 1 = No Smoothing")
    doma2 = input(false, title="Optional 2nd Moving Average")
    len255 = input(10, title="Moving Average Length - Optional 2nd MA")
    atype2 = input(1,minval=4,maxval=7,title="1=SMA, 2=EMA, 3=WMA, 4=HullMA, 5=VWMA, 6=RMA, 7=TEMA")
    cc2 = input(false,title="Change Color Based On Direction 2nd MA?")
    warn = input(false, title="***You Can Turn On The Show Dots Parameter Below Without Plotting 2nd MA to See Crosses***")
    warn2 = input(false, title="***If Using Cross Feature W/O Plotting 2ndMA - Make Sure 2ndMA Parameters are Set Correctly***")
    sd = input(false, title="Show Dots on Cross of Both MA's")


    res = useCurrentRes ? period : resCustom
    //hull ma definition
    hullma = wma(2*wma(src, len/2)-wma(src, len), round(sqrt(len)))
    //TEMA definition
    ema1 = ema(src, len)
    ema2 = ema(ema1, len)
    ema3 = ema(ema2, len)
    tema = 3 * (ema1 - ema2) + ema3

    avg = atype == 1 ? sma(src,len) : atype == 2 ? ema(src,len) : atype == 3 ? wma(src,len) : atype == 4 ? hullma : atype == 5 ? vwma(src, len) : atype == 6 ? rma(src,len) : tema
    //2nd Ma - hull ma definition
    hullma2 = wma(2*wma(src, len255/2)-wma(src, len255), round(sqrt(len255)))
    //2nd MA TEMA definition
    sema1 = ema(src, len255)
    sema2 = ema(sema1, len255)
    sema3 = ema(sema2, len255)
    stema = 3 * (sema1 - sema2) + sema3

    avg2 = atype2 == 1 ? sma(src,len255) : atype2 == 2 ? ema(src,len255) : atype2 == 3 ? wma(src,len255) : atype2 == 4 ? hullma2 : atype2 == 5 ? vwma(src, len255) : atype2 == 6 ? rma(src,len255) : tema

    out = avg
    out_two = avg2

    out1 = security(tickerid, res, out)
    out2 = security(tickerid, res, out_two)

    ma_up = out1 >= out1[smoothe]
    ma_down = out1 < out1[smoothe]

    col = cc ? ma_up ? lime : ma_down ? red : **ua : **ua
    col2 = cc2 ? ma_up ? lime : ma_down ? red : **ua : **ua

    circleYPosition = out2

    plot(out1, title="Mtf", style=line, linewidth=2, color = col, transp=50)
    plot(doma2 and out2 ? out2 : na, title="Mtf2", style=circles, linewidth=4, color=col2, transp=100)
    plot(sd and cross(out1, out2) ? circleYPosition : na,style=cross, linewidth=5, color=yellow, transp=100)


    değerler ve ayarlar değiştirilebilir....
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.

  4. strateji örneği....
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.

  5. öylesine indikatör çalışması...
    2-1 uzunlukta high-low olarak... fiyat takip eden yıldız modellemesi....

    strateji, yıldız modelinin içinde geçerli olması koşulu ile...
    trend gücü, trend yönü, direnç-destek-stop belirleme üzerine...
    örnekler...
    https://www.tradingview.com/x/OQ6Xg80N/

    direnç-destek-stop yerlerine örnek....
    https://www.tradingview.com/x/QhpE8t0B/

    periyot örneklemeleri...
    h4-d-w
    https://www.tradingview.com/x/5vZM2XTV/
    https://www.tradingview.com/x/7n9IV89u/
    https://www.tradingview.com/x/YU07doap/
    https://www.tradingview.com/x/9BszQEez/
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.

  6.  Alıntı Originally Posted by @yörük@ Yazıyı Oku
    öylesine indikatör çalışması...
    2-1 uzunlukta high-low olarak... fiyat takip eden yıldız modellemesi....

    strateji, yıldız modelinin içinde geçerli olması koşulu ile...
    trend gücü, trend yönü, direnç-destek-stop belirleme üzerine...
    örnekler...
    https://www.tradingview.com/x/OQ6Xg80N/

    direnç-destek-stop yerlerine örnek....
    https://www.tradingview.com/x/QhpE8t0B/

    periyot örneklemeleri...
    h4-d-w
    https://www.tradingview.com/x/5vZM2XTV/
    https://www.tradingview.com/x/7n9IV89u/
    https://www.tradingview.com/x/YU07doap/
    https://www.tradingview.com/x/9BszQEez/
    modellemenin...
    100 barla test edilmesi ve dinamik pivotlarla ilişkilendirilmesi....
    örnekler....

    https://www.tradingview.com/x/p1Pncuo1/
    https://www.tradingview.com/x/aEM4UwKM/
    https://www.tradingview.com/x/x43UKAtw/
    https://www.tradingview.com/x/7HkKCiEL/
    https://www.tradingview.com/x/SXc3IUTE/
    Teknik olarak; yarına gebe olan bugünü yaşamalı ki, yarın, yaşanmış olsun.


Sayfa 65/272 İlkİlk ... 1555636465666775115165 ... 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
  •