我怎样能够在晚上11点准时重置所有自定义的指数?

huangapple go评论40阅读模式
英文:

how can I rest all my customized index at 11pm sharply

问题

我如何可以在晚上11点准时重置所有自定义的索引?

以下代码对我不起作用。

我的示例

A = B + C
D = A[0] + A[1] + A[2]
rest_bar = timestamp(year, month, dayofmonth, 23, 0, 0)
if rest_bar:
    A == 0
    D == 0
英文:

how can I rest all my customized index at 11pm sharply?

below code is not working for me.

my sample

A = B + C
D = A[0] + A[1] + A[2]
rest_bar = timestamp(year, month, dayofmonth, 23, 0, 0)
if rest_bar
    A == 0
    D == 0

答案1

得分: 0

使用一个可变变量rest_bar必须与其先前的值不同。

类似这样的:

//<设置初始值>
A = 0

B = 1
C = 1
A := B + C
D = A[0] + A[1] + A[2]
rest_bar = timestamp(year, month, dayofmonth, 23, 0, 0)
if rest_bar != rest_bar[1]
    A := 0
    D := 0
英文:

With a mutable variable

and rest_bar must be different from its previous value

Something like that

//<set initial values>
A = 0

B = 1
C = 1
A := B + C
D = A[0] + A[1] + A[2]
rest_bar = timestamp(year, month, dayofmonth, 23, 0, 0)
if rest_bar != rest_bar[1]
    A := 0
    D := 0

huangapple
  • 本文由 发表于 2023年2月8日 08:47:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/75380403.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定