首页 > 解决方案 > 如何重新格式化 pine.script 中输入对话框的外观/格式?

问题描述

我用 pine 编写了这个 looong study 的代码,它给了我这个对话框,里面有很多内容可以向下滚动以查看所有内容(见图)。我想知道是否有一种方法可以设置代码,以便这些单独的输入模块(1-4...)可以彼此相邻(图 II),而不是彼此下方(图 I).. . 创建这个 looooong 滚动框?非常感谢每一点帮助。谢谢你们

[我想用代码重新格式化的输入对话框][1]

    study("ALL LINES", overlay=true)
    // GREEN STATS
    src = input(close, title="SRC Green")
    sm =input(1, title="Smooth Green")
    cd = input(1, title="CD Green")                                                 

    // RED STATS
    src2 = input(close, title="SRC RED")
    sm2 =input(1, title="Smooth Red")
    cd2 = input(1, title="CD Red")

    // WHITE STATS
    src3 = input(close, title="SRC White")
    sm3 =input(1, title="Smooth White")
    cd3 = input(1, title="CD White")

    // AQUA STATS
    src4 = input(close, title="SRC Aqua")
    sm4 =input(1, title="Smooth Aqua")
    cd4 = input(1, title="CD Aqua")

    // YELLOW STATS
    src5 = input(close, title="SRC Yellow")
    sm5 =input(1, title="Smooth Yellow")
    cd5 = input(1, title="CD Yellow")

    // MAIN CALC GREEN
    di = (sm - 1.0) / 2.0 + 1.0
    c1 = 2 / (di + 1.0)
    c2 = 1 - c1
    c3 = 3.0 * (cd * cd + cd * cd * cd)
    c4 = -3.0 * (2.0 * cd * cd + cd + cd * cd * cd)
    c5 = 3.0 * cd + 1.0 + cd * cd * cd + 3.0 * cd * cd
    i1 = c1*src + c2*nz(i1[1])
    i2 = c1*i1 + c2*nz(i2[1])
    i3 = c1*i2 + c2*nz(i3[1])
    i4 = c1*i3 + c2*nz(i4[1])
    i5 = c1*i4 + c2*nz(i5[1])
    i6 = c1*i5 + c2*nz(i6[1])
    bfr = -cd*cd*cd*i6 + c3*(i5) + c4*(i4) + c5*(i3)

    // MAIN CALC RED
    di2 = (sm2 - 1.0) / 2.0 + 1.0
    c12 = 2 / (di2 + 1.0)
    c22 = 1 - c12
    c32 = 3.0 * (cd2 * cd2 + cd2 * cd2 * cd2)
    c42 = -3.0 * (2.0 * cd2 * cd2 + cd2 + cd2 * cd2 * cd2)
    c52 = 3.0 * cd2 + 1.0 + cd2 * cd2 * cd2 + 3.0 * cd2 * cd2
    i12 = c12*src2 + c22*nz(i12[1])
    i22 = c12*i12 + c22*nz(i22[1])
    i32 = c12*i22 + c22*nz(i32[1])
    i42 = c12*i32 + c22*nz(i42[1])
    i52 = c12*i42 + c22*nz(i52[1])
    i62 = c12*i52 + c22*nz(i62[1])
    bfr2 = -cd2*cd2*cd2*i62 + c32*(i52) + c42*(i42) + c52*(i32)

    // MAIN CALC WHITE
    di3 = (sm3 - 1.0) / 2.0 + 1.0
    c13 = 2 / (di3 + 1.0)
    c23 = 1 - c13
    c33 = 3.0 * (cd3 * cd3 + cd3 * cd3 * cd3)
    c43 = -3.0 * (2.0 * cd3 * cd3 + cd3 + cd3 * cd3 * cd3)
    c53 = 3.0 * cd3 + 1.0 + cd3 * cd3 * cd3 + 3.0 * cd3 * cd3
    i13 = c13*src3 + c23*nz(i13[1])
    i23 = c13*i13 + c23*nz(i23[1])
    i33 = c13*i23 + c23*nz(i33[1])
    i43 = c13*i33 + c23*nz(i43[1])
    i53 = c13*i43 + c23*nz(i53[1])
    i63 = c13*i53 + c23*nz(i63[1])
    bfr3 = -cd3*cd3*cd3*i63 + c33*(i53) + c43*(i43) + c53*(i33)

    // MAIN CALC AQUA
    di4 = (sm4 - 1.0) / 2.0 + 1.0
    c14 = 2 / (di4 + 1.0)
    c24 = 1 - c14
    c34 = 3.0 * (cd4 * cd4 + cd4 * cd4 * cd4)
    c44 = -3.0 * (2.0 * cd4 * cd4 + cd4 + cd4 * cd4 * cd4)
    c54 = 3.0 * cd4 + 1.0 + cd4 * cd4 * cd4 + 3.0 * cd4 * cd4
    i14 = c14*src4 + c24*nz(i14[1])
    i24 = c14*i14 + c24*nz(i24[1]) 
    i34 = c14*i24 + c24*nz(i34[1])
    i44 = c14*i34 + c24*nz(i44[1])
    i54 = c14*i44 + c24*nz(i54[1])
    i64 = c14*i54 + c24*nz(i64[1])
    bfr4 = -cd4*cd4*cd4*i64 + c34*(i54) + c44*(i44) + c54*(i34)

    // MAIN CALC YELLOW
    di5 = (sm5 - 1.0) / 2.0 + 1.0
    c15 = 2 / (di5 + 1.0)
    c25 = 1 - c15
    c35 = 3.0 * (cstrong textd5 * cd5 + cd5 * cd5 * cd5)
    c45 = -3.0 * (2.0 * cd5 * cd5 + cd5 + cd5 * cd5 * cd5)
    c55 = 3.0 * cd5 + 1.0 + cd5 * cd5 * cd5 + 3.0 * cd5 * cd5
    i15 = c15*src5 + c25*nz(i15[1])
    i25 = c15*i15 + c25*nz(i25[1])
    i35 = c15*i25 + c25*nz(i35[1])
    i45 = c15*i35 + c25*nz(i45[1])
    i55 = c15*i45 + c25*nz(i55[1])
    i65 = c15*i55 + c25*nz(i65[1])
    bfr5 = -cd5*cd5*cd5*i65 + c35*(i55) + c45*(i45) + c55*(i35)
``    enter code here


  [1]: https://i.stack.imgur.com/2p1Jy.jpg

标签: pine-script

解决方案


目前无法按照您在屏幕截图中显示的方式对输入进行分组。话虽如此,Pine v4 具有一些与分组输入相关的功能。如果您的指标尚未使用 v4 编写,则需要将其更新到 v4。之后,group向您的输入添加一个参数会将它们组合在一个输入“块”中,并以该组作为它们的标题。添加inline参数将在一行中显示具有相同内联的所有输入。所以你可以有这样的东西:

//@version=4
study("ALL LINES", overlay=true)
// GREEN STATS
src = input(close, title="SRC",    group="Green", inline="Green")
sm  = input(1,     title="Smooth", group="Green", inline="Green")
cd  = input(1,     title="CD",     group="Green", inline="Green")                                                 
// RED STATS
src2 = input(close, title="SRC",    group="Red", inline="Red")
sm2  = input(1,     title="Smooth", group="Red", inline="Red")
cd2  = input(1,     title="CD",     group="Red", inline="Red")                                                 
// WHITE STATS
src3 = input(close, title="SRC",    group="White", inline="White")
sm3  = input(1,     title="Smooth", group="White", inline="White")
cd3  = input(1,     title="CD",     group="White", inline="White")                                                 
plot(close)

在此处输入图像描述


推荐阅读