松文脚本如何如果然后

发布于 2025-01-25 22:05:12 字数 184 浏览 1 评论 0原文

我有一个声明(如果x,则y)。如何添加第二个动作(如果x进行y和z)?

count = 0
if (x)
    do y AND count += 1

另外,您会指定计数类型吗?pine脚本的等效=+是什么? 是否有一个可以使用代码的地方,例如沙盒/控制台(类似于JavaScript)。

I have a statement (if x then do y). How can I add a second action (if x then do y AND z)?

count = 0
if (x)
    do y AND count += 1

Also, would you specify the type for count, and what is pine script's equivalent of =+?
Is there a place to play around with code, like a sandbox/console (similar to JavaScript).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

飞烟轻若梦 2025-02-01 22:05:12
count = 0
if (x)
    do y 
    count += 1

另外,您是否会指定计数类型

另外,除非是na,否则您是否会指定不必 。以下所有内容都是正确的:

int count = 0
count = 0

int count = na
count = int(na)

什么是pine脚本等效的=+

=在Pine脚本中与其他语言相同。

是否有一个可以使用代码的地方,例如沙盒/控制台(类似于JavaScript)

Pine脚本中没有控制台。阅读 this 获得调试帮助。

All actions in the if block will get excuted:

count = 0
if (x)
    do y 
    count += 1

Also, would you specify the type for count

You don't have to, unless it's na. All of the following is correct:

int count = 0
count = 0

int count = na
count = int(na)

what is pine script's equivalent of =+

+= in pine script is the same as in other languages.

Is there a place to play around with code, like a sandbox/console (similar to JavaScript)

There is no console in pine script. Read this to get help with debuging.

心奴独伤 2025-02-01 22:05:12
count=0 
for i= 0 to countyouwant 
 if a=b do y 
  count:=count+1 
 else if do somethingelse 
  count:=count +1 `

如果或下一个需要关闭循环,则无休止。
只需谨慎对待垂直线块即可。
因为垂直线表示查询中的if或其他下一个。

count=0 
for i= 0 to countyouwant 
 if a=b do y 
  count:=count+1 
 else if do somethingelse 
  count:=count +1 `

No end if or next needed for close the loop.
Just be carefull about vertical line blocks.
Because vertical lines represents end if or next in the queries.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文