0bps

Strategy vault / Mean reversion

Multi indicator Combined Quantitative Trading Strategy

This strategy uses three technical indicators of stock price, RSI, StochRSI and Bollinger Bands, and combines trading time and direction conditions to determine buy and sell signals for quantitative trading strategies.

Author
ChaoZhang
Complexity
Intermediate · 67 lines
Parameters
17
Backtest bar
1h · intraday
Tested on
BTC/USDT · futures

IMG

Overview

This strategy uses three technical indicators of stock price, RSI, StochRSI and Bollinger Bands, and combines trading time and direction conditions to determine buy and sell signals for quantitative trading strategies.

Principle

When the RSI indicator is less than the lower area and the StochRSI K line crosses above the D line, it is considered a buy signal. At the same time, the stock price is cheaper than the lower line of the Bollinger Band or crosses below the lower line of the Bollinger Band is also used as a basis for buying.

When the RSI indicator exceeds the upper area and the StochRSI K line crosses below the D line, it is considered a sell signal. At the same time, the stock price is higher than the upper line of the Bollinger Band or breaks through the upper line of the Bollinger Band is also used as the basis for selling.

The RSI indicator judges whether the stock price is overbought or oversold, StochRSI judges the momentum of the stock price, and Bollinger Bands judges whether the stock price is running at high levels and cheap. Multiple indicators combine to determine buying and selling.

Advantage Analysis

This is a multi-indicator combined strategy with wide coverage of indicators and comprehensive judgment basis. Crossing is required between the current stock price or indicator and its threshold before judging the signal, which has a certain filtering effect on false signals.

Time condition restrictions are added before placing orders to avoid greater risks during specific time periods.

By combining the judgments of multiple indicators, more types of trends can be matched to improve the effectiveness of the strategy.

Risk Analysis

The strategy relies mainly on three types of indicators. If the indicator gives a wrong signal, the strategy will cause losses. Indicators should verify each other and cannot completely rely on a certain indicator. For example, RSI oscillation in a certain period of time will increase the possibility of issuing false signals.

The time judgment conditions added in the strategy may also miss favorable market conditions.

If the stock selection is inappropriate, for example, stocks with severe exaggeration effects, the validity of these indicators will be greatly reduced. The applicability of stocks to these indicators should be studied.

Optimization

  1. Increase risk control measures such as maximum drawdown to limit losses.

  2. Adjust the parameters of the indicator to better match the selected stocks. For example, speed up the RSI parameters to detect faster price changes.

  3. Increase filtering mechanisms, such as suspend trading when the stock price is in the middle of the Bollinger Band to avoid oscillating market conditions. And stop ordering near opening and closing to avoid gap risk.

  4. Stock selection can refer to fundamentals to avoid stocks with serious financial fraud. Industry and market value judgments can also be added to select large-cap stocks.

Summary

This is a typical multi-variable technical indicator strategy with a balanced mix of indicators and extensive coverage. At the same time, the order conditions are rigorous, which can effectively select stocks to achieve profit, and the drawdown will be controlled within a certain range. Through the optimization of indicators and parameters, it can better adapt to the market. At the same time increase risk control mechanism to minimize risk to further improve the stability and reliability of the strategy.

Parameters

NameDefaultWhat it controls
v_input_16lengthrsi
v_input_220overSold
v_input_370overBought
v_input_43smoothK
v_input_53smoothD
v_input_614lengthRSI
v_input_714lengthStoch
v_input_8_close0RSI Source: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4
v_input_950bblength
v_input_101.5Multiplier for BB Upper Band
v_input_111.5Multiplier for BB Lower Band
v_input_122018yearfrom
v_input_132019yearuntil
v_input_146monthfrom
v_input_1512monthuntil
v_input_16truedayfrom
v_input_1731dayuntil

Source Pine Script

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

//@version= 2
strategy("RSI+STOCHRSI+BB Strategy", overlay=true)
lengthrsi = input(6)
overSold = input( 20 )
overBought = input( 70 )
price = close
vrsi = rsi(price, lengthrsi)

smoothK = input(3, minval=1)
smoothD = input(3, minval=1)
lengthRSI = input(14, minval=1)
lengthStoch = input(14, minval=1)
src = input(close, title="RSI Source")

rsi1 = rsi(src, lengthRSI)
k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = sma(k, smoothD)

bblength = input(50)
bbupmult =input(1.5,title="Multiplier for BB Upper Band")
bblowmult = input(1.5,title="Multiplier for BB Lower Band")

basis =  sma(close,bblength)

devup = bbupmult * stdev(close, bblength)
devlow = bblowmult * stdev(close, bblength)

upper = basis + devup
lower = basis - devlow
plot(basis, color=red)
p1 = plot(upper, color=blue)
p2 = plot(lower, color=blue)
fill(p1, p2)


yearfrom = input(2018)
yearuntil =input(2019)
monthfrom =input(6)
monthuntil =input(12)
dayfrom=input(1)
dayuntil=input(31)



if (  ( crossover(k,d)) and ( crossover(vrsi,overSold) or vrsi<overSold)  and (  (price<lower) or crossover(price,lower) ) ) 
    strategy.entry("BUY", strategy.long, stop=close, oca_name="TREND",  comment="BUY")
    
else
    strategy.cancel(id="BUY")


if ( ( crossunder(k,d) ) and ( (vrsi >overBought) or crossunder(vrsi,overBought) ) and  ( (price>upper) or crossunder(price,upper) )) 

    strategy.entry("SELL", strategy.short,stop=close, oca_name="TREND",  comment="SELL")
else
    strategy.cancel(id="SELL")
    
    
    

Published by ChaoZhang on the FMZ strategy square · last modified 2024-01-24. 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/Multi-indicator-Combined-Quantitative-Trading-Strategy.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