RicardoSantos

[RS]Neo Wave V0

EXPERIMENTAL: Request for IvanLabrie.
Method for reading Neo Wave's.
note: some issues arent possible to work around/fix due to limitations in pinescript.
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
study(title='[RS]Neo Wave V0', overlay=true)
SHOW_TF = input(title='Display Timeframe Box:', type=bool, defval=true)
timeframe = input(title='Timeframe:', type=string, defval='D')

shift = timeframe == 'D' and period == '720' ? 2 :
        timeframe == 'D' and period == '360' ? 4 :
        timeframe == 'D' and period == '240' ? 6 :
        timeframe == 'D' and period == '180' ? 8 :
        timeframe == 'D' and period == '120' ? 12 :
        timeframe == 'D' and period == '60' ? 24 :
        timeframe == 'D' and period == '45' ? 32 :
        timeframe == 'D' and period == '30' ? 48 :
        timeframe == 'D' and period == '15' ? 96 :
        timeframe == 'D' and period == '5' ? 288 :
        timeframe == 'D' and period == '3' ? 480 :
        timeframe == 'D' and period == '1' ? 1440 :
        timeframe == 'W' and period == '720' ? 10 :
        timeframe == 'W' and period == '360' ? 20 :
        timeframe == 'W' and period == '240' ? 30 :
        timeframe == 'W' and period == '180' ? 40 :
        timeframe == 'W' and period == '120' ? 60 :
        timeframe == 'W' and period == '60' ? 120 :
        timeframe == 'W' and period == '45' ? 160 :
        timeframe == 'W' and period == '30' ? 240 :
        timeframe == 'W' and period == '15' ? 480 :
        timeframe == 'W' and period == '5' ? 1440 :
        timeframe == 'W' and period == '3' ? 2400 :
        timeframe == 'W' and period == '1' ? 7200 :
        timeframe == 'M' and period == '720' ? 40 :
        timeframe == 'M' and period == '360' ? 80 :
        timeframe == 'M' and period == '240' ? 138 :
        timeframe == 'M' and period == '180' ? 160 :
        timeframe == 'M' and period == '120' ? 240 :
        timeframe == 'M' and period == '60' ? 480 :
        timeframe == 'M' and period == '45' ? 640 :
        timeframe == 'M' and period == '30' ? 960 :
        timeframe == 'M' and period == '15' ? 1920 :
        timeframe == 'M' and period == '5' ? 0 :
        timeframe == 'M' and period == '3' ? 0 :
        timeframe == 'M' and period == '1' ? 0 :
        0

tf_counter = change(time(timeframe))!=0 ? 1 : tf_counter[1]+1
//plot(tf_counter)

tf_high = not SHOW_TF ? na : security(ticker, timeframe, high)
tf_low = not SHOW_TF ? na : security(ticker, timeframe, low)
tf_hp = plot(title='TF High', series=tf_counter >= shift ? na : tf_high, style=circles, color=black, linewidth=1)
tf_lp = plot(title='TF Low', series=tf_counter >= shift ? na : tf_low, style=circles, color=black, linewidth=1)
fill(title='Time Box', plot1=tf_hp, plot2=tf_lp, color=blue, transp=90)
//hl = high >= tf_high ? high : low <= tf_low ? low : na
//plot(hl)
hh = tf_counter == 1 ? high : high >= hh[1] ? high : hh[1]
ll = tf_counter == 1 ? low : low <= ll[1] ? low : ll[1]
//plot(hh, color=black)
//plot(ll, color=black)
hhc = change(hh)>0 ? n : hhc[1]
llc = change(ll)<0 ? n : llc[1]


direction = tf_counter == 1 ? hhc[1] < llc[1] ? hh[1] : ll[1] : tf_counter == shift ? hhc[shift] < llc[shift] ? ll[shift+1] : hh[shift+1] : na
plot(title='Wave', series=direction, color=direction>fixnan(direction[1])?green:maroon, linewidth=2, offset=-shift)