[英]How can I save pivot points to an array to be referenced later in pine-script?
[英]How to use default values for array parameters in pine-script functions?
松腳本;
有沒有辦法提供默認數組值?
例如:
// @version=5
library("mylibrary", overlay = true)
// This is OK
export calc(int a = 10, int[] b) => ...
// This is NOT OK
export calc(int a = 10, int[] b = array.from(1,2)) => ...
您不能提供默認值作為數組。 並且數組參數不能省略。
將來會有辦法在 function 簽名中分配int[] b = na
。 之后,您將能夠檢查傳遞的數組是否為“na”,然后重新分配它。
可以這樣做:
// @version=5
library("mylibrary", overlay = true)
export calc(int[] b = na) =>
arr = na(b) ? array.from(1,2) : b
array.size(b)
plot(calc())
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.