Dynamic SMA Cross Trend Strategy
Overview
This strategy is a simple moving average (SMA) crossover strategy suitable for cryptocurrency markets. It uses fast, medium and slow SMAs to identify potential entry and exit signals. When the fast SMA crosses over the medium SMA, a buy signal is generated. When the fast SMA crosses under the medium SMA, a sell signal is generated.
Strategy Logic
Parameter Settings
The strategy allows traders to set the following key parameters:
- Price source: close price or other prices
- Consider incomplete bars or not
- SMA forecast method: shift prediction or linear regression prediction
- Fast SMA length: default 7
- Medium SMA length: default 30
- Slow SMA length: default 50
- Account funds
- Risk percentage per trade
SMA Calculation
Fast SMA, medium SMA and slow SMA are calculated based on the SMA lengths set by the user.
Trading Signals
When the fast SMA crosses over the medium SMA, a buy signal is generated. When the fast SMA crosses under the medium SMA, a sell signal is generated.
Risk and Position Sizing
The strategy calculates the nominal principal per trade based on account funds and acceptable risk percentage per trade. It then uses ATR to calculate the stop loss range and eventually determines the position sizing for each trade.
Advantage Analysis
- Uses multiple SMAs to identify trends with greater conviction
- Optional SMA forecast methods for stronger adaptability
- Simple and clear trading signals easy to implement
- Incorporates scientific risk and position management
Risk Analysis
- Lagging nature of SMAs may miss price reversal points
- Only considers technical indicators without combining fundamentals
- Does not consider impact of sudden events
Can optimize by shortening SMA periods, adding other indicators etc.
Optimization Directions
- Add other indicators to filter false signals
- Incorporate fundamental analysis
- Optimize SMA period parameters
- Optimize risk and position sizing parameters
Conclusion
This strategy integrates SMA crossover rules, risk management and position sizing for a robust trend following system suitable for crypto markets. Traders can tweak parameters like trading style, market conditions etc. to customize and optimize.
/*backtest
start: 2024-01-05 00:00:00
end: 2024-02-04 00:00:00
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Onchain Edge Trend SMA Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Configuration Parameters- 1

