RSI crossing a level
Forge API 1Updated 1 Oct 2026
Strategy
The entry fires on the bar where the RSI crosses up through buy_level, not on every bar it stays above. The exit fires when it reaches exit_level.
rsi_cross.pypythonOpen in the editor
import forge as fg
from forge import param, ta
FORGE_API = 1
class RsiCross(fg.Strategy):
bars = fg.bars.Time("H1")
direction = "long"
period = param.Int(14, min=2, max=50, group="RSI")
buy_level = param.Int(30, min=10, max=45, step=5, group="RSI")
exit_level = param.Int(60, min=50, max=80, step=5, group="RSI")
def compute(self, d) -> fg.Signals:
rsi = ta.rsi(d.close, self.period)
return fg.Signals(
long_entry=ta.crossover(rsi, self.buy_level),
long_exit=rsi > self.exit_level,
)Test in Forge ↗
Opens oathra.app.
Was this page helpful?