低,ta.lowest

问题描述 投票:0回答:1

我无法获得最低蜡烛的最低值。这是因为我没有付费订阅而出现问题吗?

谢谢

//@version=5
indicator("test philou 10.10.2024", overlay=true)

var float lowest_0 = na

lowest_idx = ta.lowestbars(low,300)  // Trouver la bougie la plus basse
highest_idx = ta.highestbars(high, 300)  // Trouver la bougie la plus haute
lowest_0 := low[lowest_idx]

table_id = table.new(position.top_right, 2, 31, border_width = 1, border_color = color.gray)
if barstate.islast
    table.cell(table_id, 0, 0, text="lowest_idx", bgcolor=#4660c0)
    table.cell(table_id, 1, 0, text=str.tostring(lowest_idx))
    table.cell(table_id, 0, 1, text="highest_idx", bgcolor=#4660c0)
    table.cell(table_id, 1, 1, text=str.tostring(highest_idx))
    table.cell(table_id, 0, 2, text="lowest_0", bgcolor=#4660c0)
    table.cell(table_id, 1, 2, text=str.tostring(lowest_0))

我无法获得最低蜡烛的最低值。这是因为我没有付费订阅而出现问题吗?

pine-script
1个回答
0
投票

不,这不是因为您的订阅。您的代码导致第 8 行出现运行时错误:

enter image description here

第 8 行是

lowest_0 := low[lowest_idx]
,该函数只接受正值,但
ta.lowestbars()
返回一个 OFFSET,一个负数。

我更改了第 8 行并添加了一个减号:

lowest_0 := low[-lowest_idx]
并且脚本编译时没有错误。

我在 2 分钟时间范围内的 TSLA 图表上进行了尝试。最低值为 214.38 美元,与图表上的最低值相对应。

这是你的桌子:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.