使用security时如何避免重画

问题描述

enter image description here我尝试在Tradingview上使用PineCoders f_secureSecurity代码,以避免在使用security()时重新绘制,对于以下代码,但是仍然在重新绘制,请您能帮我了解什么是错的吗?

//@version=4
strategy(title="archiesma",overlay=true,default_qty_type=strategy.percent_of_equity,default_qty_value=100)

timeFrame = input(title="Other time frame",type=input.resolution,defval="")
f_secureSecurity(_symbol,_res,_src) => security(_symbol,_src[1],lookahead = barmerge.lookahead_on)

L = close > open
S = close < open

LongW = f_secureSecurity(heikinashi(syminfo.tickerid),timeFrame,L)
ShortW = f_secureSecurity(heikinashi(syminfo.tickerid),S)


strategy.entry("Long",strategy.long,when = LongW)
strategy.entry("Short",strategy.short,when = ShortW)

strategy.close("Long",when = ShortW)
strategy.close("Short",when = LongW)

解决方法

https://www.google.com/amp/s/fr.tradingview.com/script/cyPWY96u-How-to-avoid-repainting-when-using-security-PineCoders-FAQ/%3famp

首先:在Google上搜索

第二:询问