代码之家  ›  专栏  ›  技术社区  ›  Thomas

如何在pinescript中的输入之间放置分隔线?

  •  0
  • Thomas  · 技术社区  · 6 月前

    以一张图片为例:

    enter image description here

    我想在各部分之间绘制水平线,就像在这个对话框中一样。

    医生( https://www.tradingview.com/blog/en/organize-script-inputs-in-sections-and-lines-23321/ )对此一无所知。 我也检查了ChatGPT,但没有得到任何结果。

    有没有可能这是一个没有暴露在pinescript中的功能?

    1 回复  |  直到 6 月前
        1
  •  0
  •   vitruvius    6 月前

    您可以使用直线作为组标题。

    //@version=6
    indicator("My script", overlay=true)
    
    gr_1 = "________________________________________"
    
    in_1 = input.bool(true, "Input 1", group=gr_1)
    in_2 = input.int(100, "Input 2", group=gr_1)
    
    gr_2 = "_______________________________________"
    
    in_3 = input.bool(true, "Input 3", group=gr_2)
    in_4 = input.int(100, "Input 4", group=gr_2)
    
    gr_3 = "______________________________________"
    
    in_6 = input.bool(true, "Input 5", group=gr_3)
    in_7 = input.int(100, "Input 6", group=gr_3)
    
    gr_4 = "_______________________________________"
    
    in_9 = input.bool(true, "Input 7", group=gr_4)
    in_10 = input.int(100, "Input 8", group=gr_4)
    

    enter image description here

    请注意,这些组是通过字符串匹配进行组织的。因此,即使组的变量名不同,如果这些变量的字符串相同,属于这些组的输入也会被分组在一起。因此,您需要确保每个标头中的虚线计数都不同。