简体   繁体   English

Pine Script 中的累积行

[英]Cumulative Line in Pine Script

I am new to Pine Script.我是 Pine Script 的新手。 I am trying to make a cumulative line starting at 10000 using the value obtained by subtracting to the value of the Open of a Daily candle the value of the previous Daily Close.我正在尝试使用从每日蜡烛的开盘价减去前日收盘价所获得的值绘制一条从 10000 开始的累积线。

study("Cumulative Line", overlay=false)

apertura = open[0]
cierre = close[1]

suma = 10000.0
suma := suma + (open[0] - close[1]) + 10000.0

plot(suma)

I have tried making a SMA with a length of 1. Nevertheless, this is the error I got:我曾尝试制作长度为 1 的 SMA。不过,这是我得到的错误:

Script could not be translated from: |B|suma := suma + (open脚本无法翻译自:|B|suma := suma + (open

I have tried without making the cumulative line and just ploting a SMA with the values of the difference between the daily candle's open minus the previous daily candle's close and it works.我试过没有制作累积线,只是用每日蜡烛的开盘价减去前每日蜡烛的收盘价之间的差值绘制一个 SMA 并且它有效。 Basically, I do not know how to make a cumulative line of those values, can anybody help me?基本上,我不知道如何制作这些值的累积线,有人可以帮助我吗? Thank you anyway for your time无论如何感谢您的时间

:= operator doesn't work in pinescript version 1 (default if not explicitly mentioned in the script) :=运算符在 pinescript 版本 1 中不起作用(如果脚本中未明确提及,则为默认值)

Add //@version=4 at the beginning of the script:在脚本开头添加//@version=4

//@version=4
study("Cumulative Line", overlay=false)

apertura = open[0]
cierre = close[1]

suma = 10000.0
suma := suma + (open[0] - close[1]) + 10000.0

plot(suma)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM