RicardoSantos

[RS]Swing Charts V0

EXPERIMENTAL:
Swing Charts with a personal touch(has slight modifications) :p
Hilangkan dari Skrip-Skrip Favorit Tambahkan ke Skrip-Skrip Favorit
//@version=2
study(title='[RS]Swing Charts V0', shorttitle='SC', overlay=true)

//  Swing charts as described here: http://www.investopedia.com/articles/technical/04/080404.asp
f_up_bar(_n_bars_back)=>
    _return = high[_n_bars_back] > high[_n_bars_back + 1] and low[_n_bars_back] > low[_n_bars_back + 1]

f_down_bar(_n_bars_back)=>
    _return = low[_n_bars_back] < low[_n_bars_back + 1] and high[_n_bars_back] < high[_n_bars_back + 1]

f_inside_bar(_n_bars_back)=>
    _return = high[_n_bars_back] <= high[_n_bars_back + 1] and low[_n_bars_back] >= low[_n_bars_back + 1]

f_outside_bar(_n_bars_back)=>
    _return = high[_n_bars_back] >= high[_n_bars_back + 1] and low[_n_bars_back] <= low[_n_bars_back + 1]

//--
f_swing_high(_n_bars_back)=>
    _condition_00 = f_up_bar(_n_bars_back + 1) and f_down_bar(_n_bars_back)
    _condition_01 = f_outside_bar(_n_bars_back + 1) and f_down_bar(_n_bars_back)
    _condition_02 = f_inside_bar(_n_bars_back + 1) and f_down_bar(_n_bars_back)
    _condition_03 = f_up_bar(_n_bars_back + 1) and f_inside_bar(_n_bars_back) and close[_n_bars_back] < hl2[_n_bars_back + 1]
    _condition_04 = f_outside_bar(_n_bars_back) and close < hl2
    _condition_05 = false
    _return = _condition_00 or _condition_01 or _condition_02 or _condition_03 or _condition_04 or _condition_05

f_swing_low(_n_bars_back)=>
    _condition_00 = f_down_bar(_n_bars_back + 1) and f_up_bar(_n_bars_back)
    _condition_01 = f_outside_bar(_n_bars_back + 1) and f_up_bar(_n_bars_back)
    _condition_02 = f_inside_bar(_n_bars_back + 1) and f_up_bar(_n_bars_back)
    _condition_03 = f_down_bar(_n_bars_back + 1) and f_inside_bar(_n_bars_back) and close[_n_bars_back] > hl2[_n_bars_back + 1]
    _condition_04 = f_outside_bar(_n_bars_back) and close > hl2
    _condition_05 = false
    _return = _condition_00 or _condition_01 or _condition_02 or _condition_03 or _condition_04 or _condition_05
//--
f_swingchart(_swings_high, _swings_low)=>
    _trend = na(_trend[1]) ? 1 : _trend[1] > 0 and _swings_low ? -1 : _trend[1] < 0 and _swings_high ? 1 : _trend[1]
    _return = na(_return[1]) ? 0 : change(_trend) > 0 ? nz(_swings_high, high[1]) : change(_trend) < 0 ? nz(_swings_low, low[1]) : _return[1]

swings_high = f_swing_high(0) ? highest(3) : na
swings_low = f_swing_low(0) ? lowest(3) : na

swing_chart = f_swingchart(swings_high, swings_low)
zigzag = change(swing_chart) != 0 ? swing_chart : na

plot(title='Swing High', series=swings_high, style=circles, color=red, transp=0, linewidth=4, offset=-1)
plot(title='Swing Low', series=swings_low, style=circles, color=lime, transp=0, linewidth=4, offset=-1)
plot(title='Swing Chart', series=swing_chart, color=change(swing_chart) != 0 ? na : black, transp=0, offset=-1)
plot(title='ZigZag', series=zigzag, color=black, transp=0, linewidth=2, offset=-1)

barcolor(title='Up Bar', color=f_up_bar(0) ? lime : na)
barcolor(title='Down Bar', color=f_down_bar(0) ? red : na)
barcolor(title='Inside Bar', color=f_inside_bar(0) ? blue : na)
barcolor(title='Outside Bar', color=f_outside_bar(0) ? aqua : na)

Komentar

Is there any possible way I can add more percentage to the zig zag?
Jawab
RicardoSantos deluchoargain
@deluchoargain, swing charts are not based on percentage, its based on bar patterns.
Jawab
cool
Jawab
...... Great, Unique & Sublime !!! FOR ME!
I used to draw the lines in mind 5-6 years...
Now my template is of flugent utility !!!

Where is your personal touch? /?\
Where you catch the theory — I thought it's mostly mine ... -;-j
+1 Jawab
Routcheau Routcheau
@Routcheau :
Which language you used to code
+1 Jawab
Nice job! Surprised had not seen this sooner. Thanks for posting and keep smiling!
Jawab
Beranda Penyaring Saham Penyaring Forex Penyaring Crypto Kalender Ekonomi Bagaimana Cara Kerjanya Fitur-Fitur Chart Harga Akun Refer seorang teman Tata Tertib Pusat Bantuan Solusi Website & Broker Widget-Widget Solusi Charting Perpustakaan Charting Ringan Blog & Berita Twitter
Profil Pengaturan Profil Akun dan Penagihan Refer seorang teman Tiket Dukungan Saya Pusat Bantuan Ide Terpublikasikan Pengikut Mengikuti Pesan Pribadi Obrolan Keluar