Live
Auto strategy optimizer — AI improves your edge while you sleep
guidebeginner10 min

Sample Strategies & Templates

Get started quickly with built-in strategy templates. Learn from working examples you can customize.

Last updated: Jan 28, 2026

QuantIDE includes built-in strategy templates to help you get started. These aren't toy examples—they're production-ready starting points that teach real trading concepts.

Accessing Templates

In the IDE, click File → New from Template or ask Cody to generate a strategy. Templates are fully editable—use them as-is or as a foundation for your own ideas.

Mean Reversion Strategy

Mean reversion assumes prices tend to return to their average. This template buys when RSI indicates oversold conditions and sells when overbought.

pythonmean_reversion.py
from quantide import fetch_data
import vectorbt as vbt

# Fetch historical data
data = fetch_data('BTC/USD', '2023-01-01', '2024-01-01', '1d')
closes = data['Close']

# Calculate RSI (Relative Strength Index)
rsi = vbt.RSI.run(closes, window=14).rsi

# Mean reversion signals
# Buy when RSI < 30 (oversold)
# Sell when RSI > 70 (overbought)
entries = rsi < 30
exits = rsi > 70

# Backtest
pf = vbt.Portfolio.from_signals(
    close=closes,
    entries=entries,
    exits=exits,
    init_cash=10000,
    fees=0.001
)

print(pf.stats())

Momentum Strategy

Momentum strategies follow trends, betting that assets moving up will continue moving up. This template uses moving average crossovers to identify trend direction.

pythonmomentum.py
from quantide import fetch_data
import vectorbt as vbt

data = fetch_data('ETH/USD', '2023-01-01', '2024-01-01', '1d')
closes = data['Close']

# Calculate moving averages
fast_ma = closes.rolling(10).mean()  # 10-day MA
slow_ma = closes.rolling(30).mean()  # 30-day MA

# Momentum signals
# Buy when fast MA crosses above slow MA (uptrend starting)
# Sell when fast MA crosses below slow MA (downtrend starting)
entries = (fast_ma > slow_ma) & (fast_ma.shift(1) <= slow_ma.shift(1))
exits = (fast_ma < slow_ma) & (fast_ma.shift(1) >= slow_ma.shift(1))

pf = vbt.Portfolio.from_signals(
    close=closes,
    entries=entries,
    exits=exits,
    init_cash=10000,
    fees=0.001
)

print(pf.stats())

Breakout Strategy

Breakout strategies enter when price moves beyond a defined range, betting on continued movement in that direction.

pythonbreakout.py
from quantide import fetch_data
import vectorbt as vbt

data = fetch_data('AAPL', '2023-01-01', '2024-01-01', '1d')
closes = data['Close']
highs = data['High']
lows = data['Low']

# Calculate 20-day high and low channels
upper_channel = highs.rolling(20).max()
lower_channel = lows.rolling(20).min()

# Breakout signals
# Buy when price breaks above 20-day high
# Sell when price breaks below 20-day low
entries = closes > upper_channel.shift(1)
exits = closes < lower_channel.shift(1)

pf = vbt.Portfolio.from_signals(
    close=closes,
    entries=entries,
    exits=exits,
    init_cash=10000,
    fees=0.001
)

print(pf.stats())

Customizing Templates

Every parameter in these templates can be adjusted:

  • Change the symbol (BTC/USD, AAPL, etc.)
  • Adjust the date range for backtesting
  • Modify indicator parameters (RSI window, MA periods)
  • Change entry/exit thresholds
  • Add position sizing rules
  • Combine multiple indicators for confirmation

Combining Strategies

Real strategies often combine multiple signals. Here's momentum + RSI confirmation:

python
# Require both trend AND momentum confirmation
trend_bullish = fast_ma > slow_ma
not_overbought = rsi < 70

# Only enter when trend is up AND RSI isn't overbought
entries = trend_bullish & not_overbought & (rsi.shift(1) < rsi)

Tags

templatesexamplesstrategiesgetting-started
Related documentation