Sayfa 223/276 İlkİlk ... 123173213221222223224225233273 ... SonSon
Arama sonucu : 2208 madde; 1,777 - 1,784 arası.

Konu: Tradingview

  1. PHP Code:
     //@version=5
    // Copyright (c) 2019-present, Franklin Moormann (cheatcountry)
    // True Range Adjusted Exponential Moving Average [CC] script may be freely distributed under the MIT license.
    indicator('*'max_bars_back 500overlay true)

    float inp55 input(title 'Source'defval close)
    string res55 input.timeframe(title 'Resolution'defval '')
    bool rep55 input(title 'Allow Repainting?'defval false)

    float src47 request.security(syminfo.tickeridres55inp55[rep55 barstate.isrealtime 0])[rep55 barstate.isrealtime 1]
    int length47 input.int(title 'Length'defval 40minval 2)
    float mult47 input.float(title 'Mult'defval 10.0minval 0.01)

    float alpha47 2.0 / (length47 1)
    float trL47 ta.lowest(ta.trlength47)
    float trH47 ta.highest(ta.trlength47)
    float trAdj47 trH47 trL47 != ? (ta.tr trL47) / (trH47 trL47) : 0

    float trAdjEma47 
    0.0
    trAdjEma47 
    := nz(trAdjEma47[1]) + (alpha47 * (+ (trAdj47 mult47)) * (src47 nz(trAdjEma47[1])))

    float slo47 src47 trAdjEma47
    int sig47 
    slo47 slo47 nz(slo47[1]) ? slo47 slo47 nz(slo47[1]) ? -: -0

    color tradjemaColor47 
    sig47 color.green sig47 color.lime sig47 < -color.maroon sig47 color.red color.black

    //plot(trAdjEma47, title = 'TrAdjEma', color = tradjemaColor47, linewidth = 2)
    /////////////////////////////////
    float src49 request.security(syminfo.tickeridres55inp55[rep55 barstate.isrealtime 0])[rep55 barstate.isrealtime 1]
    float tr49 request.security(syminfo.tickeridres55ta.tr[rep55 barstate.isrealtime 0])[rep55 barstate.isrealtime 1]
    int length49 input.int(title 'Length'defval 30minval 2)

    float hhC49 ta.highest(src49length49)
    float llC49 ta.lowest(src49length49)
    float result49 hhC49 llC49
    float effort49 
    math.sum(tr49length49)
    float alpha49 effort49 != result49 effort49 0

    float nama49 
    0.0
    nama49 
    := (alpha49 src49) + ((alpha49) * nz(nama49[1]))

    float slo49 src49 nama49
    int sig49 
    slo49 slo49 nz(slo49[1]) ? slo49 slo49 nz(slo49[1]) ? -: -0

    color namaColor49 
    sig49 color.green sig49 color.lime sig49 < -color.maroon sig49 color.red color.black

    //plot(nama49, title = 'Nama', color = namaColor49, linewidth = 2)
    //////////////////////////////////////
    float src50 request.security(syminfo.tickeridres55inp55[rep55 barstate.isrealtime 0])[rep55 barstate.isrealtime 1]
    float tr50 request.security(syminfo.tickeridres55ta.tr[rep55 barstate.isrealtime 0])[rep55 barstate.isrealtime 1]
    int length50 input.int(title 'Length'defval 30minval 2)

    float result50 math.abs(src50 nz(src50[length50]))
    float effort50 math.sum(tr50length50)
    float alpha50 effort50 != result50 effort50 0

    float anama50 
    0.0
    anama50 
    := (alpha50 src50) + ((alpha50) * nz(anama50[1]))

    float slo50 src50 anama50
    int sig50 
    slo50 slo50 nz(slo50[1]) ? slo50 slo50 nz(slo50[1]) ? -: -0

    color anamaColor50 
    sig50 color.green sig50 color.lime sig50 < -color.maroon sig50 color.red color.black

    //plot(anama50, title = 'Anama', color = anamaColor50, linewidth = 2)
    /////////////////////////////////////////////////////////
    float src51 request.security(syminfo.tickerres55inp55[rep55 barstate.isrealtime 0])[rep55 barstate.isrealtime 1]
    int fastLength51 input.int(title 'FastLength'defval 6minval 1)
    int slowLength51 input.int(title 'SlowLength'defval 12minval 1)
    int sampleLength51 input.int(title 'SampleLength'defval 5minval 1)

    hannFilter51(float sampleSrc51int length51) =>
        
    filt51 0.0coef51 0.0
        
    for 1 to length51
            cosine51 
    math.cos(math.pi / (length51 1))
            
    filt51 := filt51 + (cosine51 nz(sampleSrc51[1]))
            
    coef51 := coef51 cosine51
        filt51 
    := coef51 != filt51 coef51 0

    float sample51 
    0.0
    sample51 
    := bar_index sampleLength51 == src51 nz(sample51[1])
    float fastAvg51 hannFilter51(sample51fastLength51)
    float slowAvg51 hannFilter51(sample51slowLength51)

    float slo51 fastAvg51 slowAvg51
    int sig51 
    slo51 slo51 nz(slo51[1]) ? slo51 slo51 nz(slo51[1]) ? -: -0

    color udsmaColor51 
    sig51 color.green sig51 color.lime sig51 < -color.maroon sig51 color.red color.black

    //plot(fastAvg51, title = "FastAverage", color = udsmaColor51, linewidth = 2)
    //plot(slowAvg51, title = "SlowAverage", color = chart.fg_color, linewidth = 1)
    //////////////////////////////////
    float src52 request.security(syminfo.tickeridres55inp55[rep55 barstate.isrealtime 0])[rep55 barstate.isrealtime 1]
    fastLength52 input.int(title "FastLength"defval 14minval 1)
    slowLength52 input.int(title "SlowLength"defval 30minval 1)

    leavittProjection52(float src52int length52) =>
        
    float result52 ta.linreg(src52length52, -1)
        
    leavittConvolution52(float src52int length52) =>
        
    int sqrtLength52 math.floor(nz(math.sqrt(length52)))
        
    float result52 ta.linreg(leavittProjection52(src52length52), sqrtLength52, -1)
        
    float fastConv52 leavittConvolution52(src52fastLength52)
    float slowConv52 leavittConvolution52(src52slowLength52)

    float slo52 fastConv52 slowConv52
    int sig52 
    slo52 slo52 nz(slo52[1]) ? slo52 slo52 nz(slo52[1]) ? -: -0

    color lcColor52 
    sig52 color.green sig52 color.lime sig52 < -color.maroon sig52 color.red color.white

    //plot(fastConv52, title = 'FastConv', color = lcColor52, linewidth = 2)
    //plot(slowConv52, title = 'SlowConv', color = chart.fg_color, linewidth = 1)



    f_security(_symbol66_res66_src66_repaint66) =>
        
    request.security(_symbol66_res66_src66[_repaint66 barstate.isrealtime 0])[_repaint66 barstate.isrealtime 1]

    res66 input.timeframe(title='Resolution'defval='')
    rep66 input(title='Allow Repainting?'defval=false)

    length53 input.int(title='Length'defval=14minval=1)
    factor53 input.int(title='Factor'defval=2minval=1)
    p53 f_security(syminfo.tickeridres66hl2rep66)
    h53 f_security(syminfo.tickeridres66highrep66)
    l53 f_security(syminfo.tickeridres66lowrep66)
    t53 f_security(syminfo.tickeridres66ta.trrep66)

    mpEma53 ta.ema(p53length53)
    trEma53 ta.ema(t53length53)
    stdDev53 ta.stdev(trEma53length53)

    ad53 p53 nz(p53[1]) ? mpEma53 trEma53 p53 nz(p53[1]) ? mpEma53 trEma53 mpEma53
    adm53 
    ta.ema(ad53length53)

    trndDn53 0.0
    trndDn53 
    := ta.crossunder(adm53mpEma53) ? h53[2] : p53 nz(p53[1]) ? p53 stdDev53 factor53 nz(trndDn53[1], h53[2])
    trndUp53 0.0
    trndUp53 
    := ta.crossover(adm53mpEma53) ? l53[2] : p53 nz(p53[1]) ? p53 stdDev53 factor53 nz(trndUp53[1], l53[2])
    trndr53 0.0
    trndr53 
    := adm53 mpEma53 trndDn53 adm53 mpEma53 trndUp53 nz(trndr53[1], 0)

    sig53 p53 trndr53 p53 trndr53 ? -0

    trndrColor53 
    sig53 color.green sig53 color.red color.black

    //plot(trndr53, color=trndrColor53, linewidth=2)
    //plot(mpEma53, color=color.new(color.blue, 0), linewidth=2)
    //plot(adm53, color=color.new(color.black, 0), linewidth=1)
    /////////////////////////////////////////
    c54 f_security(syminfo.tickeridres66closerep66)
    v54 f_security(syminfo.tickeridres66volumerep66)
    length54 input.int(title='Length'defval=50minval=2)
    mult54 input.float(title='Mult'defval=10.0minval=0.01)

    alpha54 2.0 / (length54 1)
    mom54 c54 nz(c54[1])
    pv54 mom54 v54 0
    nv54 
    mom54 v54 0
    pvMa54 
    ta.ema(pv54length54)
    nvMa54 ta.ema(nv54length54)
    vs54 pvMa54 nvMa54 != math.abs(pvMa54 nvMa54) / (pvMa54 nvMa54) : 0

    rsvaEma54 
    0.0
    rsvaEma54 
    := nz(rsvaEma54[1]) + (alpha54 * (+ (vs54 mult54)) * (c54 nz(rsvaEma54[1])))

    slo54 c54 rsvaEma54
    sig54 
    slo54 slo54 nz(slo54[1]) ? slo54 slo54 nz(slo54[1]) ? -: -0

    rsvaemaColor54 
    sig54 color.green sig54 color.lime sig54 < -color.maroon sig54 color.red color.black

    //plot(rsvaEma54, title='RSEma', color=rsvaemaColor54, linewidth=2)
    ////////////////////////////////////
    length56 input.int(title='Length'defval=25minval=1)

    h56 f_security(syminfo.tickeridres66highrep66)
    l56 f_security(syminfo.tickeridres66lowrep66)
    c56 f_security(syminfo.tickeridres66closerep66)

    hh56 ta.highest(h56length56)
    ll56 ta.lowest(l56length56)
    atr56 ta.atr(length56)
    mult56 math.sqrt(length56)

    dSup56 hh56 atr56 mult56
    dRes56 
    ll56 atr56 mult56
    dMid56 
    = (dSup56 dRes56) / 2

    sig56 
    c56 dMid56 c56 dMid56 ? -0

    dsrColor56 
    sig56 color.green sig56 color.red color.black

    //plot(dSup56, title='Support', color=color.new(color.red, 0), linewidth=2)
    //plot(dMid56, title='Middle', color=dsrColor56, linewidth=1)
    //plot(dRes56, title='Resistance', color=color.new(color.green, 0), linewidth=2)
    ///////////////////////////////
    length57 input.int(title='Length'defval=3minval=1)

    h57 f_security(syminfo.tickeridres66highrep66)
    l57 f_security(syminfo.tickeridres66lowrep66)
    c57 f_security(syminfo.tickeridres66closerep66)

    highMa57 ta.sma(h57length57)
    lowMa57 ta.sma(l57length57)

    ghla57 0.0
    ghla57 
    := c57 nz(highMa57[1]) ? lowMa57 c57 nz(lowMa57[1]) ? highMa57 nz(ghla57[1])

    sig57 c57 ghla57 c57 ghla57 ? -0

    ghlaColor57 
    sig57 color.green sig57 color.red color.black

    //plot(ghla57, title='GHLA', color=ghlaColor57, linewidth=2)
    //////////////////////////////////
    lbLength58 input.int(title='LookBackLength'defval=21minval=1)
    p58 f_security(syminfo.tickeridres66closerep66)
    h58 f_security(syminfo.tickeridres66highrep66)
    l58 f_security(syminfo.tickeridres66lowrep66)

    ll58 ta.lowest(lbLength58)
    hh58 ta.highest(lbLength58)

    hCount58 0
    lCount58 
    0
    cbl58 
    p58
    for 0 to lbLength58 by 1
        
    if l58[i] == ll58
            
    for j58 1 to i lbLength58 by 1
                lCount58 
    += (h58[j58] > h58[i] ? 0)
                if 
    lCount58 == 2
                    cbl58 
    := h58[j58]
                    break
        if 
    h58[i] == hh58
            
    for j58 1 to i lbLength58 by 1
                hCount58 
    += (l58[j58] < l58[i] ? 0)
                if 
    hCount58 == 2
                    cbl58 
    := l58[j58]
                    break

    sig58 p58 cbl58 p58 cbl58 ? -0

    cblColor58 
    sig58 color.green sig58 color.red color.black

    //plot(cbl58, color=cblColor58, linewidth=2)
    //////////////////////////////
    inp59 input(title='Source'defval=close)
    h59 f_security(syminfo.tickeridres66highrep66)
    l59 f_security(syminfo.tickeridres66lowrep66)
    c59 f_security(syminfo.tickeridres66inp59rep66)
    length59 input.int(title='Length'defval=14minval=1)

    mHigh59 ta.linreg(h59length590) - ta.linreg(h59length591)
    mLow59 ta.linreg(l59length590) - ta.linreg(l59length591)

    upperBand59 h59lowerBand59 l59
    for 0 to length59 1
        currH59 
    nz(h59[i])
        
    prevH59 nz(h59[1])
        
    currL59 nz(l59[i])
        
    prevL59 nz(l59[1])
        
        
    vHigh59 currH59 + (nz(mHigh59[i]) * i)
        
    vLow59 currL59 + (nz(mLow59[i]) * i)
        
        
    upperBand59 := math.max(vHigh59upperBand59)
        
    lowerBand59 := math.min(vLow59lowerBand59)
    middleBand59 = (upperBand59 59) / 2

    slo59 
    c59 middleBand59
    sig59 
    = (c59 upperBand59 and nz(c59[1]) <= nz(upperBand59[1])) or (c59 lowerBand59 and nz(c59[1]) <= nz(lowerBand59[1]))
          ? 
    : (c59 lowerBand59 and nz(c59[1]) >= nz(lowerBand59[1])) or (c59 upperBand59 and nz(c59[1]) >= nz(upperBand59[1]))
          ? -
    slo59 slo59 nz(slo59[1]) ? slo59 slo59 nz(slo59[1]) ? -: -0

    pbColor59 
    sig59 color.green sig59 color.lime sig59 < -color.maroon sig59 color.red color.black

    //plot(upperBand59, title="UpperBand", linewidth=2, color=pbColor59)
    //plot(middleBand59, title="MiddleBand", linewidth=1, color=color.white)
    //plot(lowerBand59, title="LowerBand", linewidth=2, color=pbColor59)
    ///////////////////////////////////
    length61 input.int(title='Length'defval=25minval=1)
    h61 f_security(syminfo.tickeridres66highrep66)
    l61 f_security(syminfo.tickeridres66lowrep66)
    c61 f_security(syminfo.tickeridres66closerep66)

    hh61 ta.highest(h61length61)
    ll61 ta.lowest(l61length61)
    range_161 hh61 ll61

    sup161 
    ll61 0.25 range_161
    sup261 
    ll61 0.5 range_161
    res161 
    hh61 0.25 range_161
    res261 
    hh61 0.5 range_161
    mid61 
    = (sup161 sup261 res161 res261) / 4

    sig61 
    c61 mid61 c61 mid61 ? -0

    psrColor61 
    sig61 color.green sig61 color.red color.black

    //plot(sup161, title='Support1', color=color.new(color.red, 0), linewidth=2)
    //plot(sup261, title='Support2', color=color.new(color.red, 0), linewidth=2)
    //plot(mid61, title='Middle', color=psrColor61, linewidth=1)
    //plot(res161, title='Resistance1', color=color.new(color.green, 0), linewidth=2)
    //plot(res261, title='Resistance2', color=color.new(color.green, 0), linewidth=2) 
    16.07.2024 - 10.12.2024

  2. 1775-76 ve 77 nolu mesajdaki kodlar....
    birleşme yapılırken kullanıldı...

    plotları..... aktif yapıp....kullanılabilir......

    kodların hepsinin birleşimi...
    ve......
    trend ayırım sonucu....

    ortaya çıkan bu.....
    https://www.tradingview.com/x/mDk9vCDI/
    16.07.2024 - 10.12.2024

  3. ana...
    sar döngü sistemi ile beraber görüntü.....
    https://www.tradingview.com/x/9tYx7v33/
    16.07.2024 - 10.12.2024

  4.  Alıntı Originally Posted by @yörük@ Yazıyı Oku
    ana...
    sar döngü sistemi ile beraber görüntü.....
    https://www.tradingview.com/x/9tYx7v33/
    kodları....
    isteyene göndereyim demiştim...

    lakin...
    tasarımı kendime göre yapınca...

    agresif oldu....

    yani....kısa 1...orta 5.....uzun 15 dakkalık periyot....
    full (ortalama 1000k) giriş...vurkaç mantığıyla....

    yani yatırım amaçlı değil.....

    bu yüzden...
    yukardaki mesajlara kodun bütününün parçalarını koydum....

    herkes kendi anlayışına göre düzenlemeli.....
    16.07.2024 - 10.12.2024

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

    //@version=5
    indicator("Master Pattern [LuxAlgo]","*"overlay truemax_boxes_count 500max_lines_count 500)


    mult1 input.float(5'Multiplicative Factor'minval 0)

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

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

    //Style
    bullCss1 input.color(color.rgb(0255229), 'Average Color'inline 'avg'group 'Style')
    bearCss1 input.color(color.rgb(25033), ''              inline 'avg'group 'Style')

    //Calculation
    //-----------------------------------------------------------------------------{
    var float upper1 na
    var float lower1 na
    var float avg1   close

    var hold1 0.
    var os1 1.
        
    atr1 
    nz(ta.atr(200)) * mult1

    avg1 
    := math.abs(close avg1) > atr1 
      
    math.avg(closeavg1)
      : 
    avg1 os1 * (hold1 mult1 slope1)

    os1 := math.sign(avg1 avg1[1])
    hold1 := os1 != os1[1] ? atr1 hold1

    upper1 
    := avg1 width1 hold1
    lower1 
    := avg1 width1 hold1

    //-----------------------------------------------------------------------------}
    //Plots
    //-----------------------------------------------------------------------------{
    css1 os1 == bullCss1 bearCss1

    plot_upper 
    plot(upper1'Tepe'na)
    plot_avg plot(avg1'Stop'os1 != os1[1] ? na css1)
    plot_lower plot(lower1'Dip'na)

    //-----------------------------------------------------------------------------}

    tf1 input.timeframe('''Timeframe')

    //Hold variables
    var y1 = array.new<float>(0)
    var 
    x1 = array.new<int>(0)

    var 
    float a1 na
    var float b1 na
    var color css12 na
    var up_per 0
    var up_den 0
    var dn_per 0
    var dn_den 0

    n1 
    bar_index

    dtf 
    timeframe.change(tf1)

    //Test for timeframe change
    if dtf
        
    if y1.size() > 0
            
    //Calculate regression coefficients
            
    slope1 x1.covariance(y1) / x1.variance()
            
            
    up_per += slope1 and a1 0
            up_den 
    += a1 0
            dn_per 
    += slope1 and a1 0
            dn_den 
    += a1 0

            a1
    := slope1
            b1 
    := y1.avg() - a1 x1.avg()
            
    css12 := a1 #f70808 : #67f807

        //Clear arrays and push data
        
    y1.clear(), x1.clear()
        
    y1.push(close), x1.push(n1)
    else
        
    y1.push(close)
        
    x1.push(n1)

    //output
    epdt a1 n1 b1

    //-----------------------------------------------------------------------------}

    //-----------------------------------------------------------------------------}
    //Plots
    //-----------------------------------------------------------------------------{
    //plot(epdt, 'Önceki-Trend', dtf ? na : css1)


    //-----------------------------------------------------------------------------}
    //-----------------------------------------------------------------------------------------------------------------------------------------------------------------
    //Functions
    //-----------------------------------------------------------------------------------------------------------------------------------------------------------------

    //2 Pole Super Smoother Function
    SSF(xt) =>
        
    omega math.atan(1) * t
        a 
    math.exp(-math.sqrt(2) * math.atan(1) * t)
        
    math.cos(math.sqrt(2) / omega)
        
    c2 b
        c3 
    = -math.pow(a2)
        
    c1 c2 c3
        SSF 
    0.0
        SSF 
    := c1 c2 nz(SSF[1], x) + c3 nz(SSF[2], nz(SSF[1], x))
        
    SSF

    //Getter Function For Pseudo 2D Matrix
    get_val(matrowcolrowsize) =>
        array.
    get(matint(rowsize row col))

    //Setter Function For Pseudo 2D Matrix
    set_val(matrowcolrowsizeval) =>
        array.
    set(matint(rowsize row col), val)

    //LU Decomposition Function
    LU(AB) =>
        
    A_size = array.size(A)
        
    B_size = array.size(B)
        var 
    = array.new_float(A_size)
        var 
    = array.new_float(A_size)
        
    L_temp 0.0
        U_temp 
    0.0
        
    for 0 to B_size 1 by 1
            set_val
    (U0cB_sizeget_val(A0cB_size))
        for 
    1 to B_size 1 by 1
            set_val
    (Lr0B_sizeget_val(Ar0B_size) / get_val(U00B_size))
        for 
    0 to B_size 1 by 1
            
    for 0 to B_size 1 by 1
                
    if == c
                    set_val
    (LrcB_size1)
                if 
    c
                    set_val
    (LrcB_size0)
                if 
    c
                    set_val
    (UrcB_size0)
        for 
    0 to B_size 1 by 1
            
    for 0 to B_size 1 by 1
                
    if na(get_val(LrcB_size))
                    
    L_temp := get_val(ArcB_size)
                    for 
    0 to math.max(10by 1
                        L_temp 
    -= get_val(UkcB_size) * get_val(LrkB_size)
                        
    L_temp
                    set_val
    (LrcB_sizeL_temp get_val(UccB_size))
                if 
    na(get_val(UrcB_size))
                    
    U_temp := get_val(ArcB_size)
                    for 
    0 to math.max(10by 1
                        U_temp 
    -= get_val(UkcB_size) * get_val(LrkB_size)
                        
    U_temp
                    set_val
    (UrcB_sizeU_temp)
        [
    LU]

    //Lower Triangular Solution Function (Forward Substitution)
    LT_solve(L_B) =>
        
    B_size = array.size(B)
        var 
    = array.new_float(B_size)
        
    Y_temp 0.0
        
    array.set(Y0, array.get(B0) / get_val(L_00B_size))
        for 
    1 to B_size 1 by 1
            Y_temp 
    := array.get(Br)
            for 
    0 to math.max(10by 1
                Y_temp 
    -= get_val(L_rkB_size) * array.get(Yk)
                
    Y_temp
            
    array.set(YrY_temp get_val(L_rrB_size))
        
    Y

    //Upper Triangular Solution Function (Backward Substitution)
    UT_solve(U_Y_) =>
        
    Y_size = array.size(Y_)
        
    U_rev = array.copy(U_)
        
    Y_rev = array.copy(Y_)
        array.
    reverse(U_rev)
        array.
    reverse(Y_rev)
        
    X_rev LT_solve(U_revY_rev)
        
    = array.copy(X_rev)
        array.
    reverse(X)
        
    X

    //Regression Function
    regression_val(X_index_order_offset_) =>
        
    reg 0.0
        
    for 0 to order_ by 1
            reg 
    += array.get(X_i) * math.pow(index_ offset_i)
            
    reg
        reg

    //Curve Segment Drawing Function
    draw_curve(Ysdevnstep_collslwdrawconf) =>
        var 
    line segment line.new(x1=time[step_], y1=array.get(Yn) + sdevx2=time[(1) * step_], y2=array.get(Y1) + sdevxloc=xloc.bar_time)
        if 
    draw
            
    if conf barstate.isconfirmed 1
                line
    .set_xy1(segmenttime[step_], array.get(Yn) + sdev)
                
    line.set_xy2(segmenttime[(1) * step_], array.get(Y1) + sdev)
                
    line.set_color(segmentcol)
                
    line.set_width(segmentlw)
                
    line.set_style(segmentls == 'Solid' line.style_solid ls == 'Dotted' line.style_dotted line.style_dashed)
        else
            
    line.delete(segment)

    //-----------------------------------------------------------------------------------------------------------------------------------------------------------------
    //Inputs
    //-----------------------------------------------------------------------------------------------------------------------------------------------------------------

    //Source Inputs
    src input(defval=closetitle='Input Source Value')
    use_filt input(defval=truetitle='Smooth Data Before Curve Fitting')
    filt_per input.int(defval=10minval=2title='Data Smoothing Period ═══════════════════')

    //Calculation Inputs
    per input.int(defval=50minval=2title='Regression Sample Period')
    order input.int(defval=2minval=1title='Polynomial Order')
    calc_offs input(defval=0title='Regression Offset')
    ndev input.float(defval=2.0minval=0title='Width Coefficient')
    equ_from input.int(defval=0minval=0title='Forecast From _ Bars Ago ═══════════════════')

    //Channel Display Inputs
    show_curve input(defval=truetitle='Show Fitted Curve')
    show_high input(defval=truetitle='Show Fitted Channel High')
    show_low input(defval=truetitle='Show Fitted Channel Low')
    draw_step1 input.int(defval=10minval=1title='Curve Drawing Step Size')
    auto_step input(defval=truetitle='Auto Decide Step Size Instead')
    draw_freq input.string(defval='Close Only'options=['Continuous''Close Only'], title='Curve Update Frequency')
    poly_col_h input(defval=color.yellowtitle='Channel High Line Color')
    poly_lw_h input.int(defval=3minval=1title='Channel High Line Width')
    poly_ls_h input.string(defval='Dashed'options=['Solid''Dotted''Dashed'], title='Channel High Line Style')
    poly_col_m input(defval=color.rgb(25523559100), title='Channel Middle Line Color')
    poly_lw_m input.int(defval=3minval=1title='Channel Middle Line Width')
    poly_ls_m input.string(defval='Dotted'options=['Solid''Dotted''Dashed'], title='Channel Middle Line Style')
    poly_col_l input(defval=color.yellowtitle='Channel Low Line Color')
    poly_lw_l input.int(defval=3minval=1title='Channel Low Line Width')
    poly_ls_l input.string(defval='Dashed'options=['Solid''Dotted''Dashed'], title='Channel Low Line Style ═══════════════════')

    //Equation Display Inputs
    //show_equation = input(defval=true, title='Show Regression Equation')
    //label_bcol = input(defval=#000000, title='Equation Label Background Color')
    //label_tcol = input(defval=#ffffff, title='Equation Label Text Color')
    //label_size = input.string(defval='Large', options=['Auto', 'Tiny', 'Small', 'Normal', 'Large', 'Huge'], title='Equation Label Size')

    //-----------------------------------------------------------------------------------------------------------------------------------------------------------------
    //Definitions
    //-----------------------------------------------------------------------------------------------------------------------------------------------------------------

    //Smooth data and determine source type for calculation.
    filt SSF(srcfilt_per)
    src1 use_filt filt src

    //Populate a period sized array with bar values.
    var x_vals = array.new_float(per)
    for 
    0 to per 1 by 1
        
    array.set(x_valsi1)

    //Populate a period sized array with historical source values.
    var src_vals = array.new_float(per)
    for 
    0 to per 1 by 1
        
    array.set(src_valsisrc1[per equ_from])

    //Populate an order*2 + 1 sized array with bar power sums.
    var xp_sums = array.new_float(order 1)
    xp_sums_temp 0.0
    for 0 to order 2 by 1
        xp_sums_temp 
    := 0
        
    for 0 to per 1 by 1
            xp_sums_temp 
    += math.pow(array.get(x_valsj), i)
            
    xp_sums_temp
        
    array.set(xp_sumsixp_sums_temp)

    //Populate an order + 1 sized array with (bar power)*(source value) sums.
    var xpy_sums = array.new_float(order 1)
    xpy_sums_temp 0.0
    for 0 to order by 1
        xpy_sums_temp 
    := 0
        
    for 0 to per 1 by 1
            xpy_sums_temp 
    += math.pow(array.get(x_valsj), i) * array.get(src_valsj)
            
    xpy_sums_temp
        
    array.set(xpy_sumsixpy_sums_temp)

    //Generate a pseudo square matrix with row and column sizes of order + 1 using bar power sums.
    var xp_matrix = array.new_float(int(math.pow(order 12)))
    for 
    0 to order by 1
        
    for 0 to order by 1
            set_val
    (xp_matrixrcorder 1, array.get(xp_sumsc))

    //Factor the power sum matrix into lower and upper triangular matrices with order + 1 rows and columns.
    [lowerupper] = LU(xp_matrixxpy_sums)

    //Find lower triangular matrix solutions using (bar power)*(source value) sums.
    l_solutions LT_solve(lowerxpy_sums)

    //Find upper triangular matrix solutions using lower matrix solutions. This gives us our regression coefficients.
    reg_coefs UT_solve(upperl_solutions)

    //Define curve drawing step size.
    draw_step auto_step math.ceil(per 10) : draw_step1

    //Calculate curve values.
    var inter_vals = array.new_float(11)
    for 
    0 to 10 by 1
        
    array.set(inter_valsiregression_val(reg_coefsperordercalc_offs equ_from draw_step i))

    //Calculate standard deviation for channel.
    Stdev = array.stdev(src_vals) * ndev

    //Define a string for regression equation display.
    //equation_txt = ''
    //if show_equation
        //equation_txt := (equ_from != 0 ? 'Forecast From ' + str.tostring(equ_from) + (equ_from == 1 ? ' Bar ' : ' Bars ') + 'Ago Using\n\n' : '') + str.tostring(array.get(reg_coefs, 0))
        //for i = 1 to array.size(reg_coefs) - 1 by 1
            //equation_txt += (array.get(reg_coefs, i) < 0 ? ' - ' : ' + ') + str.tostring(math.abs(array.get(reg_coefs, i))) + 'x' + (i > 1 ? '^' + str.tostring(i) : '')
            //equation_txt
        //equation_txt += '\n\n' + 'Offset ' + str.tostring(math.abs(calc_offs)) + (math.abs(calc_offs) == 1 ? ' Bar ' : ' Bars ') + (calc_offs > 0 ? 'To The Right' : calc_offs < 0 ? 'To The Left' : '')
        //equation_txt

    //Define bar colors based on LSMA.
    //bar_color = src > array.get(inter_vals, 0) and src > src[1] ? #00ff00 : src > array.get(inter_vals, 0) and src <= src[1] ? #008b00 : src < array.get(inter_vals, 0) and src < src[1] ? #ff0000 : src < array.get(inter_vals, 0) and src >= src[1] ? #8b0000 : #cccccc

    //Define LSMA colors.
    //lsma_color = array.get(inter_vals, 0) > array.get(inter_vals, 0)[1] ? #00ff00 : array.get(inter_vals, 0) < array.get(inter_vals, 0)[1] ? #ff0000 : #cccccc

    //-----------------------------------------------------------------------------------------------------------------------------------------------------------------
    //Outputs
    //-----------------------------------------------------------------------------------------------------------------------------------------------------------------

    //Plot source / smoothed source
    //plot(src1, color=color.new(#cccccc, 0), title='Source / Smoothed Source Value')

    //Plot current channel endpoints (LSMA & band values).
    ////lsma_plot = plot(array.get(inter_vals, 0), color=lsma_color, linewidth=2, title='Polynomial LSMA')
    //hband_plot = plot(array.get(inter_vals, 0) + Stdev, color=color.new(#00ff00, 0), title='High Band')
    //lband_plot = plot(array.get(inter_vals, 0) - Stdev, color=color.new(#ff0000, 0), title='Low Band')

    //Fill bands.
    //fill(hband_plot, lsma_plot, color=color.new(#00ff00, 90), title='High Band Fill')
    //fill(lband_plot, lsma_plot, color=color.new(#ff0000, 90), title='Low Band Fill')

    //Color bars.
    //barcolor(bar_color)

    //Color background.
    //bgcolor(color.new(#000000, 0))

    //Draw interpolated segments.
    draw_curve(inter_vals01draw_steppoly_col_mpoly_ls_mpoly_lw_mshow_curvedraw_freq == 'Close Only')
    draw_curve(inter_vals02draw_steppoly_col_mpoly_ls_mpoly_lw_mshow_curvedraw_freq == 'Close Only')
    draw_curve(inter_vals03draw_steppoly_col_mpoly_ls_mpoly_lw_mshow_curvedraw_freq == 'Close Only')
    draw_curve(inter_vals04draw_steppoly_col_mpoly_ls_mpoly_lw_mshow_curvedraw_freq == 'Close Only')
    draw_curve(inter_vals05draw_steppoly_col_mpoly_ls_mpoly_lw_mshow_curvedraw_freq == 'Close Only')
    draw_curve(inter_vals06draw_steppoly_col_mpoly_ls_mpoly_lw_mshow_curvedraw_freq == 'Close Only')
    draw_curve(inter_vals07draw_steppoly_col_mpoly_ls_mpoly_lw_mshow_curvedraw_freq == 'Close Only')
    draw_curve(inter_vals08draw_steppoly_col_mpoly_ls_mpoly_lw_mshow_curvedraw_freq == 'Close Only')
    draw_curve(inter_vals09draw_steppoly_col_mpoly_ls_mpoly_lw_mshow_curvedraw_freq == 'Close Only')
    draw_curve(inter_vals010draw_steppoly_col_mpoly_ls_mpoly_lw_mshow_curvedraw_freq == 'Close Only')

    //Draw channel high segments.
    draw_curve(inter_valsStdev1draw_steppoly_col_hpoly_ls_hpoly_lw_hshow_highdraw_freq == 'Close Only')
    draw_curve(inter_valsStdev2draw_steppoly_col_hpoly_ls_hpoly_lw_hshow_highdraw_freq == 'Close Only')
    draw_curve(inter_valsStdev3draw_steppoly_col_hpoly_ls_hpoly_lw_hshow_highdraw_freq == 'Close Only')
    draw_curve(inter_valsStdev4draw_steppoly_col_hpoly_ls_hpoly_lw_hshow_highdraw_freq == 'Close Only')
    draw_curve(inter_valsStdev5draw_steppoly_col_hpoly_ls_hpoly_lw_hshow_highdraw_freq == 'Close Only')
    draw_curve(inter_valsStdev6draw_steppoly_col_hpoly_ls_hpoly_lw_hshow_highdraw_freq == 'Close Only')
    draw_curve(inter_valsStdev7draw_steppoly_col_hpoly_ls_hpoly_lw_hshow_highdraw_freq == 'Close Only')
    draw_curve(inter_valsStdev8draw_steppoly_col_hpoly_ls_hpoly_lw_hshow_highdraw_freq == 'Close Only')
    draw_curve(inter_valsStdev9draw_steppoly_col_hpoly_ls_hpoly_lw_hshow_highdraw_freq == 'Close Only')
    draw_curve(inter_valsStdev10draw_steppoly_col_hpoly_ls_hpoly_lw_hshow_highdraw_freq == 'Close Only')

    //Draw channel low segments.
    draw_curve(inter_vals, -Stdev1draw_steppoly_col_lpoly_ls_lpoly_lw_lshow_lowdraw_freq == 'Close Only')
    draw_curve(inter_vals, -Stdev2draw_steppoly_col_lpoly_ls_lpoly_lw_lshow_lowdraw_freq == 'Close Only')
    draw_curve(inter_vals, -Stdev3draw_steppoly_col_lpoly_ls_lpoly_lw_lshow_lowdraw_freq == 'Close Only')
    draw_curve(inter_vals, -Stdev4draw_steppoly_col_lpoly_ls_lpoly_lw_lshow_lowdraw_freq == 'Close Only')
    draw_curve(inter_vals, -Stdev5draw_steppoly_col_lpoly_ls_lpoly_lw_lshow_lowdraw_freq == 'Close Only')
    draw_curve(inter_vals, -Stdev6draw_steppoly_col_lpoly_ls_lpoly_lw_lshow_lowdraw_freq == 'Close Only')
    draw_curve(inter_vals, -Stdev7draw_steppoly_col_lpoly_ls_lpoly_lw_lshow_lowdraw_freq == 'Close Only')
    draw_curve(inter_vals, -Stdev8draw_steppoly_col_lpoly_ls_lpoly_lw_lshow_lowdraw_freq == 'Close Only')
    draw_curve(inter_vals, -Stdev9draw_steppoly_col_lpoly_ls_lpoly_lw_lshow_lowdraw_freq == 'Close Only')
    draw_curve(inter_vals, -Stdev10draw_steppoly_col_lpoly_ls_lpoly_lw_lshow_lowdraw_freq == 'Close Only')




    //Settings
    //-----------------------------------------------------------------------------{
    length74 input.int(2'Length'minval 2)
    mult74   input.float(5.'Factor'minval 0step .5)
    tf74     input.timeframe('''Timeframe')
    src74   input(close'Source')

    //-----------------------------------------------------------------------------}
    //Function
    //-----------------------------------------------------------------------------{
    pred_ranges(length74mult74)=>
        var 
    avg src74
        
    var hold_atr 0.

        atr 
    nz(ta.atr(length74)) * mult74
            
        avg 
    := src74 avg atr avg atr 
          
    avg src74 atr avg atr 
          
    avg
            
        hold_atr 
    := avg != avg[1] ? atr hold_atr
            
        
    [avg hold_atr 2avg hold_atravgavg hold_atravg hold_atr 2]

    //-----------------------------------------------------------------------------}
    //Calculation
    //-----------------------------------------------------------------------------{
    [prR2
      
    prR1
      
    avg
      
    prS1
      
    prS2] = request.security(syminfo.tickeridtf74pred_ranges(length74mult74))

    //-----------------------------------------------------------------------------}
    //Plots
    //-----------------------------------------------------------------------------{
    plot_pru2  plot(prR2'+2'avg != avg[1] ? na color.rgb(141314))
    plot_pru1  plot(prR1'+1'avg != avg[1] ? na color.rgb(101010))
    plot_pravg plot(avg '0'avg != avg[1] ? na color.rgb(777))
    plot_prl1  plot(prS1'-1'avg != avg[1] ? na color.rgb(888))
    plot_prl2  plot(prS2'-2'avg != avg[1] ? na color.rgb(888))

    //Fills
    fill(plot_pru2plot_pru1avg != avg[1] ? na color.new(color.yellow50))
    fill(plot_prl1plot_prl2avg != avg[1] ? na color.new(color.orange50)) 
    parabol range stop kodu...
    16.07.2024 - 10.12.2024

  6. nihayet bitti....
    sinus dalgası....birleştirilen kodlar....sar döngüsü hep beraber....


    16.07.2024 - 10.12.2024


  7. 16.07.2024 - 10.12.2024

Sayfa 223/276 İlkİlk ... 123173213221222223224225233273 ... 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
  •