簡體   English   中英

Pinescript:具有自引用變量的舊腳本

[英]Pinescript: Old scripts with self-referencing variables

我必須使用舊腳本(V2)我只想為自己修改,不要聯系任何人來幫助我解決我糟糕的編碼技能;)

代碼看起來是這樣的:

重量 = s(abs(變化(關閉)))

c = 重量 * close + (1-weight) * nz(c[1],close)

(錯誤來自 c,因為我認為它是一個自引用變量)

在這種情況下,也許有人可以幫助我如何為 pinescript4 聲明 c。

感謝優勢:)

可以幫助:

//@version=2
//...
s = nz(s[1]) + close
Compiling this piece of code with Pine version 3 will give you an Undeclared identifier 's' error. It should be rewritten as:
//@version=3
//...
s = 0.0
s := nz(s[1]) + close // ok

你的代碼:

//@version=3
study("My script")
weight = abs(change(close))
c = 0.
c := weight * close + (1-weight) * nz(c[1],close)
plot(c)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM