нужно удалить графики разворотов за предыдущий день из этого скрипта

#pine-script

Вопрос:

Здравствуйте , ребята, я создаю сценарий точек разворота пола , в котором я хочу скрыть уровни разворота предыдущего дня , код ниже, пожалуйста, помогите мне, я не очень хорошо разбираюсь в сценарии pine

 //
// 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)
 

а еще лучше, если есть кнопка ввода для отображения и скрытия уровней разворота за предыдущий день

Ответ №1:

Вы можете заменить функцию построения на функцию линии для того же самого. Пример:

 l = line.new(bar_index[10],P,bar_index,P, extend = extend.right)
line.delete(l[1])