0bps

Strategy vault / Momentum

Low Risk Stable Cryptocurrency High Frequency Trading Strategy Based on RSI and MACD

This strategy is a cryptocurrency high-frequency trading strategy based on the Relative Strength Index (RSI) and Moving Average Convergence Divergence (MACD) indicators. It uses two moving averages (MA) with…

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

IMG

Overview

This strategy is a cryptocurrency high-frequency trading strategy based on the Relative Strength Index (RSI) and Moving Average Convergence Divergence (MACD) indicators. It uses two moving averages (MA) with different periods to determine the trend, and combines RSI and MACD indicators to confirm entry and exit signals. The strategy aims to achieve low-risk, stable profits.

Strategy Principle

  1. Calculate the fast MA and slow MA using 9 and 21 periods respectively.
  2. Calculate the RSI indicator with a 14-period.
  3. Calculate the MACD indicator with a fast period of 12, a slow period of 26, and a signal period of 9.
  4. When the fast MA crosses above the slow MA, and RSI is greater than 50, and the MACD fast line is greater than the signal line, open a long position.
  5. When the fast MA crosses below the slow MA, or RSI is less than 50, or the MACD fast line is less than the signal line, close the long position.

Strategy Advantages

  1. Combining multiple indicators to confirm signals, improving entry accuracy and reducing false signal risk.
  2. Using MAs with different periods to determine trends, adapting to different market conditions.
  3. Strict stop-loss conditions, closing positions once the trend reverses or momentum weakens, effectively controlling drawdowns.
  4. High-frequency trading with multiple trades, moderate profit/loss ratio per trade, accumulating small gains for steady growth.

Strategy Risks

  1. In a choppy market, MA crossovers may occur frequently, leading to excessive trading and increased transaction costs.
  2. Both RSI and MACD are lagging indicators, which may result in delayed signals and missed optimal entry opportunities.
  3. The strategy parameters are fixed and lack dynamic adjustment, which may not adapt to market changes.

Strategy Optimization Directions

  1. Introduce volatility indicators, such as ATR, to increase stop-loss levels and reduce trading frequency in high-volatility markets.
  2. Optimize the parameters of RSI and MACD indicators to find the best combination and improve signal accuracy.
  3. Incorporate position management, dynamically adjusting positions based on market trend strength and account profitability to improve risk-adjusted returns.
  4. Combine other types of indicators, such as volume-price indicators and pattern indicators, to build a multi-factor model and enhance strategy robustness.

Summary

This strategy is a high-frequency trading strategy based on MA, RSI, and MACD indicators. By using strict signal confirmation and stop-loss conditions, it can achieve stable, low-risk returns in trending markets. However, it may face frequent trading issues in choppy markets and also has the risk of lagging signals. Future optimizations can be made in areas such as parameter optimization, dynamic position management, and multi-factor models to improve adaptability and risk-adjusted returns.

Parameters

NameDefaultWhat it controls
v_input_19Longueur MA Rapide
v_input_221Longueur MA Lente
v_input_314Longueur RSI
v_input_412MACD Rapide
v_input_526MACD Lent
v_input_69Signal MACD

Source Pine Script

/*backtest
start: 2023-04-06 00:00:00
end: 2024-04-11 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Scalping Amélioré avec RSI et MACD", overlay=true)

// Paramètres des indicateurs
fastLength = input(9, title="Longueur MA Rapide")
slowLength = input(21, title="Longueur MA Lente")
rsiLength = input(14, title="Longueur RSI")
macdFast = input(12, title="MACD Rapide")
macdSlow = input(26, title="MACD Lent")
macdSignal = input(9, title="Signal MACD")

// Calcul des indicateurs
fastMA = ta.sma(close, fastLength)
slowMA = ta.sma(close, slowLength)
rsi = ta.rsi(close, rsiLength)
[macdLine, signalLine, _] = ta.macd(close, macdFast, macdSlow, macdSignal)

// Conditions d'entrée
longCondition = ta.crossover(fastMA, slowMA) and rsi > 50 and macdLine > signalLine
if (longCondition)
    strategy.entry("Long", strategy.long)

// Conditions de sortie
exitCondition = ta.crossunder(fastMA, slowMA) or rsi < 50 or macdLine < signalLine
if (exitCondition)
    strategy.close("Long")

// Affichage des indicateurs
plot(fastMA, color=color.red, title="MA Rapide")
plot(slowMA, color=color.blue, title="MA Lente")
hline(50, "Niveau 50 RSI", color=color.orange)

Published by ChaoZhang on the FMZ strategy square · last modified 2024-04-12. 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/Low-Risk-Stable-Cryptocurrency-High-Frequency-Trading-Strategy-Based-on-RSI-and-MACD.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