问题描述
我想删除以前的数据透视标签,其范围为最新结果的+ -0.3%。 例如,根据下面的图片,我们看到...
最近的枢轴是17.01,并且规则集设置为删除标签,范围为+-0.3%上一个标签, 因此我们的范围应该是任何标签17.06> x> 16.96应该删除它。
// Inputs
res = input(title="resolution",type=input.string,defval="2")
DateDay= input(title="Date Day",type=input.integer,defval=2,minval=1,maxval=31)
leftBars = input(title="Left Bars",defval=5,minval=1)
rightBars = input(title="Right Bars",minval=1)
src = input(title="Source",type=input.source,defval=close)
ShowPivot = input(title="Show Pivot",type=input.bool,defval=true)
// Date Function
Start_Period= timestamp("GMT-4",year(time),month(time),DateDay,09,30,00)
End_Period= timestamp("GMT-4",16,00,00)
T = time >= Start_Period and time <= End_Period and not time(timeframe.period,"1600-0930")
// pivot
f() => pivothigh(src,leftBars,rightBars)
ph = security(syminfo.tickerid,res,f())
//Draw label
if T and not na(ph)
if ShowPivot == true
lab_h = label.new(
bar_index[rightBars],high,text=tostring(ph,'#.##'),color=color.white,textcolor= color.green,style = label.style_none,yloc = yloc.abovebar)
解决方法
这将需要追溯到历史中以查找创建标签的条形,读取其y值,如果其y值符合您的条件,则删除该标签。
但是,由于运行时处理过去检查标签和行ID实例的方式存在问题,因此目前尚无法可靠地执行此操作。 Pine小组已经意识到了问题所在,但尚无此修复程序的ETA。
This是面对相同问题的类似问题。抱歉给您带来不便。