LSMA Strategy Templates

Strategy Overview
Section titled “Strategy Overview”These three strategies showcase different ways to use Least Squares Moving Average in Reversion:
- LSMA Trend Following with ADX Filter —
price_above_lsma/price_below_lsmaentries filtered by ADX trend strength - LSMA + RSI Pullback — Trade pullbacks in the trend direction using RSI extremes
- LSMA + Bollinger Bands Squeeze — Breakout entries confirmed by both LSMA direction and Bollinger Band breaks
Strategy 1: LSMA Trend Following with ADX Filter
Overview
Enter long when price crosses above LSMA in a trending market (ADX confirms), exit when price crosses below or trend weakens.
When This Works Best
- Trending markets with sustained moves (ADX > 25)
- Assets with clear directional behavior
- 4H to 1D timeframes
Algorithm Configuration
| Setting | Value |
|---|---|
| Type | BOTH |
| Position Size | 50% of equity (REL) |
| Order Type | MARKET |
| Timeout | COOLDOWN_ONLY, 3 bars |
Long Entry Conditions
| Group | Indicator | Signal | Threshold |
|---|---|---|---|
| Required | LSMA | price_above_lsma | — |
| Required | ADX | adx_above_threshold | 25 |
Long Exit Conditions
| Setting | Value |
|---|---|
| Required | LSMA · price_below_lsma |
| Stop Loss | 5% (REL), trailing enabled |
| Take Profit | 10% (REL) |
Short Entry Conditions
| Group | Indicator | Signal | Threshold |
|---|---|---|---|
| Required | LSMA | price_below_lsma | — |
| Required | ADX | adx_above_threshold | 25 |
Short Exit Conditions
| Setting | Value |
|---|---|
| Required | LSMA · price_above_lsma |
| Stop Loss | 5% (REL), trailing enabled |
| Take Profit | 10% (REL) |
Recommended Parameters
| Indicator | Parameter | Value | Notes |
|---|---|---|---|
| LSMA | Period | 20 bars | Trend smoothing lookback |
| ADX | Period | 14 bars | Trend strength filter |
| ADX | Threshold | 25 | Minimum trend strength |
Strategy 2: LSMA + RSI Pullback
Overview
In an established uptrend (price above LSMA), enter on RSI oversold pullbacks. In downtrends, enter shorts on RSI overbought rallies.
When This Works Best
- Trending markets with periodic pullbacks
- Assets that mean-revert after short-term extremes
- 1H to 4H timeframes
Algorithm Configuration
| Setting | Value |
|---|---|
| Type | BOTH |
| Position Size | 40% of equity (REL) |
| Order Type | MARKET |
| Timeout | REGULAR, 2 bars |
Long Entry Conditions
| Group | Indicator | Signal | Threshold |
|---|---|---|---|
| Required | LSMA | price_above_lsma | — |
| Required | RSI | rsi_below_threshold | 30 |
Long Exit Conditions
| Setting | Value |
|---|---|
| Required | RSI · rsi_above_threshold · threshold: 60 |
| Stop Loss | 4% (REL) |
| Take Profit | 8% (REL) |
Short Entry Conditions
| Group | Indicator | Signal | Threshold |
|---|---|---|---|
| Required | LSMA | price_below_lsma | — |
| Required | RSI | rsi_above_threshold | 70 |
Short Exit Conditions
| Setting | Value |
|---|---|
| Required | RSI · rsi_below_threshold · threshold: 40 |
| Stop Loss | 4% (REL) |
| Take Profit | 8% (REL) |
Recommended Parameters
| Indicator | Parameter | Value | Notes |
|---|---|---|---|
| LSMA | Period | 20 bars | Trend direction filter |
| RSI | Period | 14 bars | Momentum lookback |
| RSI | Oversold | 30 | Long entry trigger |
| RSI | Overbought | 70 | Short entry trigger |
Strategy 3: LSMA + Bollinger Bands Squeeze
Overview
Enter when price breaks above/below LSMA while Bollinger Bands confirm the breakout direction.
When This Works Best
- Breakout conditions after consolidation
- Markets transitioning from low to high volatility
- 1H to 1D timeframes
Algorithm Configuration
| Setting | Value |
|---|---|
| Type | BOTH |
| Position Size | 30% of equity (REL) |
| Order Type | MARKET |
| Timeout | COOLDOWN_ONLY, 5 bars |
Long Entry Conditions
| Group | Indicator | Signal | Threshold |
|---|---|---|---|
| Required | LSMA | price_above_lsma | — |
| Required | Bollinger Bands | price_above_upperBand | — |
Long Exit Conditions
| Setting | Value |
|---|---|
| Required | LSMA · price_below_lsma |
| Stop Loss | 5% (REL) |
| Take Profit | 12% (REL) |
Short Entry Conditions
| Group | Indicator | Signal | Threshold |
|---|---|---|---|
| Required | LSMA | price_below_lsma | — |
| Required | Bollinger Bands | price_below_lowerBand | — |
Short Exit Conditions
| Setting | Value |
|---|---|
| Required | LSMA · price_above_lsma |
| Stop Loss | 5% (REL) |
| Take Profit | 12% (REL) |
Recommended Parameters
| Indicator | Parameter | Value | Notes |
|---|---|---|---|
| LSMA | Period | 20 bars | Trend filter |
| Bollinger Bands | Period | 20 bars | Volatility lookback |
| Bollinger Bands | Multiplier | 2.0 | Band width (2 std devs) |
Backtesting Recommendations
Section titled “Backtesting Recommendations”- Test period variations: Compare 10 vs 20 vs 50 to find the best balance of responsiveness vs smoothness
- Compare with other MAs: Backtest LSMA against EMA/SMA/HMA to see which MA type works best for your asset
- Measure ADX filter impact: Test with and without the ADX > 25 filter to quantify trend filtering benefit
- Check indicator usefulness scores: After backtesting, review the algo metrics to confirm the MA is adding value