Strategy Examples
This page provides practical strategy recipes that you can build in Stratifyre using the visual rule builder. Each example describes the trading idea, the exact rules to configure, and tips for getting the most out of the strategy.
These are starting points, not finished products. Every strategy should be backtested and refined for your specific instruments, timeframes, and risk tolerance.
SMA Crossover (trend following)
Section titled “SMA Crossover (trend following)”The idea: Follow the trend by buying when a faster moving average crosses above a slower one, and selling when it crosses back below. This is one of the most widely used strategy concepts in all of trading.
Instruments: Any trending instrument – stocks, ETFs, futures, or crypto.
Timeframe: Daily (best for swing trading) or 1-hour (for shorter-term trading).
Entry rule – Go long
Section titled “Entry rule – Go long”| Field | Setting |
|---|---|
| Condition 1 LHS | SMA (Period: 20) |
| Condition 1 Operator | Crossing Up |
| Condition 1 RHS | SMA (Period: 50) |
| Action | Place Order – Buy, Market |
| Quantity | Fixed (for example, 100 shares) or expression: round(account.equity * 0.05 / price) |
| Frequency | Once per period (Daily) |
Exit rule – Close long
Section titled “Exit rule – Close long”| Field | Setting |
|---|---|
| Condition 1 LHS | SMA (Period: 20) |
| Condition 1 Operator | Crossing Down |
| Condition 1 RHS | SMA (Period: 50) |
| Action | Close Position – Flatten |
| Frequency | No limit |
Stop-loss rule
Section titled “Stop-loss rule”| Field | Setting |
|---|---|
| Condition 1 LHS | Position Return % |
| Condition 1 Operator | Less Than |
| Condition 1 RHS | -3 |
| Action | Close Position – Flatten |
| Frequency | No limit |
RSI Mean Reversion
Section titled “RSI Mean Reversion”The idea: Buy when a stock has been oversold (RSI below 30) and sell when it recovers. Mean-reversion strategies profit from the tendency of prices to bounce back after short-term extremes.
Instruments: Large-cap stocks or ETFs with a history of mean-reverting behavior (for example, SPY, QQQ).
Timeframe: Daily.
Entry rule – Buy the dip
Section titled “Entry rule – Buy the dip”| Field | Setting |
|---|---|
| Condition 1 LHS | RSI (Period: 14) |
| Condition 1 Operator | Less Than |
| Condition 1 RHS | 30 |
| Condition 2 LHS | Price |
| Condition 2 Operator | Greater Than |
| Condition 2 RHS | SMA (Period: 200) |
| Action | Place Order – Buy, Market |
| Quantity | Expression: round(account.equity * 0.05 / price) |
| Frequency | Once |
The second condition (price above the 200-day SMA) acts as a trend filter – you only buy dips in instruments that are in a longer-term uptrend.
Exit rule – Take profit
Section titled “Exit rule – Take profit”| Field | Setting |
|---|---|
| Condition 1 LHS | RSI (Period: 14) |
| Condition 1 Operator | Greater Than |
| Condition 1 RHS | 50 |
| Condition 2 LHS | Position Quantity |
| Condition 2 Operator | Greater Than |
| Condition 2 RHS | 0 |
| Action | Close Position – Flatten |
| Frequency | No limit |
Stop-loss rule
Section titled “Stop-loss rule”| Field | Setting |
|---|---|
| Condition 1 LHS | Position Return % |
| Condition 1 Operator | Less Than |
| Condition 1 RHS | -2 |
| Action | Close Position – Flatten |
| Frequency | No limit |
Bollinger Band Squeeze Breakout
Section titled “Bollinger Band Squeeze Breakout”The idea: Bollinger Bands contract when volatility drops (the “squeeze”) and expand when volatility returns. This strategy waits for a squeeze and then enters when price breaks out of the bands, betting that the volatility expansion will lead to a sustained move.
Instruments: Stocks, futures, or crypto with periodic volatility cycles.
Timeframe: Daily or 1-hour.
Setup rule – Detect the squeeze
Section titled “Setup rule – Detect the squeeze”First, create a variable to track whether a squeeze is happening:
| Field | Setting |
|---|---|
| Condition 1 LHS | Expression: (BBANDS(20).upper - BBANDS(20).lower) / BBANDS(20).middle * 100 |
| Condition 1 Operator | Less Than |
| Condition 1 RHS | 4 |
| Action | Set Variable – Name: squeezeActive, Value: 1, Scope: Local |
| Frequency | No limit |
This fires whenever band width drops below 4% of the middle band, indicating low volatility.
Entry rule – Breakout long
Section titled “Entry rule – Breakout long”| Field | Setting |
|---|---|
| Condition 1 LHS | vars.squeezeActive |
| Condition 1 Operator | Equals |
| Condition 1 RHS | 1 |
| Condition 2 LHS | Price |
| Condition 2 Operator | Greater Than |
| Condition 2 RHS | Bollinger Bands (Period: 20, StdDev: 2) – Upper Band |
| Action | Place Order – Buy, Market |
| Quantity | Expression: round(account.equity * 0.03 / price) |
| Frequency | Once |
Exit rule – Return to middle
Section titled “Exit rule – Return to middle”| Field | Setting |
|---|---|
| Condition 1 LHS | Price |
| Condition 1 Operator | Less Than |
| Condition 1 RHS | Bollinger Bands (Period: 20) – Middle Band |
| Condition 2 LHS | Position Quantity |
| Condition 2 Operator | Greater Than |
| Condition 2 RHS | 0 |
| Action | Close Position – Flatten |
| Frequency | No limit |
Stop-loss rule
Section titled “Stop-loss rule”| Field | Setting |
|---|---|
| Condition 1 LHS | Price |
| Condition 1 Operator | Less Than |
| Condition 1 RHS | Bollinger Bands (Period: 20) – Lower Band |
| Action | Close Position – Flatten |
| Frequency | No limit |
Daily Range Breakout
Section titled “Daily Range Breakout”The idea: Enter a position when today’s price breaks above yesterday’s high (long) or below yesterday’s low (short), during the first hour of the trading session. This captures the initial momentum of the day.
Instruments: Liquid stocks, futures (ES, NQ), or forex pairs.
Timeframe: 5 minutes (with daily reference data).
Entry rule – Breakout long
Section titled “Entry rule – Breakout long”| Field | Setting |
|---|---|
| Condition 1 LHS | Price |
| Condition 1 Operator | Greater Than |
| Condition 1 RHS | Expression: bars["D"].high[1] (yesterday’s high) |
| Condition 2 LHS | time.min_since_rth_open |
| Condition 2 Operator | Less Than |
| Condition 2 RHS | 60 |
| Condition 3 LHS | Volume |
| Condition 3 Operator | Greater Than |
| Condition 3 RHS | Expression: SMA(20, "volume") * 1.5 |
| Action | Place Order – Buy, Bracket (Take Profit: price * 1.01, Stop Loss: price * 0.995) |
| Quantity | Expression: round(account.equity * 0.02 / (price * 0.005)) |
| Frequency | Once per period (Daily) |
The time filter ensures you only trade breakouts in the first hour. The volume filter confirms the breakout has participation. The bracket order automatically sets a 1% take-profit and 0.5% stop-loss.
End-of-day exit
Section titled “End-of-day exit”| Field | Setting |
|---|---|
| Condition 1 LHS | time.min_since_rth_open |
| Condition 1 Operator | Greater Than |
| Condition 1 RHS | 360 |
| Condition 2 LHS | Position Quantity |
| Condition 2 Operator | Not Equals |
| Condition 2 RHS | 0 |
| Action | Close Position – Flatten |
| Frequency | Once per period (Daily) |
This closes any remaining position 6 hours after the open, keeping the strategy as a day-trading system.
ATR-Based Position Sizing and Trailing Stop
Section titled “ATR-Based Position Sizing and Trailing Stop”The idea: Use the Average True Range (ATR) to dynamically size positions and set trailing stops. This is not a standalone strategy but a risk-management framework you can add to any strategy.
Applicable to: Any entry strategy. This example uses a simple RSI entry for illustration.
Entry rule with ATR-based sizing
Section titled “Entry rule with ATR-based sizing”| Field | Setting |
|---|---|
| Condition 1 LHS | RSI (Period: 14) |
| Condition 1 Operator | Less Than |
| Condition 1 RHS | 30 |
| Action | Place Order – Buy, Market |
| Quantity | Expression: round(account.equity * 0.02 / ATR(14)) |
| Frequency | Once |
This calculates quantity so that if price moves one ATR against you, you lose 2% of equity. When ATR is high (volatile market), you trade fewer shares. When ATR is low (calm market), you trade more.
Record entry price
Section titled “Record entry price”Add a second action to the entry rule (or create a separate rule with the same conditions):
| Field | Setting |
|---|---|
| Action | Set Variable – Name: entryPrice, Value: price, Scope: Local |
Set initial trailing stop
Section titled “Set initial trailing stop”| Field | Setting |
|---|---|
| Action | Set Variable – Name: trailingStop, Value: price - ATR(14) * 1.5, Scope: Local |
Update trailing stop
Section titled “Update trailing stop”| Field | Setting |
|---|---|
| Condition 1 LHS | Position Quantity |
| Condition 1 Operator | Greater Than |
| Condition 1 RHS | 0 |
| Condition 2 LHS | Expression: price - ATR(14) * 1.5 |
| Condition 2 Operator | Greater Than |
| Condition 2 RHS | vars.trailingStop |
| Action | Set Variable – Name: trailingStop, Value: price - ATR(14) * 1.5, Scope: Local |
| Frequency | No limit |
This rule only updates the trailing stop when the new value is higher than the current one, so the stop only moves up (for long positions), never down.
Exit on trailing stop
Section titled “Exit on trailing stop”| Field | Setting |
|---|---|
| Condition 1 LHS | Price |
| Condition 1 Operator | Less Than |
| Condition 1 RHS | vars.trailingStop |
| Condition 2 LHS | Position Quantity |
| Condition 2 Operator | Greater Than |
| Condition 2 RHS | 0 |
| Action | Close Position – Flatten |
| Frequency | No limit |
Multi-Timeframe Trend + Pullback
Section titled “Multi-Timeframe Trend + Pullback”The idea: Use the daily chart to confirm a bullish trend, then use the 15-minute chart to buy pullbacks. This combines the reliability of a higher-timeframe trend with the precision of a lower-timeframe entry.
Instruments: Stocks, ETFs, or futures.
Timeframe: 15 minutes (primary), with daily references.
Entry rule – Buy the pullback
Section titled “Entry rule – Buy the pullback”| Field | Setting |
|---|---|
| Condition 1 LHS | SMA (Period: 50, Timeframe: Daily) |
| Condition 1 Operator | Greater Than |
| Condition 1 RHS | SMA (Period: 200, Timeframe: Daily) |
| Condition 2 LHS | RSI (Period: 14) |
| Condition 2 Operator | Less Than |
| Condition 2 RHS | 35 |
| Condition 3 LHS | Price |
| Condition 3 Operator | Greater Than |
| Condition 3 RHS | SMA (Period: 20) |
| Condition 4 LHS | session.is_rth |
| Condition 4 Operator | Equals |
| Condition 4 RHS | True |
| Action | Place Order – Buy, Market |
| Quantity | Expression: round(account.equity * 0.02 / ATR(14)) |
| Frequency | Once per period (Daily) |
What this does:
- Condition 1 confirms the daily trend is bullish (50-day SMA above 200-day SMA).
- Condition 2 finds a short-term pullback on the 15-minute chart (RSI oversold).
- Condition 3 confirms price is still holding above the 15-minute 20-period SMA (not in freefall).
- Condition 4 ensures you only trade during regular hours.
- Frequency is once per day, so you get at most one entry per day.
Exit rule – RSI recovery
Section titled “Exit rule – RSI recovery”| Field | Setting |
|---|---|
| Condition 1 LHS | RSI (Period: 14) |
| Condition 1 Operator | Greater Than |
| Condition 1 RHS | 65 |
| Condition 2 LHS | Position Quantity |
| Condition 2 Operator | Greater Than |
| Condition 2 RHS | 0 |
| Action | Close Position – Flatten |
| Frequency | No limit |
Stop-loss rule
Section titled “Stop-loss rule”| Field | Setting |
|---|---|
| Condition 1 LHS | Price |
| Condition 1 Operator | Less Than |
| Condition 1 RHS | Expression: bars["D"].low[1] (yesterday’s low) |
| Action | Close Position – Flatten |
| Frequency | No limit |
Using the previous day’s low as a stop-loss level provides a natural support reference from the higher timeframe.
Next steps
Section titled “Next steps”These examples cover the most common strategy styles, but Stratifyre’s rule builder supports far more complex approaches. Here are some ways to go further:
- Combine elements from multiple examples. For instance, use ATR-based position sizing (from the ATR example) with the Bollinger Band squeeze entry.
- Add more filters. Volume confirmation, time-of-day filters, day-of-week filters, and market-regime detection can all improve signal quality.
- Try short-side versions. Most of the examples above focus on long entries. Flip the conditions to create short strategies (for example, RSI above 70 instead of below 30).
- Apply to multiple instruments. Take any single-instrument strategy and apply it across a basket using multi-instrument features.
- Use the AI Strategy Builder to quickly generate variations based on natural-language descriptions.
