需要从此脚本中删除前一天的枢轴图

时间:2021-05-18 20:56:01

标签: pine-script

大家好,我正在创建一个脚本楼层枢轴点,我想在其中隐藏前一天的枢轴点,代码如下,请帮助我,我不太擅长松树脚本

//
// Pivot Points indicator, calculated in the "traditional" way, also called "floor-trader pivots".

study(title="Pivot Points, by oliver", shorttitle="PP by oliver", overlay=true)

defaultTimeFrame = timeframe.isintraday ? "D" : 
   timeframe.isdaily ? "W" : timeframe.isweekly ? "M" : "3M"
inputTimeFrame = input(title="Time Frame", type=input.string, defval="Default")
chosenTimeFrame = inputTimeFrame == "Default" ? defaultTimeFrame : inputTimeFrame

getSeries(e) =>
    security(syminfo.tickerid, chosenTimeFrame, e, lookahead=barmerge.lookahead_on)

H = getSeries(high[1])
L = getSeries(low[1])
C = getSeries(close[1])

// Main Pivot
P = (H + L + C) / 3
// Resistence Levels
R3 = H + 2 * (P - L)
R2 = P + H - L
R1 = P * 2 - L
// Support Levels
S1 = P * 2 - H
S2 = P - (H - L)
S3 = L - 2 * (H - P)

// Optional Halves between levels
R2_5 = (R2 + R3) / 2  //aka R2.5
R1_5 = (R1 + R2) / 2  //aka R1.5
R0_5 = (P + R1) / 2  //aka R0.5
//
S0_5 = (P + S1) / 2  //aka S0.5
S1_5 = (S1 + S2) / 2  //aka S1.5
S2_5 = (S2 + S3) / 2  //aka S2.5


//UX Input Arguments
pColor = #ffa100
rColor = color.green
sColor = color.red
myWidthMainLevels = input(title="Line width for Main levels", type=input.integer, defval=3, minval=1)
myWidthHalfLevels = input(title="Line width for Half levels", type=input.integer, defval=1, minval=1)
myStyle = plot.style_linebr


plot(R3, title="R3", color=rColor, linewidth=myWidthMainLevels, style=myStyle)
plot(R2_5, title="R2.5", color=rColor, linewidth=myWidthHalfLevels, style=myStyle)
plot(R2, title="R2", color=rColor, linewidth=myWidthMainLevels, style=myStyle)
plot(R1_5, title="R1.5", color=rColor, linewidth=myWidthHalfLevels, style=myStyle)
plot(R1, title="R1", color=rColor, linewidth=myWidthMainLevels, style=myStyle)
plot(R0_5, title="R0.5", color=rColor, linewidth=myWidthHalfLevels, style=myStyle)

plot(P, title="P", color=pColor, linewidth=myWidthMainLevels, style=myStyle)

plot(S0_5, title="S0.5", color=sColor, linewidth=myWidthHalfLevels, style=myStyle)
plot(S1, title="S1", color=sColor, linewidth=myWidthMainLevels, style=myStyle)
plot(S1_5, title="S1.5", color=sColor, linewidth=myWidthHalfLevels, style=myStyle)
plot(S2, title="S2", color=sColor, linewidth=myWidthMainLevels, style=myStyle)
plot(S2_5, title="S2.5", color=sColor, linewidth=myWidthHalfLevels, style=myStyle)
plot(S3, title="S3", color=sColor, linewidth=myWidthMainLevels, style=myStyle)

如果有一个输入按钮来显示和隐藏前一天的枢轴水平,那就更好了

0 个答案:

没有答案
相关问题