0

如何在 pine 编辑器中找到奇偶校验和硬币名称,我将在 alert() 命令中使用它。我尝试使用 {{exchange}} 但它不起作用,还有其他方法吗?

4

1 回答 1

0

syminfo.tickerid有你需要的一切,你只需要:用作分隔符并拆分字符串。

这是一个例子:

//@version=5
indicator("My script", overlay=true)

sym = syminfo.tickerid

getName(_str) =>
    string[] _pair = str.split(_str, ":")
    string[] _exchange = str.split(array.get(_pair, 0), "")  // Index 0
    string[] _asset = str.split(array.get(_pair, 1), "")  // Index 1
    string _ret_exc = array.join(_exchange, "")
    string _ret_ass = array.join(_asset, "")
    [_ret_exc, _ret_ass]

var testTable = table.new(position = position.top_right, columns = 1, rows = 3, bgcolor = color.yellow, border_width = 1)
if barstate.islast
    [exchange, asset] = getName(sym)
    table.cell(table_id = testTable, column = 0, row = 0, text = str.tostring(sym))
    table.cell(table_id = testTable, column = 0, row = 1, text = exchange)
    table.cell(table_id = testTable, column = 0, row = 2, text = asset)

在此处输入图像描述

于 2022-02-01T08:18:42.693 回答