Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotting multiple graphs, some overlay, some not

I want to create a few strategies that involve some indicators that should be plotted over the candles, others that should go into their own windows because they have different scales.

Let's say for the sake of the example that we want to plot BB and MACD in the same graph. We want the BB over the candles graph, the MACD into its own window. How do I do this? If I use "overlay=true", both are plot in the candles graph. If I try "overlay=false", then the BBs are not plotted over the candles. Plus, AFAIK we can only have one "strategy(overlay=xx)" per script.

Appreciate your help!

like image 521
42piratas Avatar asked Nov 16 '25 10:11

42piratas


1 Answers

This cannot be done in a single script in Pine. One script always pertains to a single window.
You can however have your indicator bounded to the left scale, so that it doesn't distort the main chart.
To do that, you have to enter the scale parameter on the study() function.

Like this:

//@version=4
study("Quality of earnings", overlay=true, scale=scale.left)

cfo = financial(syminfo.tickerid, "CASH_F_OPERATING_ACTIVITIES", "FY")
net = financial(syminfo.tickerid, "NET_INCOME", "FY")

qoe = cfo/net

plot(qoe, style=plot.style_stepline)

Source of this example is Tradingview Pine script plot staircase chart

like image 164
Bjorn Mistiaen Avatar answered Nov 19 '25 09:11

Bjorn Mistiaen