资源加载中... loading...

H1 Trend Bias + M15 MACD Signal + M5 Fast Volatility Gap Strategy

Author: ChaoZhang, Date: 2024-05-11 17:21:05
Tags: MACDATRMA

img

Overview

This strategy determines entry points based on trend bias on the one-hour chart, MACD crossover signals on the fifteen-minute chart, and fast volatility and gaps on the five-minute chart. By using multiple indicators across different time frames, the strategy aims to capture long-term market trends, medium-term momentum, and short-term volatility for more accurate market predictions.

Strategy Principles

The core principle of this strategy is to combine technical indicators from different time frames for a more comprehensive market analysis. Specifically:

  1. On the one-hour chart, the long-term trend bias is determined by comparing the closing price with the 50-period moving average.
  2. On the fifteen-minute chart, the medium-term bullish or bearish momentum is confirmed by the crossover signals of the MACD indicator.
  3. On the five-minute chart, potential entry points are identified by observing fast volatility (calculated using the Average True Range indicator) and price gaps.

By combining signals from these three different time frames, the strategy can better grasp the overall market trend while leveraging short-term fluctuations to optimize entry points, thereby improving trading accuracy and profit potential.

Strategy Advantages

  1. Multi-timeframe analysis: By using multiple indicators across different time frames, the strategy can analyze the market more comprehensively and capture trends and momentum signals at various levels.
  2. Trend confirmation: By comparing the closing price with the moving average on the one-hour chart, the strategy can determine the long-term trend bias, providing strong support for trading decisions.
  3. Momentum signals: Using the MACD indicator on the fifteen-minute chart allows for timely detection of changes in bullish or bearish momentum, providing further evidence for trend confirmation.
  4. Precise entry: By observing fast volatility and price gaps on the five-minute chart, the strategy can find more optimized entry points, improving trading efficiency.
  5. Risk control: The strategy uses take-profit and stop-loss settings while considering leverage factors, allowing for the pursuit of returns while controlling potential risks.

Strategy Risks

  1. Parameter optimization: The strategy’s performance may be sensitive to parameter choices, such as the settings for the MACD indicator and the moving average period, requiring thorough backtesting and optimization.
  2. Market volatility: In cases of extreme market volatility or sudden trend changes, the strategy’s effectiveness may be impacted.
  3. Leverage risk: Although the strategy considers leverage factors, excessive leverage can still lead to significant losses. Careful selection of leverage ratios and strict risk control are necessary.

Strategy Optimization Directions

  1. Dynamic parameter optimization: Consider using machine learning or optimization algorithms to dynamically adjust strategy parameters based on market conditions, adapting to different market environments.
  2. Long/short position management: Introduce more advanced position management strategies, such as dynamically adjusting position sizes based on market volatility or trend strength, to better control risk and optimize returns.
  3. Incorporate additional indicators: Consider introducing other technical indicators or fundamental factors, such as the Relative Strength Index (RSI) or market sentiment indicators, to further enhance the strategy’s robustness and adaptability.

Summary

This strategy combines trend bias on the one-hour chart, MACD momentum signals on the fifteen-minute chart, and fast volatility and price gaps on the five-minute chart to construct a multi-timeframe, multi-indicator trading system. This approach enables a more comprehensive analysis of the market, capturing trends and opportunities at different levels while controlling risk. However, the strategy’s performance may be sensitive to parameter choices and may face challenges during extreme market volatility. Future considerations include introducing dynamic parameter optimization, advanced position management, and additional indicators to further enhance the strategy’s adaptability and robustness.


/*backtest
start: 2023-05-05 00:00:00
end: 2024-05-10 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("H1 Bias + M15 MSS + M5 FVG", overlay=true, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=10)

// H1 Bias
h1_bias = request.security(syminfo.tickerid, "60", close)
h1_ma = ta.sma(h1_bias, 50)

// M15 MSS
[m15_macd_line, m15_macd_signal, _] = ta.macd(request.security(syminfo.tickerid, "15", close), 12, 26, 9)

// M5 FVG Entry
m5_volatility = ta.atr(14)

// Entry conditions for long and short positions
long_condition = m15_macd_line > m15_macd_signal and m5_volatility > 0.001
short_condition = m15_macd_line < m15_macd_signal and m5_volatility > 0.001

// Exit conditions
exit_long_condition = m15_macd_line < m15_macd_signal
exit_short_condition = m15_macd_line > m15_macd_signal

// Strategy
if (long_condition)
    strategy.entry("Long", strategy.long)
    
if (short_condition)
    strategy.entry("Short", strategy.short)

if (exit_long_condition)
    strategy.close("Long")
    
if (exit_short_condition)
    strategy.close("Short")

// Take-Profit and Stop-Loss settings considering leverage
leverage = 10.0 // Leverage as a float
tp_percentage = 15.0 // TP percentage without leverage as a float
sl_percentage = 5.0 // SL percentage without leverage as a float

tp_level = strategy.position_avg_price * (1.0 + (tp_percentage / 100.0 / leverage)) // TP considering leverage as a float
sl_level = strategy.position_avg_price * (1.0 - (sl_percentage / 100.0 / leverage)) // SL considering leverage as a float

strategy.exit("TP/SL", "Long", limit=tp_level, stop=sl_level)
strategy.exit("TP/SL", "Short", limit=tp_level, stop=sl_level)

// Plotting
plot(h1_ma, color=color.blue, linewidth=2)
plotshape(long_condition, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(short_condition, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)

template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6