The Double HULL Moving Average Strategy is a trading strategy based on the HULL Moving Average (HMA) indicator created by Alan HULL. The strategy utilizes two HMA lines, a longer-term line and a shorter-term line, to determine entry and exit points. The HMA is an improved moving average that reduces lag by applying weighted averaging to the price data. The crossover of the shorter-term and longer-term lines is used to generate buy and sell signals.
The calculation formula for the HMA is as follows:
HmaL = wma(2 * wma(close, round(PDL/2)) - wma(close, PDL), round(sqrt(PDL)))
HmaS = wma(2 * wma(close, round(PDS/2)) - wma(close, PDS), round(sqrt(PDS)))
Here, PDL represents the longer-term period, and PDS represents the shorter-term period. The strategy compares the values of the shorter-term and longer-term lines to determine the conditions for buying and selling.
The Double HULL Moving Average Strategy is a trading strategy based on the HULL Moving Average indicator. It utilizes the crossover of shorter-term and longer-term HMA lines to determine entry and exit points. The strategy offers advantages such as reduced lag, simplicity, and high customization. However, it also carries risks related to market volatility, slippage and latency, and reliance on a single indicator. In practical applications, the strategy can be adjusted and optimized based on specific circumstances, incorporating other technical indicators and risk management methods to enhance trading success and profitability.
/*backtest start: 2023-09-07 00:00:00 end: 2023-09-14 00:00:00 period: 15m basePeriod: 5m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=3 // Credit Indicator from KIVANC // author and idea: KIVANC @fr3762 on twitter // creator: Alan HULL // strategy("Double HULL Moving Average Strategy", overlay=true) PDL=input(title="LongerPeriod", defval=21, minval=1,maxval=500) PDS=input(title="ShorterPeriod", defval=8, minval=1,maxval=500) // === INPUT BACKTEST RANGE === FromYear = input(defval = 2019, title = "From Year", minval = 2009) FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12) FromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31) ToYear = input(defval = 9999, title = "To Year", minval = 2009) ToMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12) ToDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31) // === FUNCTION EXAMPLE === start = timestamp(FromYear, FromMonth, FromDay, 00, 00) // backtest start window finish = timestamp(ToYear, ToMonth, ToDay, 23, 59) // backtest finish window window() => true // create function "within window of time" HmaL=wma(2*wma(close,round(PDL/2))-wma(close,PDL),round(sqrt(PDL))) HmaS=wma(2*wma(close,round(PDS/2))-wma(close,PDS),round(sqrt(PDS))) plot(HmaL,color=red, linewidth=2) plot(HmaS,color=blue, linewidth=2) Buy = HmaS > HmaL Sell = HmaS < HmaL strategy.entry("Buy",true,when=window() and Buy) strategy.close_all(when=window() and Sell)