本策略通过计算EMA均线、MACD指标以及单日涨幅,综合判断市场的突破信号,实现低买高卖的动量交易策略。
当快速EMA线上穿慢速EMA线时,视为市场处于上升趋势,产生买入信号;当MACD指标的差离值上穿0轴时,也产生买入信号,实现策略的多头开仓。
另外,如果单日收盘价相比开盘价上涨超过10%,也会产生买入信号,追捧市场中的突破行情。
在开仓后,如果价格下跌幅度超过10%,则止损;如果盈利达到45%则止盈。
这是一个典型的趋势跟踪策略,能够抓住市场中力度突破后的上涨行情,盈利潜力较大。具体优势如下:
尽管该策略设计合理,但仍有一定的风险需要应对:
为降低上述风险,可以考虑优化移动止损策略,或结合其他指标如成交量进行信号过滤。
该策略还有进一步优化的空间:
通过参数调整、指标组合等方法进一步完善,可以大幅提升策略的稳定性和盈利能力。
本策略整体来说,具有简单实用、盈利潜力大的特点。通过对市场突破点的判断,能够有效抓住行情上涨趋势,回撤控制也比较合理。在后续的策略优化中,继续推动参数调整、止损止盈设计的改进,使其成为一个值得长期应用的量化交易策略。
/*backtest
start: 2023-01-11 00:00:00
end: 2024-01-17 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("Alt Coins", overlay=true)
//Simple Alt Coin Trading Strategy//
// by @ShanghaiCrypto //
////EMA////
fastLength = input(5)
slowLength = input(12)
baseLength = input(50)
price = close
emafast = ema(price, fastLength)
emaslow = ema(price, slowLength)
emabase = ema(price, baseLength)
///MACD////
MACDLength = input(9)
MACDfast = input(12)
MACDslow = input(26)
MACD = ema(close, MACDfast) - ema(close, MACDslow)
aMACD = ema(MACD, MACDLength)
delta = MACD - aMACD
////PUMP////
OneCandleIncrease = input(10, title='Gain %')
pump = OneCandleIncrease/100
////Profit Capture and Stop Loss//////
stop = input(10.0, title='Stop Loss %', type=float)/100
profit = input(45.0, title='Profit %', type=float)/100
stop_level = strategy.position_avg_price * (1 - stop)
take_level = strategy.position_avg_price * (1 + profit)
////Entries/////
if crossover(emafast, emaslow)
strategy.entry("Cross", strategy.long, comment="BUY")
if (crossover(delta, 0))
strategy.entry("MACD", strategy.long, comment="BUY")
if close > (open + open*pump)
strategy.entry("Pump", strategy.long, comment="BUY")
/////Exits/////
strategy.exit("SELL","Cross", stop=stop_level, limit=take_level)
strategy.exit("SELL","MACD", stop=stop_level, limit=take_level)
strategy.exit("SELL","Pump", stop=stop_level, limit=take_level)
////Plots////
plot(emafast, color=green)
plot(emaslow, color=red)
plot(emabase, color=yellow)
plot(take_level, color=blue)
plot(stop_level, color=orange)