首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

如何在pinescript中获得之前最高的值?

在Pine Script中,要获得之前最高的值,可以使用highest()函数。该函数用于返回指定周期内的最高值。

highest()函数的语法如下:

代码语言:txt
复制
highest(source, length)

其中,source表示要计算最高值的数据源,可以是任何数值类型的数据,如收盘价、最高价等。length表示要计算最高值的周期长度,可以是一个常量或变量。

以下是一个示例代码,演示如何在Pine Script中使用highest()函数来获取之前最高的值:

代码语言:txt
复制
//@version=4
study("Previous Highest Value", shorttitle="PHV")

length = input(10, "Length")
highestValue = highest(high, length)

plot(highestValue, color=color.blue, linewidth=2, title="Previous Highest Value")

在上述示例中,我们使用highest()函数计算了最近10个周期内的最高价,并将结果绘制在图表上。

推荐的腾讯云相关产品和产品介绍链接地址:

  • 腾讯云云服务器(CVM):https://cloud.tencent.com/product/cvm
  • 腾讯云云数据库 MySQL 版:https://cloud.tencent.com/product/cdb_mysql
  • 腾讯云云原生容器服务(TKE):https://cloud.tencent.com/product/tke
  • 腾讯云人工智能平台(AI Lab):https://cloud.tencent.com/product/ai
  • 腾讯云物联网平台(IoT Explorer):https://cloud.tencent.com/product/iotexplorer
  • 腾讯云移动开发平台(MTP):https://cloud.tencent.com/product/mtp
  • 腾讯云对象存储(COS):https://cloud.tencent.com/product/cos
  • 腾讯云区块链服务(BCS):https://cloud.tencent.com/product/bcs
  • 腾讯云元宇宙(Tencent XR):https://cloud.tencent.com/product/xr
页面内容是否对你有帮助?
有帮助
没帮助

相关·内容

领券