0bps

Strategy vault / Breakout

Momentum Breakout Moving Average Trading Strategy 434187

This strategy integrates Relative Strength Index (RSI), SuperTrend indicator and Average True Range (ATR) to construct a comprehensive and practical quantitative trading strategy.

Author
ChaoZhang
Complexity
Starter · 45 lines
Parameters
3
Backtest bar
1d · swing
Tested on
BTC/USDT · futures

IMG

Overview

This strategy integrates Relative Strength Index (RSI), SuperTrend indicator and Average True Range (ATR) to construct a comprehensive and practical quantitative trading strategy.

Strategy Logic

Relative Strength Index (RSI)

RSI is a powerful oscillating indicator that judges if the market is overbought or oversold by measuring the velocity and magnitude of price movements. RSI below oversold region indicates oversold signal, while RSI above overbought region is overbought signal.

SuperTrend Indicator

SuperTrend is a trend following indicator that helps identify current trend direction. Price above SuperTrend line indicates an uptrend while price below SuperTrend line an downtrend.

Average True Range (ATR)

ATR measures the degree of market volatility and risk level. Higher ATR represents higher market volatility while lower means relatively calm. This strategy leverages ATR to set stop loss and profit target.

Strategy Execution Logic

Long Signal: When fast RSI crosses below slow RSI while price is above SuperTrend line to go long.

Short Signal: When fast RSI crosses above slow RSI while price is below SuperTrend line to go short.

Exit Rule: If holding long position, exit when fast RSI crosses above slow RSI OR price falls below SuperTrend line. If holding short position, exit when fast RSI crosses below slow RSI OR price rises above SuperTrend line.

Advantages

  1. Trend Following: SuperTrend identifies trend clearly.

  2. Momentum Confirmation: RSI ensures trades align with market sentiment.

  3. Volatility Adaptive: ATR-driven stop loss adapts to varying market conditions.

Risks & Solutions

  1. Trend Misalignment Risk: Probability of conflicts between SuperTrend and actual trend direction resulting losses. Parameter optimization helps to improve accuracy.

  2. Premature Stop Loss Risk: Stop loss too close may get hit unintentionally. Reasonable stop distance should be set.

  3. Parameter Risk: Improper RSI parameters setting affects timing of entries and exits. Careful backtests required to determine proper parameters.

Enhancement Recommendations

  1. Add other technical indicators to filter signals improving system stability.

  2. Optimize RSI parameters based on maximum drawdown constraints.

  3. Leverage heuristic algorithms to search optimal SuperTrend parameters.

Conclusion

This strategy integrates trend, momentum and volatility indicators constructing a quantitative model with clear signals, flexible parameter tuning, and sound risk control. With continuous testing and enhancement, it is promising to achieve steady above-average returns over the long run.

Parameters

NameDefaultWhat it controls
v_input_114RSI Length 1
v_input_221RSI Length 2
v_input_31.5SuperTrend Multiplier

Source Pine Script

/*backtest
start: 2022-11-27 00:00:00
end: 2023-12-03 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("RSI, SuperTrend, and ATR Strategy", overlay=true)

// Define input parameters
rsiLength1 = input(14, title="RSI Length 1")
rsiLength2 = input(21, title="RSI Length 2")
supertrendMultiplier = input(1.5, title="SuperTrend Multiplier")

// Calculate indicators
rsi1 = ta.rsi(close, rsiLength1)
rsi2 = ta.rsi(close, rsiLength2)
supertrend = ta.atr(14) * supertrendMultiplier

// Define trading conditions
rsiLongCondition = rsi1 > rsi2
rsiShortCondition = rsi1 < rsi2
supertrendLongCondition = close > supertrend
supertrendShortCondition = close < supertrend

// Execute trades
if (rsiLongCondition and supertrendLongCondition)
    strategy.entry("Long", strategy.long)

if (rsiShortCondition and supertrendShortCondition)
    strategy.entry("Short", strategy.short)

if (strategy.position_size > 0 and (rsiShortCondition or supertrendShortCondition))
    strategy.close("Long")

if (strategy.position_size < 0 and (rsiLongCondition or supertrendLongCondition))
    strategy.close("Short")

// Plot indicators on the chart
plot(rsi1, color=color.orange, title="RSI 1")
plot(rsi2, color=color.yellow, title="RSI 2")
plot(supertrend, color=color.blue, title="SuperTrend")

Published by ChaoZhang on the FMZ strategy square · last modified 2023-12-04. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Momentum-Breakout-Moving-Average-Trading-Strategy-434187.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open