Tags: EMAMA

This strategy uses two exponential moving averages (EMAs) to capture changes in price trends. When the short-term EMA crosses above the long-term EMA from below, a buy signal is generated; when the short-term EMA crosses below the long-term EMA from above, a sell signal is generated. The strategy also sets daily stop-loss and take-profit limits to control single-day losses and profits.

- Calculate the short-term EMA (default period of 9) and long-term EMA (default period of 21).
- When the short-term EMA crosses above the long-term EMA, open a long position; when the short-term EMA crosses below the long-term EMA, open a short position.
- Record the account equity at the start of each trading day and calculate the difference between the current account equity and the starting equity, i.e., the daily profit and loss.
- If the daily loss exceeds the maximum allowed loss (0.25% of the initial account funds), close all positions.
- If the daily profit exceeds the maximum allowed profit (2% of the initial account funds), close all positions.

- Simple and easy to understand: The strategy logic is clear and uses only two moving averages to generate trading signals, making it easy to understand and implement.
- Trend following: By using the crossover of fast and slow EMAs, the strategy can capture changes in price trends relatively well, making it suitable for use in trending markets.
- Risk control: The daily stop-loss and take-profit limits can effectively control single-day losses and profits, preventing excessive fluctuations in the account.

- Parameter optimization: The performance of the strategy largely depends on the choice of EMA periods, and different parameter settings may lead to drastically different results. Therefore, parameter optimization and backtesting need to be performed in different market environments.
- Choppy markets: In choppy markets, prices frequently fluctuate above and below the EMAs, potentially generating many false signals and leading to frequent trades and capital erosion.
- Trend reversals: When market trends reverse, the strategy may delay entry or exit, missing the best trading opportunities.

- Introduce other technical indicators such as RSI and MACD to help judge trend strength and direction and improve signal accuracy.
- Optimize stop-loss and take-profit rules, such as using trailing stops or dynamic take-profit levels, to better protect profits and control risks.
- Dynamically adjust EMA periods based on market volatility to adapt to different market states.
- Combine fundamental analysis, such as economic data and major events, to filter and confirm trading signals.

The EMA dual moving average crossover strategy is a simple, easy-to-understand trading strategy suitable for trending markets. By using the crossover of fast and slow moving averages, it can capture changes in price trends relatively well. At the same time, the daily stop-loss and take-profit settings can effectively control risks. However, the strategy may underperform in choppy markets or during trend reversals and needs to be optimized and improved by combining other technical indicators and analysis methods.

/*backtest start: 2023-06-01 00:00:00 end: 2024-06-06 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © DD173838 //@version=5 strategy("Moving Average Strategy with Daily Limits", overlay=true) // Moving Average settings shortMaLength = input.int(9, title="Short MA Length") longMaLength = input.int(21, title="Long MA Length") // Calculate MAs shortMa = ta.ema(close, shortMaLength) longMa = ta.ema(close, longMaLength) // Plot MAs plot(shortMa, title="9 EMA", color=color.blue) plot(longMa, title="21 EMA", color=color.red) // Strategy conditions crossUp = ta.crossover(shortMa, longMa) crossDown = ta.crossunder(shortMa, longMa) // Debug plots to check cross conditions plotshape(series=crossUp, title="Cross Up", location=location.belowbar, color=color.green, style=shape.labelup, text="UP") plotshape(series=crossDown, title="Cross Down", location=location.abovebar, color=color.red, style=shape.labeldown, text="DOWN") // Entry at cross signals if (crossUp) strategy.entry("Long", strategy.long) if (crossDown) strategy.entry("Short", strategy.short) // Daily drawdown and profit limits var float startOfDayEquity = na if (na(startOfDayEquity) or ta.change(time('D')) != 0) startOfDayEquity := strategy.equity maxDailyLoss = 50000 * 0.0025 maxDailyProfit = 50000 * 0.02 currentDailyPL = strategy.equity - startOfDayEquity if (currentDailyPL <= -maxDailyLoss) strategy.close_all(comment="Max Daily Loss Reached") if (currentDailyPL >= maxDailyProfit) strategy.close_all(comment="Max Daily Profit Reached")

- EMA Momentum Trading Strategy
- MACD Crossover Strategy
- Intraday Breakout Strategy Based on 3-Minute Candle High Low Points
- MA, SMA, MA Slope, Trailing Stop Loss, Re-Entry
- Moving Average and Relative Strength Index Strategy
- Bollinger Awesome Alert R1
- Dual Moving Average RSI Momentum Strategy Based on EMA and Trendline Breakouts
- Dynamic Fibonacci Retracement Trading Strategy
- William Alligator Moving Average Trend Catcher Strategy
- TEMA Dual Moving Average Crossover Strategy

- RSI Trend Strategy
- EMA Crossover Momentum Scalping Strategy
- BB Breakout Strategy
- VWAP and RSI Dynamic Bollinger Bands Take Profit and Stop Loss Strategy
- Chande-Kroll Stop Dynamic ATR Trend Following Strategy
- This strategy generates trading signals based on the Chaikin Money Flow (CMF)
- Trend Filtered Pin Bar Reversal Strategy
- Quantitative Trading Strategy Based on Reversal Patterns at Support and Resistance Levels
- MA, SMA, MA Slope, Trailing Stop Loss, Re-Entry
- TSI Crossover Strategy
- Williams %R Dynamic TP/SL Adjustment Strategy
- RSI Dynamic Drawdown Stop-Loss Strategy
- VWAP Trading Strategy with Volume Anomaly Detection
- Supertrend and EMA Combination Strategy
- TGT Falling Buy Strategy Based on Price Decline
- Dual Trend Strategy with EMA Crossover and RSI Filter
- EMA and Parabolic SAR Combination Strategy
- MACD and RSI Multi-Filter Intraday Trading Strategy
- Price Relationship-based Arbitrage Trading Strategy Between Two Markets
- RSI-based Trading Strategy with Percentage-based Take Profit and Stop Loss