0bps

Strategy vault / Scalping

High Frequency Trading Strategy Based on Bollinger Bands and StochRSI Indicators

The strategy is named "Dual Indicator Leading Strategy". It is a long-only high frequency trading strategy that aims to generate frequent trading signals based on the Bollinger Bands and Stochastic RSI indicators…

Author
ChaoZhang
Complexity
Starter · 43 lines
Parameters
5

IMG

Strategy Overview

The strategy is named "Dual Indicator Leading Strategy". It is a long-only high frequency trading strategy that aims to generate frequent trading signals based on the Bollinger Bands and Stochastic RSI indicators. The strategy suits traders who pursue high trading frequency.

Strategy Logic

Indicator Calculation

Firstly, the Bollinger Bands upper band, middle band and lower band are calculated based on user-defined length and standard deviation parameters. The middle band represents the simple moving average of closing prices, while the upper and lower bands represent the standard deviation of price fluctuations.

Then, the Stochastic RSI indicator is computed based on chosen length, K period and D period parameters for StochRSI. This indicator combines the characteristics of RSI and Stochastics indicators to measure the momentum of asset prices.

Buy Condition

The buy condition triggers when the closing price falls below the Bollinger Bands lower band. This suggests that the price is in the lower range of its recent volatility and presents a potential buying opportunity.

Entry and Exit

When the buy condition is met, the strategy enters a long position for seeking opportunity.

The code does not include exit logic, which should be set by traders themselves based on product and timeframe for taking profits or stopping losses.

Advantage Analysis

  • Utilizes Bollinger Bands to identify potential price reversal points
  • StochRSI provides additional momentum judgment
  • Achieves high-frequency trading suitable for scalping strategies
  • Simplicity of only going long
  • Flexibility to optimize parameters for better performance

Risk Analysis

  • Risks of overbought and oversold conditions
  • High trading frequency vulnerable to transaction costs
  • Needs exit logic setting for profit taking or stopping losses
  • Requires strict capital management

Risks can be reduced by adding two-way trading, parameter optimization, stop loss and take profit setting, evaluation of cost hedging etc.

Optimization Directions

  • Add sell conditions to enable two-way trading
  • Optimize parameter mix to reduce false signals
  • Add trend indicator filters
  • Set stop loss and take profit to ensure risk management

Conclusion

This strategy provides a framework for high frequency trading based on Bollinger Bands and StochRSI indicators. Traders can optimize the strategy by adjusting parameters, adding risk management measures etc. according to their trading goals and market conditions, in order to meet the needs of frequent trading.

Parameters

NameDefaultWhat it controls
v_input_int_120Bollinger Bands Length
v_input_float_12Bollinger Bands Deviation
v_input_int_214StochRSI Length
v_input_int_33K Period
v_input_int_43D Period

Source Pine Script

//@version=5
strategy("High Frequency Strategy", overlay=true)

// Define your Bollinger Bands parameters
bollinger_length = input.int(20, title="Bollinger Bands Length")
bollinger_dev = input.float(2, title="Bollinger Bands Deviation")

// Calculate Bollinger Bands
sma = ta.sma(close, bollinger_length)
dev = bollinger_dev * ta.stdev(close, bollinger_length)

upper_band = sma + dev
lower_band = sma - dev

// Define your StochRSI parameters
stoch_length = input.int(14, title="StochRSI Length")
k_period = input.int(3, title="K Period")
d_period = input.int(3, title="D Period")

// Calculate StochRSI
rsi = ta.rsi(close, stoch_length)
k = ta.sma(ta.stoch(rsi, rsi, rsi, k_period), k_period)
d = ta.sma(k, d_period)

// Define a buy condition (Long Only)
buy_condition = close < lower_band

// Place orders based on the buy condition
if (buy_condition)
    strategy.entry("Buy", strategy.long)

// Optional: Plot buy signals on the chart
plotshape(buy_condition, color=color.green, style=shape.triangleup, location=location.belowbar, size=size.small)

// Plot Bollinger Bands on the chart
plot(upper_band, title="Upper Bollinger Band", color=color.blue)
plot(lower_band, title="Lower Bollinger Band", color=color.orange)
plot(k, title="StochRSI K", color=color.green)
plot(d, title="StochRSI D", color=color.red)



Published by ChaoZhang on the FMZ strategy square · last modified 2023-12-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-Trading-Strategy-Based-on-Bollinger-Bands-and-StochRSI-Indicators.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