Tags:

This is a reversal strategy based on simple moving average crossover. It uses 1-day and 5-day simple moving averages. When the shorter SMA crosses above the longer SMA, it goes long. When the shorter SMA crosses below the longer SMA, it goes short. Itâ€™s a typical trend following strategy.

The strategy calculates the 1-day SMA (sma1) and 5-day SMA (sma5) of the closing price. When sma1 crosses over sma5, it enters a long position. When sma1 crosses below sma5, it enters a short position. After opening a long position, the stop loss is set at 5 USD below the entry price and take profit at 150 USD above. For short positions, stop loss is 5 USD above entry and take profit 150 USD below.

- Using double SMAs to determine market trend, avoiding loss trades after stop loss
- SMA parameters simple and reasonable, good backtest results
- Small stop loss to withstand certain price fluctuations
- Big profit target to make enough money

- Double SMAs are prone to whipsaws, high probability of stop loss when choppy
- Hard to catch trending moves, limited profit for long term trades
- Limited optimization space, easy to overfit
- Parameters need adjustment for different trading instruments

- Add other filters to avoid wrong signals
- Dynamic stop loss and take profit
- Optimize SMA parameters
- Combine volatility index to control position sizing

This simple double SMA strategy is easy to understand and implement for fast strategy verification. But it has limited risk tolerance and profit potential. Further optimizations are needed in parameters and filters to adapt more market conditions. As a starter quant strategy, it contains basic building blocks for iterable improvements.

/*backtest start: 2023-02-19 00:00:00 end: 2024-02-19 00:00:00 period: 2d basePeriod: 1d exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Valeria 181 Bot Strategy Mejorado 2.21", overlay=true, margin_long=100, margin_short=100) var float lastLongOrderPrice = na var float lastShortOrderPrice = na longCondition = ta.crossover(ta.sma(close, 1), ta.sma(close, 5)) if (longCondition) strategy.entry("Long Entry", strategy.long) // Enter long shortCondition = ta.crossunder(ta.sma(close, 1), ta.sma(close, 5)) if (shortCondition) strategy.entry("Short Entry", strategy.short) // Enter short if (longCondition) lastLongOrderPrice := close if (shortCondition) lastShortOrderPrice := close // Calculate stop loss and take profit based on the last executed order's price stopLossLong = lastLongOrderPrice - 5 // 10 USDT lower than the last long order price takeProfitLong = lastLongOrderPrice + 151 // 100 USDT higher than the last long order price stopLossShort = lastShortOrderPrice + 5 // 10 USDT higher than the last short order price takeProfitShort = lastShortOrderPrice - 150 // 100 USDT lower than the last short order price // Apply stop loss and take profit to long positions strategy.exit("Long Exit", from_entry="Long Entry", stop=stopLossLong, limit=takeProfitLong) // Apply stop loss and take profit to short positions strategy.exit("Short Exit", from_entry="Short Entry", stop=stopLossShort, limit=takeProfitShort)

- B-Xtrender Exponential Moving Average Crossover Strategy
- Moving Average Trend Tracking Strategy
- A Combined RSI Strategy with Moving Average and MACD
- EMA, RSI and MACD Based Multi Timeframe Trading Strategy
- Pivot Reversal Quantitative Strategy Based on Pivot Points
- Three Color Cross Trend Tracking Strategy
- Dynamic Position Building Strategy
- Dual Moving Average Chasing Strategy
- Short-term Trading Strategy Based on EMA
- Multi-factor Intelligent Trading Strategy
- Rate of Change Optimization Strategy
- Multi-Period Moving Average Channel Trend Following Strategy
- Strategy of Indicators Combination Breakthrough Trend Tracking
- Accumulation Stage Identifier and Trading Strategy
- OBV, CMO and Coppock Curve Based Trading Strategy
- CDC Action Zone Strategy
- Multi-factor Quantitative Trading Strategy
- Trend Following Strategy Based on Smoothed Deviation
- Ichimoku Cloud Oscillator Trading Strategy
- Double Bottom Reversal Mean Reversion DCA Grid Strategy