松树脚本中可能的性能问题

时间:2020-07-14 01:30:29

标签: pine-script

我有一个指示器,可以在每5分钟的每两个小节上添加一个小节号,请参见下文。它运行良好,但似乎使网页相当“滞后”,您知道可能是什么问题吗?我知道这是一个性能问题,但是不熟悉pinescript我不知道可能是由什么原因造成的。此外,还有没有更好的方法可以实现我想要的目标?参见下图:

enter image description here

下面我的当前代码:enter image description here

study("Count Bars Day",overlay=true)

is_new_day() => 
    d=dayofweek
    na(d[1]) or d != d[1]
    
plotchar((barssince(is_new_day())+1)==2,char='',transp=75,text="2",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==4,char='',transp=75,text="4",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==6,char='',transp=75,text="6",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==8,char='',transp=75,text="8",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==10,char='',transp=75,text="10",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==12,char='',transp=50,text="12",textcolor=blue,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==14,char='',transp=75,text="14",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==16,char='',transp=75,text="16",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==18,char='',transp=50,text="18",textcolor=red,location=location.belowbar)

plotchar((barssince(is_new_day())+1)==20,char='',transp=75,text="20",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==22,char='',transp=75,text="22",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==24,char='',transp=75,text="24",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==26,char='',transp=75,text="26",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==28,char='',transp=75,text="28",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==30,char='',transp=50,text="30",textcolor=blue,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==32,char='',transp=75,text="32",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==34,char='',transp=75,text="34",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==36,char='',transp=75,text="36",textcolor=black,location=location.belowbar)

plotchar((barssince(is_new_day())+1)==38,char='',transp=75,text="38",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==40,char='',transp=75,text="40",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==42,char='',transp=75,text="42",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==44,char='',transp=75,text="44",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==46,char='',transp=75,text="46",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==48,char='',transp=50,text="48",textcolor=blue,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==50,char='',transp=75,text="50",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==52,char='',transp=75,text="52",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==54,char='',transp=75,text="54",textcolor=black,location=location.belowbar)

plotchar((barssince(is_new_day())+1)==56,char='',transp=75,text="56",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==58,char='',transp=75,text="58",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==60,char='',transp=75,text="60",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==62,char='',transp=75,text="62",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==64,char='',transp=75,text="64",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==66,char='',transp=50,text="66",textcolor=blue,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==68,char='',transp=75,text="68",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==70,char='',transp=75,text="70",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==72,char='',transp=75,text="72",textcolor=black,location=location.belowbar)

plotchar((barssince(is_new_day())+1)==74,char='',transp=75,text="74",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==76,char='',transp=75,text="76",textcolor=black,location=location.belowbar)
plotchar((barssince(is_new_day())+1)==78,char='',transp=75,text="78",textcolor=black,location=location.belowbar)

1 个答案:

答案 0 :(得分:0)

原来,该问题在Chrome中没有出现,我在使用Firefox。猜猜我将切换到Chrome。但是谢谢你!