This strategy combines the Bollinger Bands indicator and the Heiken Ashi technique to identify trading opportunities by detecting the direction of Heiken Ashi candles and the width of Bollinger Bands. It adopts 10-second K-line bars to determine the trend direction. As a high-frequency algorithmic trading strategy, it is suitable for quantitative trading on high-speed public chains such as Solana.
This strategy makes judgments mainly based on the following two indicators:
Heiken Ashi Technique: Determine the price trend direction by calculating the open and close prices of Heiken Ashi candles. If there are N consecutive bullish Heiken Ashi candles, it is considered as a bullish signal. If there are N consecutive bearish Heiken Ashi candles, it is considered as a bearish signal.
Bollinger Bands Indicator: Measure the volatility and overheat of prices by calculating the standard deviation range. If the width of Bollinger Bands is greater than a threshold, it means high price fluctuation and a significant trend.
The specific trading logic is:
Go long if there are consecutive N bullish Heiken Ashi signals and the Bollinger Bands width is greater than the volatility threshold.
Go short if there are consecutive N bearish Heiken Ashi signals and the Bollinger Bands width is greater than the volatility threshold.
By combining the Bollinger Bands and Heiken Ashi indicators, this strategy comprehensively judges the market volatility and the price trend direction, capturing short-term profit opportunities at high frequency time scales.
This strategy has the following advantages:
Improved signal accuracy by combining multiple indicators. Heiken Ashi determines the general trend while Bollinger Bands measures volatility. The combination enhances the reliability of trading signals.
High-frequency algorithmic trading to capture short-term profits. 10-second bars combined with efficient exchanges like Solana enable high-frequency entry and exit suitable for short-term scalping.
Great flexibility in adjustable parameters. The numbers of Heiken Ashi candles, Bollinger Bands parameters etc. can be adjusted to adapt to different market environments.
Simple implementation and easily extensible. This strategy mainly employs basic indicators with concise code, facilitating future expansions of functionality.
The main risks of this strategy include:
Slippage risk from high-frequency trading. Adopt efficient exchanges, adjust trading frequency and other means to avoid.
Failure when Bollinger Bands contract. Combine with other indicators like KDJ to determine trend.
False signals from Heiken Ashi. Adjust candle numbers, confirm with other indicators when necessary.
Great influence from news in high-frequency time frames. Pay attention to significant news events and pause trading when necessary.
This strategy can be further improved in the following aspects:
Leverage deep learning etc. to judge reliability of Heiken Ashi signals.
Add stop loss mechanisms to control per trade risks.
Form portfolio trading with more indicators to enhance stability.
Adjust parameters for different coins and construct cross-coin portfolios.
Utilize high-frequency data for trend prediction and early opportunity spotting.
This is a typical short-term high-frequency algorithmic trading strategy combining Heiken Ashi and Bollinger Bands. It has advantages like relatively high signal accuracy and capturing short-term profits at high frequency. It also has certain risks like slippage and false signals. Optimization methods like parameter tuning, risk control mechanisms and indicator combinations can help improve it. Overall it is a highly extensible short-term quantitative strategy idea.
/*backtest start: 2022-12-20 00:00:00 end: 2023-12-26 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 strategy("ANCIENT TECHNOLOGY", overlay=true) // Input for the number of consecutive candles consecutiveCandles = input(1, title="Number of Consecutive Candles", minval=1, maxval=6) // Bollinger Band parameters lengthBB = input(4, title="Bollinger Band Length") multBB = input(20, title="Bollinger Band Multiplier") volatilityThreshold = input(0.2, title="Volatility Threshold") // Calculate Bollinger Bands basisBB = sma(close, lengthBB) devBB = multBB * stdev(close, lengthBB) upperBB = basisBB + devBB lowerBB = basisBB - devBB bandWidth = upperBB - lowerBB // Initialize Heiken Ashi variables var float haOpen = na var float haClose = na // Update Heiken Ashi calculations if (na(haOpen)) haOpen := (open + close) / 2 else haOpen := (haOpen + haClose) / 2 haClose := (open + high + low + close) / 4 // Function to check for consecutive green or red Heiken Ashi candles f_consecutive(dir, len) => count = 0 for i = 0 to len - 1 if (dir == "green" and haClose[i] > haOpen[i]) or (dir == "red" and haClose[i] < haOpen[i]) count := count + 1 count == len // Trading conditions based on Heiken Ashi and Bollinger Band width longCondition = f_consecutive("green", consecutiveCandles) and bandWidth > volatilityThreshold shortCondition = f_consecutive("red", consecutiveCandles) and bandWidth > volatilityThreshold // Trading logic if (longCondition) strategy.entry("Long", strategy.long) if (shortCondition) strategy.entry("Short", strategy.short) // Plot entry signals on the chart for visualization plotshape(series=longCondition, title="Long Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY") plotshape(series=shortCondition, title="Short Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6