Skip to content

Latest commit

 

History

History
165 lines (110 loc) · 7.34 KB

2-20指数移动平均策略2-20-Exponential-Moving-Average-Strategy.md

File metadata and controls

165 lines (110 loc) · 7.34 KB

Name

2-20指数移动平均策略2-20-Exponential-Moving-Average-Strategy

Author

ChaoZhang

Strategy Description

[trans]

概述

该策略基于2/20指数移动平均线,当价格突破平均线时进行买入或卖出操作。它结合了移动平均线的趋势跟随功能和突破交易的趋势反转功能,旨在捕捉短期和中期趋势。

策略原理

该策略使用长度为20的指数移动平均线作为基准线。当最新K线的最高价高于基准线或最低价低于基准线时,表明价格可能发生反转,此时若上一根K线的反转点低于当前收盘价,则做多;若上一根K线的反转点高于当前收盘价,则做空。

具体来说,策略通过计算当前K线的最高价、最低价,与上一K线收盘价比较判断反转信号,并画出反转点。当反转点高于上一收盘价时做多,反之做空。如此形成的多空信号所以20日EMA作为参考基准,发挥其标识趋势方向的优势,同时利用反转点与收盘价比较判断反转时机。

优势分析

  • 结合趋势跟随和趋势反转,既可以跟随中长线趋势,也可以捕捉短线机会
  • 使用指数移动平均线作为过滤,可避免被短期市场噪音干扰
  • 反转点与收盘价比较生成信号,可以较准确地判断反转
  • 可适用于不同品种和周期,灵活性较强

风险分析

  • 股指期货具有极高的杠杆性,交易风险非常大,此策略更适合股票和外汇
  • 在震荡行情中,可能出现较多虚假突破,导致亏损
  • 参数可调整空间有限,优化空间较小
  • 需要辅助其他指标筛选品种和确定仓位管理

对策:

  • 可适当调整移动平均线周期,IDENTIFYpotter优化参数
  • 可配合其他指标如VOL确认突破有效性
  • 建议只在趋势行情中使用该策略,震荡市避免交易
  • 制定严格的资金管理策略,控制单笔亏损

优化方向

该策略可从以下几个方面进行优化:

  1. 优化移动平均线参数,调整周期或使用双移动平均线
  2. 加入成交量等指标过滤突破信号
  3. 结合止损策略,以控制风险
  4. 增加machine learning模型判断趋势和突破概率
  5. 考虑adaptive 动态调整参数
  6. 结合情感分析等指标寻找交易时机
  7. 优化仓位管理策略,如固定比例、martingale等

通过参数优化、指标组合、风险控制等方法,可以提高策略稳定性和可靠性,降低交易风险。

总结

该策略总体来说较简单直接,由于只使用单个指标,对参数和市场行情敏感度较高,优化空间有限,建议作为辅助策略使用。但其捕捉反转的思路值得学习,可用于开发更复杂的突破系统。通过结合多种技术指标进行过滤,严格遵循资金管理原则,该策略可以成为木桶效应的一部分,并为组合增强稳定性。

||

Overview

This strategy is based on the 2/20 exponential moving average line. It enters long or short positions when the price breaks through the average line. It combines the trend following function of moving averages and the trend reversal function of breakout trading, aiming to capture both short-term and medium-term trends.

Strategy Logic

The strategy uses a 20-period exponential moving average as the benchmark line. When the high or low of the latest candlestick breaks through the benchmark line, it signals a potential trend reversal. If the previous candle's reversal point is lower than the current closing price, go long. If the previous candle's reversal point is higher than the current closing price, go short.

Specifically, the strategy identifies reversal signals by calculating the current candle's high, low and comparing it with the previous candle's closing price, and plots out the reversal point. When the reversal point is higher than the previous close, it goes long. When the reversal point is lower, it goes short. The long/short signals are generated using the 20-day EMA as a reference benchmark, which identifies the trend direction. The comparison between the reversal point and closing price determines the timing of reversal.

Advantage Analysis

  • Combines trend following and trend reversal, capturing both medium-long term trends and short-term opportunities
  • The exponential moving average filters out short-term market noise
  • Comparing reversal points with closing prices can accurately identify reversals
  • Highly flexible across different products and timeframes

Risk Analysis

  • Stock index futures have extremely high leverage, very risky for this strategy. More suitable for stocks and forex
  • Susceptible to false breakouts and whipsaws in ranging markets, leading to losses
  • Limited optimization space with few adjustable parameters
  • Requires other indicators for asset selection and position sizing

Solutions:

  • Optimize moving average parameters using machine learning
  • Add other indicators like volume to confirm valid breakout
  • Only trade this strategy in clear trends, avoid ranging markets
  • Implement strict risk management rules to limit losses

Optimization Directions

This strategy can be improved in the following aspects:

  1. Optimize moving average parameters, adjust period or add double moving averages
  2. Add filters like volume to filter breakout signals
  3. Incorporate stop loss strategies to control risks
  4. Add machine learning models to predict trends and breakout probabilities
  5. Consider adaptive parameters that dynamically adjust
  6. Combine sentiment analysis to find optimal entry points
  7. Optimize position sizing strategies, e.g. fixed fractional, martingale, etc

Through parameter optimization, indicator combos, risk management etc, the strategy's stability and reliability can be enhanced, while lowering trading risks.

Summary

In summary, this simple strategy relies on a single indicator, making it sensitive to parameters and market conditions, with limited optimization space. It is best used to complement other strategies. However, the concept of capturing reversals is instructive and can be incorporated into more sophisticated breakout systems. With proper filters, risk management and robustness enhancement, this strategy can serve as a component in an overall strategy portfolio to improve stability.

[/trans]

Strategy Arguments

Argument Default Description
v_input_1 20 Length

Source (PineScript)

/*backtest
start: 2022-09-12 00:00:00
end: 2023-09-18 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 21/11/2016
// This indicator plots 2/20 exponential moving average. For the Mov 
// Avg X 2/20 Indicator, the EMA bar will be painted when the Alert criteria is met.
////////////////////////////////////////////////////////////
strategy(title="Strategy 2/20 Exponential Moving Average", overlay = true)
Length = input(20, minval=1)
xPrice = close
xXA = ema(xPrice, Length)
nHH = max(high, high[1])
nLL = min(low, low[1])
nXS = iff((nLL > xXA)or(nHH < xXA), nLL, nHH)
pos = iff(nXS > close[1] , -1, iff(nXS < close[1] , 1, nz(pos[1], 0))) 
if (pos == 1) 
    strategy.entry("Long", strategy.long)
if (pos == -1)
    strategy.entry("Short", strategy.short)	    
barcolor(pos == -1 ? red: pos == 1 ? green : blue )
//plot(nXS, color=blue, title="XAverage")

Detail

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

Last Modified

2023-09-19 17:02:20