This strategy combines EMA lines, MACD indicator and single-day gain to identify market breakthrough signals and implement a momentum trading strategy to buy low and sell high.
When the fast EMA line crosses over the slow EMA line, it is considered that the market is in an upward trend and a buy signal is generated. When the difference of MACD indicator crosses over the 0 axis, a buy signal is also generated to open long positions.
In addition, if the close price of a single day rises more than 10% compared to the open price, a buy signal will also be generated to chase the breaking market trend.
After opening positions, if the price falls more than 10%, stop loss will be triggered. If the profit reaches 45%, take profit will be triggered.
This is a typical trend following strategy that can capture the uptrend after a strong momentum breakthrough, with great profit potential. The main advantages are:
Although reasonably designed, some risks still exist:
To reduce the above risks, we can consider optimizing the moving stop loss strategy or adding other indicators like volume to filter signals.
There is still room for further optimization:
Through parameter tuning, indicator combination and other methods, the stability and profitability of this strategy can be greatly improved.
In general, this strategy is simple, practical and with great profit potential. By judging market breakthrough points, it can effectively capture uptrends, and the drawdown control is also reasonable. In future optimization, continuingly improving parameter adjustment and stop loss/take profit design can make it a worthwhile long-term quantitative trading strategy.
/*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)