简体   繁体   中英

How do separate panes work in Pinescript?

I'm trying to create a strategy that includes 2 basic factors:

  1. Creating a label that marks the second green bar to open above the 9 day SMA line on the chart as confirmation.
  2. Having a separate RSI indicator in it's own pane below the chart.

I'm having trouble keeping the RSI and bar confirmation labelling separate, the chart labels seem to get dragged down into the RSI pane below.

Also, Once I deleted the RSI code, the bar confirmation chart labels remained in the below pane where the RSI was.

Below is the code to mark the second green bar to open above the SMA, how do I get it out of the separate pane?


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)

Unfortunately, at the moment an indicator/strategy can either be on the main pane (with overlay=true as the argument in the study() or strategy() ) or on its own new pane (by default or with overlay=false ). There is no way to have one plot on a separate pane while also having other plots/labels on the main one if you are only using one script.

The only exception to this are the position arrows that the strategy itself creates - they always appear on the main pane, but that is hardcoded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM