Code Library / Entry Signals

RSI Crossover Strategy

Pine Script strategy with RSI crossover buy/sell signals.

Language: Pine Script · Category: Entry Signals · Tags: RSI, crossover, Pine Script

Source code

//@version=5
strategy("RSI Crossover", overlay=true)
rsiVal = ta.rsi(close, 14)
if ta.crossover(rsiVal, 30)
    strategy.entry("Long", strategy.long)
if ta.crossunder(rsiVal, 70)
    strategy.close("Long")

How to use this snippet

This is a building block, not a finished trading system. Paste it into your own Pine Script project, compile it, and test it on a demo account with your broker's real spreads before relying on it. You can convert it to MQL4 or MQL5 with the Pine Script converter.

Related snippets