This strategy uses the crossover signals between the 50-period Smoothed Moving Average (SMMA) and 20-period Simple Moving Average (SMA) to determine entries and exits. It generates buy signals when the fast SMA line crosses above the slow SMMA line, and sell signals when the SMA crosses below the SMMA. At the same time, the strategy presets fixed take profit and dynamic stop loss levels to lock in profits and control risk.
Test combinations of different parameters (cycle periods, filter criteria etc) to find optimal.
Incorporate other factors like volume spikes to filter signals.
Employ parameter optimization tools to find optimum parameters.
Consider integrating other take profit methods like trailing stop or profit ratio based exits.
Calculate dynamic stop loss range based on market volatility.
This strategy has relatively simple logic, capturing trend directions via dual moving averages. Flexible usage of fixed take profit and dynamic stop loss for profit taking and risk control strikes a balance between risk and reward. Further parameter and logic optimization can adapt this strategy to a wider range of market conditions.
/*backtest start: 2023-01-26 00:00:00 end: 2024-02-01 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 strategy("50 SMMA and 20 SMA Crossover with TP and SL", overlay=true) // Define 50 SMMA smma50 = sma(close, 50) // Define 20 SMA sma20 = sma(close, 20) // Plotting the SMMA and SMA plot(smma50, color=color.blue, title="50 SMMA") plot(sma20, color=color.red, title="20 SMA") // Initialize TP and SL variables tp = 150 var float sl_price = na // Buy Signal buySignal = crossover(sma20, smma50) strategy.entry("Buy", strategy.long, when = buySignal) strategy.exit("Take Profit/Stop Loss", from_entry="Buy", profit=tp, loss=sl_price) // Sell Signal sellSignal = crossunder(sma20, smma50) strategy.entry("Sell", strategy.short, when = sellSignal) strategy.exit("Take Profit/Stop Loss", from_entry="Sell", profit=tp, loss=sl_price) // Update stop loss level on every crossover if (buySignal or sellSignal) sl_price := close[bar_index + 1] // Plot Stop Loss level plotshape(series=sl_price != na, title="Stop Loss Level", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)