checkmate711
checkmate711

Reputation: 3461

RSI plot is larger than price plot (PineScript)

Experts,

Having an issue with my first PineScript plots which is that the RSI plot is much larger than the price plot (see screenshot). Any idea how I can move the RSI plot to the bottom and make it smaller?

enter image description here

//@version=5
strategy("Simple MA Strategy", overlay=true, initial_capital=10000)

// Date range
startDate = timestamp(2000, 01, 01, 0, 0, 0)

// Define inputs
ema1Value = input(title="EMA 1", defval=50)
ema1Source = input(title="EMA 1 Source", defval=close)
ema2Value = input(title="EMA 2",defval=200)
ema2Source = input(title="EMA 2 Source", defval=close)
rsiSource = input(title="RSI Source", defval=close)
rsiLength = input(title="RSI Length",defval=14)
rsiOverboughtLevel = input(title="RSI Overbought Level", defval=70)
rsiOversoldLevel = input(title="RSI Oversold Level", defval=30)

// Indicators
ema1 = ta.ema(ema1Source, ema1Value)
ema2= ta.ema(ema2Source, ema2Value)
rsi = ta.rsi(rsiSource,14)
rsiValue = ta.rsi(rsiSource, rsiLength)

// Rules
ema_crossover = ta.crossover(ema1, ema2)
ema_crossunder = ta.crossunder(ema1, ema2)
isRsiOverbought = rsiValue >= rsiOverboughtLevel
isRsiOversold = rsiValue <= rsiOversoldLevel


// Plot indicators & levels
plot(ema1, color=color.green,linewidth = 1)
plot(ema2, color=color.fuchsia,linewidth = 1)

plot(rsi, "RSI", color=color.rgb(0, 18, 212))
rsiOversoldLine = hline(rsiOverboughtLevel, "OerSold", color=#C0C0C0)
rsiOverboughtLine = hline(rsiOversoldLevel, "OverBought", color=#C0C0C0)
fill(rsiOversoldLine, rsiOverboughtLine, color=color.rgb(147, 163, 208, 86), title="Background")

Upvotes: 0

Views: 242

Answers (1)

fillobotto
fillobotto

Reputation: 3785

You should plot the RSI in a different panel by using apposite overlay flag set to false.

strategy("Simple MA Strategy", overlay=false, initial_capital=10000)

Upvotes: 1

Related Questions