pine-script - 如何更正我在 line.new() 中的负索引?脚本
问题描述
//我的line.new
函数有问题。我想要一条在 0830-1630 之间从接近到接近的线,所以可能是对角线......
_zoneSession = input(title = "Session", type = input.session, defval = "0830-1630:1234567")
_zoneInitialBalanceStop = input(title = "Initial Balance Session", type = input.session, defval = "0930-0931:1234567")
_timeZone = time(timeframe.period, _zoneSession)
_hLZone = time(timeframe.period,_zoneInitialBalanceStop)
_session_Start= plot(na(_timeZone)[1] == 1 and na(_timeZone) == 0 ? close : na, style = plot.style_histogram, linewidth = 3, color = color.green)
_session_Stop= plot(na(_timeZone)[1] == 0 and na(_timeZone) == 1 ? close : na, style = plot.style_histogram, linewidth = 3, color = color.green)
_session_bal_Stop= plot(na(_hLZone)[1] == 0 and na(_hLZone) == 1 ? close : na, style = plot.style_histogram, linewidth = 3, color = color.red)
_sessionSy1_condx1 = na(_timeZone)[1] == 1 and na(_timeZone) == 0 ? close : na
_sessionSy1_condx2 = na(_timeZone)[1] == 0 and na(_timeZone) == 1 ? close : na
//I HAVE PROBLEMS WITH THE LINE.NEW FUNCTION I WNAT A LINE FROM CLOSE TO CLOSE BTWN 0830-1630 so probably a diagonal...
line.new(timestamp(year,month,dayofmonth,08,30),_sessionSy1_condx1, timestamp(year,month,dayofmonth,16,30),_sessionSy1_condx2, xloc= xloc.bar_index, extend = extend.right)
解决方案
为和使用时间值时需要xloc= xloc.bar_time
在您的通话中使用。line.new
x1=
x2=
推荐阅读
- laravel - .htaccess 404 错误与 10 月 CMS 插件中的 webp 转换
- javascript - 使用 Teachable 上的代码块将 Google 表单嵌入具有自动高度的 iFrame
- sql-server - 可以在线将数据库添加到 HA 组吗?
- c++ - 我试图在另一个函数中调用 void 函数,但我不知道如何正确放置它们
- c - 程序中的无限循环编写为关于查找 Pi 值的练习
- android - 使用预构建的共享库构建 Android 命令行可执行文件
- javascript - 尽管有授权标头,但 Axios 请求返回 401
- azure-data-factory-2 - Unpivot 转换错误:XX 列不是相同的 unpivot 数据类型(ADF 中的数据流)
- flutter - Flutter 上带有 CustomPaint 小部件的自定义形状可点击区域
- generics - 如何绑定结构的泛型类型,使其成为关联函数的具体类型?