Skip to content

Latest commit

 

History

History
145 lines (91 loc) · 5.55 KB

动量均线交叉买卖策略Momentum-Moving-Average-Crossover-Trading-Strategy.md

File metadata and controls

145 lines (91 loc) · 5.55 KB

Name

动量均线交叉买卖策略Momentum-Moving-Average-Crossover-Trading-Strategy

Author

ChaoZhang

Strategy Description

IMG [trans]

概述

本策略基于MACD指标进行交易信号判断。MACD指标包括MACD线、SIGNAL线和柱状图HISTO线三条线。当MACD线从下向上突破SIGNAL线而变为正,为买入信号。当MACD线从上向下跌破SIGNAL线而变为负,为卖出信号。

策略原理

  1. 计算MACD线、SIGNAL线和HISTO线。
  2. 判断MACD线和SIGNAL线的交叉情况,确定买入和卖出信号。
  3. 进一步利用34周期的EMA作为支撑阻力,只在EMA之上做多,EMA之下做空。
  4. 设置止损止盈,确保套利。

具体来说,当收盘价上穿34EMA,且MACD线上穿SIGNAL线成为正数,表明股价上涨势头强劲,这时买入。当收盘价下穿34EMA,且MACD线下穿SIGNAL线成为负数,表明股价下跌势头强劲,这时卖出。

策略优势

  1. MACD指标对股价变化的判断准确,信号明确。
  2. 结合EMA过滤,避免了错误的买入卖出信号。
  3. 设置止损止盈点,控制了每单亏损。

风险及解决

  1. MACD指标生成信号有滞后性,可能错过最佳买入卖出点位。可适当优化参数,缩短平均线周期。
  2. 单一指标容易产生错误信号。可加入其他指标进行过滤,例如KDJ指标。
  3. 没有限制开仓次数,可能产生过度交易。可设置每日或每周开仓次数上限。

优化方向

  1. 优化MACD参数,寻找最佳参数组合。
  2. 增加其他指标判断,避免错误信号。常见的组合指标有MACD+KDJ、MACD+BOLL等。
  3. 加入开仓次数限制,避免过度交易。
  4. 优化止损止盈策略,提高盈亏比。

总结

本策略利用MACD指标判断买入卖出时机,再With 34EMA过滤错误信号,可在股价开始新一轮行情时及时捕捉机会。同时设置止损止盈点控制风险,是一种较为稳定可靠的交易策略。后续可通过参数优化、增加其他指标判断等方式进一步完善该策略,提高盈利率。

||

Overview

This strategy generates trading signals based on the MACD indicator. The MACD indicator consists of three lines: the MACD line, SIGNAL line and histogram (HISTO) line. When the MACD line crosses above the SIGNAL line and turns positive, it generates a buy signal. When the MACD line crosses below the SIGNAL line and turns negative, it generates a sell signal.

Strategy Logic

  1. Calculate the MACD line, SIGNAL line and HISTO line.
  2. Identify crossover points between the MACD line and SIGNAL line to determine buy and sell signals.
  3. Use a 34-period EMA as support/resistance zone, go long only above EMA and go short only below EMA.
  4. Set stop loss and take profit to lock in profits.

Specifically, when the close price crosses above the 34-period EMA and the MACD line crosses above the SIGNAL line into positive territory, it indicates strong upside momentum, so we buy. When the close price crosses below the 34-period EMA and the MACD line crosses below the SIGNAL line into negative territory, it indicates strong downside momentum, so we sell.

Advantages

  1. MACD indicator accurately identifies turns in price action with clear signals.
  2. Combining with EMA filter avoids false buy/sell signals.
  3. Stop loss and take profit controls per trade loss.

Risks and Solutions

  1. MACD signals lag price action and may miss best entry/exit points. Can optimize parameters to shorten moving average periods.
  2. Single indicator prone to generating false signals. Can add other indicators like KDJ for filtration.
  3. No limit on number of trades, may lead to overtrading. Can set daily/weekly trade limits.

Enhancement Opportunities

  1. Optimize MACD parameters to find best parameter combination.
  2. Add other indicator judgments to avoid false signals, e.g. MACD+KDJ, MACD+BOLL combinations.
  3. Implement trade frequency limits to prevent overtrading.
  4. Optimize stop loss/take profit strategy to improve risk/reward ratio.

Conclusion

This strategy identifies trading opportunities using the MACD indicator and filters signals using a 34-period EMA. It allows timely entries when new price trends start while controlling risk via stop loss/take profit. The strategy can be further refined via parameter optimization, adding other indicators etc. to improve profitability.

[/trans]

Strategy Arguments

Argument Default Description
v_input_1 true Check here for tendies

Source (PineScript)

/*backtest
start: 2024-01-19 00:00:00
end: 2024-02-18 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © melihtuna

//@version=2
strategy("Jim's MACD", overlay=true)

Tendies = input(true, title="Check here for tendies")

// === MACD Setup ===
[macdLine, signalLine, histLine] = macd(close, 12, 26, 9)

//EMA
ma = ema(close, 5)
plot(ema(close,5))


//Entry
if (close > ma and cross(macdLine,signalLine) and histLine> 0.4 and signalLine > 0 or histLine > 0 and signalLine > 0 )
    strategy.entry("BUY", strategy.long)
if(close < ma and cross(macdLine,signalLine) and histLine < -0.4 and signalLine < 0 or close < ma and histLine < 0 and signalLine < 0 )
    strategy.entry("SELL", strategy.short)
    
//Exit 
strategy.close("BUY", when = histLine < 0  )
strategy.close("SELL", when = histLine > 0  )

Detail

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

Last Modified

2024-02-19 14:53:50