TimeChange()功能带有黄色警告。这是什么意思,或者简单地修复它? PINE脚本V5
isNewPeriod = anchor == "Earnings" ? new_earnings :
anchor == "Dividends" ? new_dividends :
anchor == "Splits" ? new_split :
na(src[1]) ? true :
anchor == "Session" ? timeChange("D") :
anchor == "Week" ? timeChange("W") :
anchor == "Month" ? timeChange("M") :
anchor == "Quarter" ? timeChange("3M") :
anchor == "Year" ? timeChange("12M") :
anchor == "Decade" ? timeChange("12M") and year % 10 == 0 :
anchor == "Century" ? timeChange("12M") and year % 100 == 0 :
false
警告是:应在每个计算上调用函数'timechange'以达到一致性。建议从三元操作员或范围提取呼叫。
有趣的是:Pinescript手册甚至不知道此timechange()
函数,既不是V4和V5 。
isNewPeriod = anchor == "Earnings" ? new_earnings :
anchor == "Dividends" ? new_dividends :
anchor == "Splits" ? new_split :
na(src[1]) ? true :
anchor == "Session" ? timeChange("D") :
anchor == "Week" ? timeChange("W") :
anchor == "Month" ? timeChange("M") :
anchor == "Quarter" ? timeChange("3M") :
anchor == "Year" ? timeChange("12M") :
anchor == "Decade" ? timeChange("12M") and year % 10 == 0 :
anchor == "Century" ? timeChange("12M") and year % 100 == 0 :
false
Warning is: The function 'timeChange' should be called on each calculation for consistency. It is recommended to extract the call from the ternary operator or from the scope.
The interesting thing is: the PineScript Manual doesn't even know this timechange()
function, neither V4 nor V5.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,通过在三元运营商中调用该功能,您正在破坏历史记录和一致性。并非所有这些函数都会在每个执行中调用。
如果要修复警告,请在全局范围中使用这些功能,将其结果分配给变量,然后在三元运算符中使用这些变量。
So, by calling that functions within the ternary operators, you are breaking the history and consistency. Not all those functions will be called on each execution.
If you want to fix the warning, use those functions in the global scope, assign their results to a variable and use those variables in the ternary operator instead.