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

新手求助:基于指定时间价格在EURUSD图表绘制点及连线的Pine Script实现

在EURUSD图表绘制复盘点位与线段的Pine Script实现

完整代码

//@version=5
indicator("复盘进场离场标记", overlay=true)

// 定义两个目标点位的时间与价格
var float entry_price = 1.06736
var int entry_time = timestamp("2023-03-01", "15:46:02")
var float exit_price = 1.06731
var int exit_time = timestamp("2023-03-01", "17:41:15")

// 绘制进场标记点
plotshape(time == entry_time, title="进场点", location=location.absolute, 
          style=shape.labelup, color=color.new(color.green, 0), 
          text="进场", textcolor=color.white, size=size.small, y=entry_price)

// 绘制离场标记点
plotshape(time == exit_time, title="离场点", location=location.absolute, 
          style=shape.labeldown, color=color.new(color.red, 0), 
          text="离场", textcolor=color.white, size=size.small, y=exit_price)

// 绘制连接两点的线段
line.new(entry_time, entry_price, exit_time, exit_price, 
         color=color.new(color.blue, 0), width=2)

关键说明

  • 采用Pine Script v5版本,确保兼容TradingView最新功能
  • 使用timestamp()将字符串时间转换为平台可识别的时间戳格式
  • plotshape()通过不同样式的标签直观区分进场(绿色上标)和离场(红色下标)点位
  • line.new()直接基于两个点位的时间-价格坐标生成连接线段,线段宽度设为2以增强可见性

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.29 17:52:07