OPEN-SOURCE SCRIPT
BTC Momentum Trading - RSI Cross

For the third algorithm (the “trading” strategy), I built a momentum-based system using RSI crossovers on BTCUSD. This algorithm is different from my mean-reversion and trend-trading strategies because it reacts directly to short-term momentum shifts rather than trend direction or oversold conditions.
IF / THEN Logic Used (Momentum Trading)
Long Entry (Buy):
IF the RSI(14) crosses above 55,
THEN the algorithm enters a long position.
(This signals short-term upward momentum.)
Short Entry (Sell):
IF the RSI(14) crosses below 45,
THEN the algorithm enters a short position.
(This signals downside momentum.)
Long Exit:
IF I am in a long position AND RSI crosses below 50,
THEN exit the long position.
Short Exit:
IF I am in a short position AND RSI crosses above 50,
THEN exit the short position.
Purpose of the Strategy
This strategy demonstrates real-time trading behavior, where entries and exits are driven by momentum signals rather than mean reversion or trend structure. It is meant to show how an algo reacts quickly to shifts in strength/weakness in price movement.
Backtest Requirements
I ran the strategy on BTCUSD, 10-minute timeframe (Feb 16–23, 2026).
This produced:
Total trades: 1,284
Profitable trades: 27.92%
Profit factor: 0.886
Drawdown: 2.13%
The large number of trades provides a sufficient sample size for analysis, as required by the assignment.
IF / THEN Logic Used (Momentum Trading)
Long Entry (Buy):
IF the RSI(14) crosses above 55,
THEN the algorithm enters a long position.
(This signals short-term upward momentum.)
Short Entry (Sell):
IF the RSI(14) crosses below 45,
THEN the algorithm enters a short position.
(This signals downside momentum.)
Long Exit:
IF I am in a long position AND RSI crosses below 50,
THEN exit the long position.
Short Exit:
IF I am in a short position AND RSI crosses above 50,
THEN exit the short position.
Purpose of the Strategy
This strategy demonstrates real-time trading behavior, where entries and exits are driven by momentum signals rather than mean reversion or trend structure. It is meant to show how an algo reacts quickly to shifts in strength/weakness in price movement.
Backtest Requirements
I ran the strategy on BTCUSD, 10-minute timeframe (Feb 16–23, 2026).
This produced:
Total trades: 1,284
Profitable trades: 27.92%
Profit factor: 0.886
Drawdown: 2.13%
The large number of trades provides a sufficient sample size for analysis, as required by the assignment.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.