我想隐藏前一周的线,这些线将出现在图表上。enter image description here
发布于 2021-05-28 16:35:10
// Step 1. Script settings
study(title="Pivot Point", overlay=true)
// Input settings
// Create a pull-down menu for the pivot type
pivotType = input(title="Pivot Type", options=["Weekly"], defval="Weekly")
// Make toggles for pivot level options
plotPP = input(title="Plot PP", type=bool, defval=true)
plotS1R1 = input(title="Plot S1 and R1", type=bool, defval=true)
plotS2R2 = input(title="Plot S2 and R2", type=bool, defval=true)
plotS3R3 = input(title="Plot S3 and R3", type=bool, defval=true)
// Step 2. Calculate indicator values
// Create a function to fetch daily and weekly data
GetData(res, data) =>
security(tickerid, res, data[1],lookahead=barmerge.lookahead_on)
// Fetch weekly price data
weeklyHigh = GetData("W", high)
weeklyLow = GetData("W", low)
weeklyClose = GetData("W", close)
// Now figure out which kind of price data
// to use for the pivot calculation
theHigh = weeklyHigh
theLow = weeklyLow
theClose = weeklyClose
// Finally calculate the pivot levels
pp = (theHigh + theLow + 2*theClose) / 4
r1 = (pp * 2) - theLow
s1 = (pp * 2) - theHigh
r2 = (pp - s1) + r1
s2 = pp - (r1 - s1)
r3 = (pp - s1) + r2
s3 = pp - (r2 - s1)
// Step 3. Output indicator data
// Plot the various pivot levels
plot(r3, title="R3", style=line, linewidth=1, color=black)
plot(r2, title="R2", style=line, linewidth=1, color=black)
plot(r1, title="R1", style=line, linewidth=1, color=black)
plot(pp, title="PP", style=line, linewidth=1, color=black)
plot(s1, title="S1", style=line, linewidth=1, color=black)
plot(s2, title="S2", style=line, linewidth=1, color=black)
plot(s3, title="S3", style=line, linewidth=1, color=black)https://stackoverflow.com/questions/67682398
复制相似问题