0bps

Strategy vault / Mean reversion

High Frequency Reversal Trading Strategy Based on Momentum RSI Indicator

This strategy utilizes the RSI indicator to measure price momentum and determines entry timings by calculating the standard deviation of changes in RSI. It enters a long position when the RSI momentum exceeds the…

Author
ChaoZhang
Complexity
Starter · 45 lines
Parameters
5
Backtest bar
1h · intraday
Tested on
BTC/USDT · futures

IMG

Overview

This strategy utilizes the RSI indicator to measure price momentum and determines entry timings by calculating the standard deviation of changes in RSI. It enters a long position when the RSI momentum exceeds the standard deviation threshold and is less than the previous momentum multiplied by an exhaustion factor, and enters a short position under the opposite conditions. The strategy uses limit orders for exit, controlling risk by setting profit target and stop loss ticks. The strategy executes on every price tick to capture all potential price movements.

Strategy Principle

  1. Calculate the RSI indicator to measure price momentum.
  2. Calculate the standard deviation of changes in RSI to determine entry thresholds.
  3. Calculate RSI momentum, which is the change in RSI.
  4. Enter a long position when the RSI momentum exceeds the standard deviation threshold and is less than the previous momentum multiplied by an exhaustion factor.
  5. Enter a short position when the RSI momentum is below the negative standard deviation threshold and is greater than the previous momentum multiplied by an exhaustion factor.
  6. Use limit orders for exit, setting profit target and stop loss ticks.
  7. The strategy executes on every price tick to capture all potential price movements.

Strategy Advantages

  1. High-frequency execution, able to capture more trading opportunities.
  2. Using RSI momentum and standard deviation thresholds, able to enter trades when the price trend is clear.
  3. Introducing an exhaustion factor to avoid entering trades during extreme conditions, reducing risk.
  4. Using limit orders for exit, able to better control risk.
  5. Programmatic trading with high execution efficiency, avoiding the interference of human emotions.

Strategy Risks

  1. High-frequency trading may lead to higher transaction costs.
  2. The RSI indicator may become dull, causing trading signals to fail.
  3. The settings of standard deviation threshold and exhaustion factor need to be optimized according to market conditions, otherwise it may lead to frequent trading or missed trading opportunities.
  4. Limit order exit may result in longer holding periods, taking on more risk.
  5. The strategy may perform poorly in extreme market conditions.

Strategy Optimization Directions

  1. Introduce more indicators, such as price action indicators, to improve the accuracy of trading signals.
  2. Optimize the settings of standard deviation threshold and exhaustion factor to adapt to different market conditions.
  3. Introduce position management, adjusting position size according to market volatility to control risk.
  4. Consider introducing trend filtering, trading when the trend is clear, and avoiding frequent trading in volatile markets.
  5. Optimize the settings of profit target and stop loss ticks to improve the strategy's profit-to-loss ratio.

Summary

This strategy utilizes RSI momentum and standard deviation thresholds to perform reversal trading in a high-frequency environment. By introducing an exhaustion factor and limit order exit, the strategy is able to capture trading opportunities brought by price movements while controlling risk. However, the strategy still needs further optimization in actual application, such as introducing more indicators, optimizing parameter settings, introducing position management and trend filtering, etc., to improve the stability and profitability of the strategy.

Parameters

NameDefaultWhat it controls
v_input_114RSI Period
v_input_2trueStandard Deviation Multiplier
v_input_31.5Exhaustion Multiplier
v_input_48Profit Target (ticks)
v_input_532Stop Loss (ticks)

Source Pine Script

/*backtest
start: 2024-03-01 00:00:00
end: 2024-03-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("MCOTs Intuition Strategy", overlay=true, default_qty_type=strategy.fixed, default_qty_value=1, initial_capital=50000, calc_on_every_tick=true)

// Input for RSI period
rsiPeriod = input(14, title="RSI Period")
// Input for standard deviation multiplier
stdDevMultiplier = input(1.0, title="Standard Deviation Multiplier")
// Input for exhaustion detection
exhaustionMultiplier = input(1.5, title="Exhaustion Multiplier")
// Input for profit target and stop loss in ticks
profitTargetTicks = input(8, title="Profit Target (ticks)")
stopLossTicks = input(32, title="Stop Loss (ticks)")

// Calculate RSI
rsiValue = ta.rsi(close, rsiPeriod)
// Calculate standard deviation of RSI changes
rsiStdDev = ta.stdev(ta.change(rsiValue), rsiPeriod)
// Calculate momentum
momentum = ta.change(rsiValue)

// Conditions for entering a long position
longCondition = momentum > rsiStdDev * stdDevMultiplier and momentum < momentum[1] * exhaustionMultiplier
if (longCondition)
    strategy.entry("Long", strategy.long)
    strategy.exit("Take Profit Long", "Long", limit=close + profitTargetTicks * syminfo.mintick)
    strategy.exit("Stop Loss Long", "Long", stop=close - stopLossTicks * syminfo.mintick)

// Conditions for entering a short position
shortCondition = momentum < -rsiStdDev * stdDevMultiplier and momentum > momentum[1] * exhaustionMultiplier
if (shortCondition)
    strategy.entry("Short", strategy.short)
    strategy.exit("Take Profit Short", "Short", limit=close - profitTargetTicks * syminfo.mintick)
    strategy.exit("Stop Loss Short", "Short", stop=close + stopLossTicks * syminfo.mintick)

// Plotting RSI value for reference
plot(rsiValue, title="RSI", color=color.blue)

Published by ChaoZhang on the FMZ strategy square · last modified 2024-04-18. 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/High-Frequency-Reversal-Trading-Strategy-Based-on-Momentum-RSI-Indicator.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