本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=3
study("Fibonacci Pivot Points", overlay=true)
spacer = input(false, title="----------[FIBONACCI TIME FRAME]----------")
tfselect = input(title="Insert the Time Frame: ", type=resolution, defval="D", options=["D", "M", "W"])
spacer2 = input(false, title="-------------[FIBONACCI LEVELS]-------------")
fibonacci_levelr1 = input(title="Insert Fibonacci R1 Level: ", defval=0.382)
fibonacci_levelr2 = input(title="Insert Fibonacci R2 Level: ", defval=0.618)
fibonacci_levelr3 = input(title="Insert Fibonacci R3 Level: ", defval=1.000)
fibonacci_levels1 = input(title="Insert Fibonacci S1 Level: ", defval=0.382)
fibonacci_levels2= input(title="Insert Fibonacci S2 Level: ", defval=0.618)
fibonacci_levels3 = input(title="Insert Fibonacci S3 Level: ", defval=1.000)
High = security(ticker,tfselect, high[1], barmerge.gaps_off, barmerge.lookahead_on)
Low = security(ticker,tfselect, low[1], barmerge.gaps_off, barmerge.lookahead_on)
Close = security(ticker,tfselect, close[1],barmerge.gaps_off, barmerge.lookahead_on)
start = security(ticker,tfselect, time, barmerge.gaps_off, barmerge.lookahead_on)
last = security(ticker,tfselect, valuewhen(barstate.islast,time,0), barmerge.gaps_off, barmerge.lookahead_on)
newDay = change(start)
lastDay = start>=last
pp = (High+Low+Close) / 3
S1 = pp - ((High - Low) * fibonacci_levels1)
S2 = pp - ((High - Low) * fibonacci_levels2)
S3 = pp - ((High - Low) * fibonacci_levels3)
R1 = pp + ((High - Low) * fibonacci_levelr1)
R2 = pp + ((High - Low) * fibonacci_levelr2)
R3 = pp + ((High - Low) * fibonacci_levelr3)
gg = close > R1 and close < R2
lezzo = 3.18
plotshape(R1-0.0002, color=na, text="R1", textcolor=red, transp=0,location=location.absolute, show_last=1, title="Fibonacci Text, don't change")
plotshape(R2-0.0002, color=na, text="R2", textcolor=red, transp=0,location=location.absolute, show_last=1, title="Fibonacci Text, don't change")
plotshape(R3-0.0002, color=na, text="R3", textcolor=red, transp=0,location=location.absolute, show_last=1, title="Fibonacci Text, don't change")
plotshape(S1-0.0002, color=na, text="S1", textcolor=lime, transp=0,location=location.absolute, show_last=1, title="Fibonacci Text, don't change")
plotshape(S2-0.0002, color=na, text="S2", textcolor=lime, transp=0,location=location.absolute, show_last=1, title="Fibonacci Text, don't change")
plotshape(S3-0.0002, color=na, text="S3", textcolor=lime, transp=0,location=location.absolute, show_last=1, title="Fibonacci Text, don't change")
plot(lastDay?R1:na, title="R1", color=red, transp=0, linewidth=2)
plot(lastDay?R2:na, title="R2", color=red, transp=0, linewidth=2)
plot(lastDay?R3:na, title="R3", color=red, transp=0, linewidth=2)
plot(lastDay?S1:na, title="S1", color=lime, transp=0, linewidth=2)
plot(lastDay?S2:na, title="S2", color=lime, transp=0, linewidth=2)
plot(lastDay?S3:na, title="S3", color=lime, transp=0, linewidth=2)