[英]Pine Script seconds resolution timeframe.period
timeframe.period 的值是多少(以秒為單位)?
我檢測秒分辨率的唯一可能方法是使用 timeframe.isseconds
1分鍾將是
if timeframe.period == "1"
“S”表示 1 秒、“5S”、“15S”或“30S”。
您可以使用 PineCoders 的f_resInMinutes()
function 以浮點分鍾格式返回 TF。 讓事情變得更簡單。
您可以使用以下命令運行簡單的發現測試:
//@version=4
study("")
f_print(_text) => var _label = label.new(bar_index, na, _text, xloc.bar_index, yloc.price, color(na), label.style_none, color.gray, size.large, text.align_left), label.set_xy(_label, bar_index, highest(10)[1]), label.set_text(_label, _text)
f_print(timeframe.period)
// ————— Converts current chart timeframe into a float minutes value.
f_resInMinutes() =>
_resInMinutes = timeframe.multiplier * (
timeframe.isseconds ? 1. / 60 :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 60. * 24 :
timeframe.isweekly ? 60. * 24 * 7 :
timeframe.ismonthly ? 60. * 24 * 30.4375 : na)
plot(f_resInMinutes())
披露:此答案中的鏈接指向 PineCoders 常見問題解答條目。
我是 PineCoders 社區的成員,我很可能寫了那個常見問題解答條目。 PineCoders 是由 TradingView 支持的志願者 Pine 編碼員小組,PineCoders 的網站具有嚴格的教育性質。 TradingView 和 PineCoders 都不會從向 pinecoders.com 發送流量中獲得經濟利益,並且該網站不包含任何附屬/推薦鏈接。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.