You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何引用证券的高低价?使用request.security能否直接获取标的高低价?

关于Pine Script中request.security获取多数据系列的问题

当你调用request.security("SPX", timeframe.period, close)时,这个请求仅会返回SPX在当前时间框架下的收盘价数据。如果你需要获取同一标的的最高价(high)或最低价(low),不能直接引用,必须通过以下两种方式之一获取:

  • 发起额外的request.security()请求,分别指定目标数据系列:
spxClose = request.security("SPX", timeframe.period, close)
spxHigh = request.security("SPX", timeframe.period, high)
spxLow = request.security("SPX", timeframe.period, low)
  • 在单次请求中同时获取多个数据系列,用元组打包返回(更高效,减少请求次数):
[spxClose, spxHigh, spxLow] = request.security("SPX", timeframe.period, [close, high, low])

内容的提问来源于stack exchange,提问作者KarlEs

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 02:55:28