Files
strategies/Heikin-Ashi-HighLow通道动态均线交易策略Heikin-Ashi-HighLow-Channel-Dynamic-Moving-Average-Trading-Strategy.md
T
2024-03-03 22:27:55 +08:00

7.3 KiB

Name

Heikin-Ashi-HighLow通道动态均线交易策略Heikin-Ashi-HighLow-Channel-Dynamic-Moving-Average-Trading-Strategy

Author

ChaoZhang

Strategy Description

IMG [trans]

概述

Heikin Ashi HighLow通道动态均线交易策略是一种根据Heikin Ashi蜡烛线收盘价与动态均线比较,产生交易信号的策略。该策略运用双均线形成通道,根据蜡烛线收盘价突破通道上下轨进行买入和卖出操作。

策略原理

该策略基于Heikin Ashi蜡烛线技术指标。Heikin Ashi蜡烛线能过滤市场噪音,识别趋势。该策略使用高点形成的lenh周期均线作为通道上轨,低点形成的lenl周期均线作为通道下轨。当Heikin Ashi蜡烛线收盘价上穿上轨时,产生买入信号;当Heikin Ashi蜡烛线收盘价下穿下轨时,产生卖出信号。

具体来说,策略首先计算高低点各自的简单移动平均线,以构建通道。高点移动平均线mah为通道上轨,低点移动平均线mal为通道下轨。然后比较Heikin Ashi蜡烛线的收盘价与通道上下轨,以产生交易信号。如果蜡烛线收盘价高于上轨mah,则产生买入信号longCondition;如果蜡烛线收盘价低于下轨mal,则产生卖出信号shortCondition。

策略优势

  1. 使用Heikin Ashi蜡烛线技术指标能识别趋势,滤除噪音
  2. 双均线形成通道,能清晰判断支撑阻力
  3. 动态均线适应市场变化
  4. 策略逻辑简单清晰

策略风险

  1. 双均线容易产生错误信号
  2. 未考虑突破失败的情况
  3. 移动平均线滞后性可能错过价格反转点
  4. 未设置止损,可能造成较大亏损

针对风险,可以设置止损机制,或者结合其他指标确认突破信号,避免错误信号导致不必要的亏损。

优化方向

  1. 评估不同参数对策略表现的影响,优化参数
  2. 增加指标或模型进行信号过滤和确认
  3. 增加风险控制机制,如止损、跟踪止损
  4. 进行回测评估策略表现,衡量收益和风险指标
  5. 考虑交易成本的影响,适当调整仓位规模

总结

Heikin Ashi HighLow通道动态均线交易策略整体来说逻辑清晰、简单可操作。该策略充分利用Heikin Ashi蜡烛线技术的优势识别趋势,并设置双均线动态通道判断支撑阻力。通过优化参数,增加信号过滤机制,设置止损策略等方法可以进一步完善该策略,减小交易风险。 ||

Overview

The Heikin Ashi HighLow Channel Dynamic Moving Average Trading Strategy is a strategy that generates trading signals by comparing the Heikin Ashi candlestick close price with dynamic moving averages. This strategy uses double moving averages to form a channel and enters long or exits long positions based on the candlestick close price breaking through the upper or lower rail of the channel.

Strategy Logic

This strategy utilizes the Heikin Ashi candlestick technical indicator. Heikin Ashi candlesticks can filter out market noise and identify trends. The strategy uses a lenh period moving average based on high prices to form the channel's upper rail and a lenl period moving average based on low prices to form the channel's lower rail. When the Heikin Ashi candlestick close price breaks through the upper rail, a buy signal is generated. When the Heikin Ashi candlestick close price breaks through the lower rail, a sell signal is generated.

Specifically, the strategy first calculates simple moving averages separately based on high and low prices to construct the channel. The moving average of high prices mah serves as the channel's upper rail, and the moving average of low prices mal serves as the channel's lower rail. Then it compares the Heikin Ashi candlestick close price to the upper and lower rails of the channel to generate trading signals. If the candlestick close price is higher than the upper rail mah, a long condition longCondition is generated. If the candlestick close price is lower than the lower rail mal, a short condition shortCondition is generated.

Advantages of the Strategy

  1. Using Heikin Ashi candlesticks can identify trends and filter out noise
  2. The double moving averages form a clear channel to judge support and resistance
  3. Dynamic moving averages adapt to market changes
  4. Simple and clear strategy logic

Risks of the Strategy

  1. Double moving averages can easily generate false signals
  2. Failures to break through are not considered
  3. Moving average lag may miss price reversal points
  4. No stop loss is set, which may lead to huge losses

To address the risks, stop loss mechanisms can be set, other indicators can be combined to confirm breakout signals, etc, to avoid unnecessary losses caused by false signals.

Directions for Optimization

  1. Evaluate the impact of different parameters and optimize
  2. Add indicators or models for signal filtering and confirmation
  3. Add risk control mechanisms like stop loss, trailing stop loss
  4. Backtest to evaluate performance metrics like return and risks
  5. Consider trading costs impact and adjust position sizing

Conclusion

The Heikin Ashi HighLow Channel Dynamic Moving Average Trading Strategy has clear, simple logic overall. It leverages the advantage of Heikin Ashi candlesticks to identify trends and uses double dynamic moving averages to determine support and resistance. The strategy can be further enhanced by optimizing parameters, adding signal filtering, implementing stop loss to reduce trading risks.

[/trans]

Strategy Arguments

Argument Default Description
v_input_1 5 High-Based MA
v_input_2 5 Low-Based MA
v_input_3 true Use Heikin Ashi OHCL values (on real chart)?

Source (PineScript)

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © shiner_trading
// shiner.crypto@gmail.com

//@version=4
strategy("Hi-Lo Channel Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, initial_capital=500, default_qty_value=100, currency="USD")

lenh = input(5, "High-Based MA")
lenl = input (5, "Low-Based MA")
ha = input(true, "Use Heikin Ashi OHCL values (on real chart)?")
ha_h = security(heikinashi(syminfo.tickerid), timeframe.period, high)
ha_l = security(heikinashi(syminfo.tickerid), timeframe.period, low)
ha_c = security(heikinashi(syminfo.tickerid), timeframe.period, close)
float mah = na
float mal = na
longCondition = false
shortCondition = false

/// HA is the check mark box in the configuration.
/// IF "Use Heikin Ashi OHCL values?" is true, then the strategy will use the Heikin Ashi close values
// and therefore give the same buy/sell signals regardless of what chart you are viewing.
/// That being said, if "Use Heikin Ashi OHCL values?" is FALSE, yet you are viewing Heikin Ashi candles on your chart,
// then logically you will also get the same buy/sell signals
if ha == true
    mah := sma(ha_h, lenh)
    mal := sma(ha_l, lenl)
    longCondition := ha_c > mah
    shortCondition := ha_c < mal
if ha == false
    mah := sma(high, lenh)
    mal := sma(low, lenl)
    longCondition := close > mah
    shortCondition := close < mal


plot(mah, color=color.green)
plot(mal, color=color.red)

if (longCondition)
    strategy.entry("Buy", 100)
if (shortCondition)
    strategy.close("Buy")

Detail

https://www.fmz.com/strategy/432880

Last Modified

2023-11-22 14:43:58