单独的窗格如何在 Pinescript 中工作?

How do separate panes work in Pinescript?

我正在尝试创建一个包含 2 个基本因素的策略:

  1. 创建一个标签,将第二个绿色条标记为在图表上的 9 天 SMA 线上方打开作为确认。
  2. 在图表下方自己的窗格中有一个单独的 RSI 指标。

我无法将 RSI 和柱状图确认标签分开,图表标签似乎被拖到下面的 RSI 窗格中。

此外,在我删除 RSI 代码后,确认条形图标签仍保留在 RSI 所在的下方窗格中。

下面是标记第二个绿色条在 SMA 上方打开的代码,我如何将其从单独的窗格中取出?


strategy(title="Swing Strat", overlay=false, pyramiding=1, default_qty_value=2,   default_qty_type=strategy.fixed, initial_capital=10000, currency=currency.USD)


//Plotting MA

MAPeriod9 = input(9, title="9 MA Period")
MA9 = sma(close, MAPeriod9)
MAPeriod180 = input(180, title="180 MA Period")
MA180 = sma(close, MAPeriod180)

plot(MA9, color=color.blue, linewidth=1)
plot(MA180, color=color.red, linewidth=1)

//checking to see if there are 2 bars above the sma line

MAcrossover = crossover(close, MA9)
entrypoint = barssince(MAcrossover)

//marking the second green bar to open above the SMA line
if entrypoint==1 and MA9<open and open<close and open[1]<close[1]
    lun1 = label.new(bar_index, open, 'entrypoint', 
      color=color.red, 
      textcolor=color.red,
      style=label.style_xcross, size=size.small)

不幸的是,目前 indicator/strategy 可以在主窗格中(使用 overlay=true 作为 study()strategy() 中的参数)或其上自己的新窗格(默认或 overlay=false)。如果您只使用一个脚本,则无法在单独的窗格中有一个绘图,同时在主窗格中还有其他 plots/labels。

唯一的例外是策略本身创建的位置箭头 - 它们总是出现在主窗格中,但这是硬编码的。