Strategy vault / Trend following
Double Hull Moving Average Crossover Trading Strategy
This strategy mainly uses the crossover of two Hull Moving Averages of different timeframes to determine market trends and make long and short trades. The strategy uses two Hull Moving Averages, one is 60 periods and…
This strategy mainly uses the crossover of two Hull Moving Averages of different timeframes to determine market trends and make long and short trades.
Strategy Logic
The strategy uses two Hull Moving Averages, one is 60 periods and the other is 175 periods. Where:
hullma is the 60-period Hull Moving Average, calculated by the wma function.
ahullma is the 175-period Hull Moving Average, calculated by the wma function.
When hullma crosses ahullma upward, a golden cross occurs, giving a long signal.
When hullma crosses ahullma downward, a death cross occurs, giving a short signal.
longCondition and shortCondition determine the long and short entry conditions respectively.
The strategy.entry function is used to execute long and short trades.
The strategy utilizes the crossover principle to capture trend changes using the crossovers between short-term and long-term moving averages, for profit.
Advantage Analysis
Hull Moving Average responds faster to price changes.
Crossover principle is simple and easy to implement.
The 60- and 175-period combination captures medium-term trends.
Customizable period parameters for different markets.
Applicable for intraday and position trading.
Risk Analysis
Crossovers have some lag in signals.
More false signals from short-term MA.
Frequent crossovers may cause losses in range-bound markets.
Wrong period settings cannot capture trend changes.
Need parameter optimization for different symbols.
Risks can be mitigated by adding filters, optimizing parameters, allowing wider stops.
Optimization Directions
Test different MA combinations to find optimal periods.
Add trend indicators for signal filtering.
Optimize stop loss strategy to reduce frequent stops.
Adjust periods for different symbols.
Add machine learning to dynamically optimize parameters.
Summary
This strategy utilizes golden cross and death cross principles to determine trends using double Hull Moving Average crossovers. It is a typical short-term dual moving average system. The pros are simple logic and easy implementation, catching fast short-term trends. The cons are high false signals and lagging issues. Improvements can be made via parameter optimization, signal filtering etc. It is a worthwhile short-term trading strategy to study. The strategy can be flexibly applied for intraday and position trading across different markets. Overall, it is suitable for short-term trading and can generate good returns if used properly.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 60 | HULL MA 1 LENGTH |
| v_input_2_close | 0 | Source: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4 |
| v_input_3 | 175 | HULL MA 2 LENGTH |
| v_input_4_close | 0 | Source: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4 |
Source Pine Script
/*backtest
start: 2023-09-10 00:00:00
end: 2023-10-10 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy(title = "Hull MA", shorttitle="Junior2", overlay = true)
//HULL MA 1
length = input(60, minval=1,title="HULL MA 1 LENGTH")
src = input(close, title="Source")
hullma = wma(2*wma(src, length/2)-wma(src, length), round(sqrt(length)))
plot(hullma, color=color.green)
//HULLMA 2
alength = input(175, minval=1,title="HULL MA 2 LENGTH")
asrc = input(close, title="Source")
ahullma = wma(2*wma(asrc, alength/2)-wma(asrc, alength), round(sqrt(alength)))
plot(ahullma, color=color.green)
c1up= crossover(hullma,ahullma)
c1down= crossunder(hullma,ahullma)
longCondition = c1up
if longCondition
strategy.entry("L", strategy.long)
shortCondition = c1down
if shortCondition
strategy.entry("S", strategy.short)
plot(close)Published by ChaoZhang on the FMZ strategy square · last modified 2023-10-11. 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.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Double-Hull-Moving-Average-Crossover-Trading-Strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- 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
- 200 EMA VWAP MFI Trend Following StrategyPine Script · Trend following · 1d
- 4 EMA Trend StrategyPine Script · Trend following · 1d
- ADX MA and EMA Long Only Trend Tracking StrategyPine Script · Trend following · 1d
- ATR Dynamic Profit Target and Stop Loss StrategyPine Script · Trend following · 1d
- ATR Dynamic Trend Following and EMA Crossover Trading StrategyPine Script · Trend following · 1d
- ATR and Moving Average Crossover Hybrid StrategyPine Script · Trend following · 1h