Skip to content

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.

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).

FieldSetting
Condition 1 LHSSMA (Period: 20)
Condition 1 OperatorCrossing Up
Condition 1 RHSSMA (Period: 50)
ActionPlace Order — Buy, Market
QuantityFixed (for example, 100 shares) or expression: round(account.equity * 0.05 / price)
FrequencyOnce per period (Daily)
FieldSetting
Condition 1 LHSSMA (Period: 20)
Condition 1 OperatorCrossing Down
Condition 1 RHSSMA (Period: 50)
ActionClose Position — Flatten
FrequencyNo limit
FieldSetting
Condition 1 LHSPosition Return %
Condition 1 OperatorLess Than
Condition 1 RHS-3
ActionClose Position — Flatten
FrequencyNo limit

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.

FieldSetting
Condition 1 LHSRSI (Period: 14)
Condition 1 OperatorLess Than
Condition 1 RHS30
Condition 2 LHSPrice
Condition 2 OperatorGreater Than
Condition 2 RHSSMA (Period: 200)
ActionPlace Order — Buy, Market
QuantityExpression: round(account.equity * 0.05 / price)
FrequencyOnce

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.

FieldSetting
Condition 1 LHSRSI (Period: 14)
Condition 1 OperatorGreater Than
Condition 1 RHS50
Condition 2 LHSPosition Quantity
Condition 2 OperatorGreater Than
Condition 2 RHS0
ActionClose Position — Flatten
FrequencyNo limit
FieldSetting
Condition 1 LHSPosition Return %
Condition 1 OperatorLess Than
Condition 1 RHS-2
ActionClose Position — Flatten
FrequencyNo limit

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.

First, create a variable to track whether a squeeze is happening:

FieldSetting
Condition 1 LHSExpression: (BBANDS(20).upper - BBANDS(20).lower) / BBANDS(20).middle * 100
Condition 1 OperatorLess Than
Condition 1 RHS4
ActionSet Variable — Name: squeezeActive, Value: 1, Scope: Local
FrequencyNo limit

This fires whenever band width drops below 4% of the middle band, indicating low volatility.

FieldSetting
Condition 1 LHSvars.squeezeActive
Condition 1 OperatorEquals
Condition 1 RHS1
Condition 2 LHSPrice
Condition 2 OperatorGreater Than
Condition 2 RHSBollinger Bands (Period: 20, StdDev: 2) — Upper Band
ActionPlace Order — Buy, Market
QuantityExpression: round(account.equity * 0.03 / price)
FrequencyOnce
FieldSetting
Condition 1 LHSPrice
Condition 1 OperatorLess Than
Condition 1 RHSBollinger Bands (Period: 20) — Middle Band
Condition 2 LHSPosition Quantity
Condition 2 OperatorGreater Than
Condition 2 RHS0
ActionClose Position — Flatten
FrequencyNo limit
FieldSetting
Condition 1 LHSPrice
Condition 1 OperatorLess Than
Condition 1 RHSBollinger Bands (Period: 20) — Lower Band
ActionClose Position — Flatten
FrequencyNo limit

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).

FieldSetting
Condition 1 LHSPrice
Condition 1 OperatorGreater Than
Condition 1 RHSExpression: bars["D"].high[1] (yesterday’s high)
Condition 2 LHStime.min_since_rth_open
Condition 2 OperatorLess Than
Condition 2 RHS60
Condition 3 LHSVolume
Condition 3 OperatorGreater Than
Condition 3 RHSExpression: SMA(20, "volume") * 1.5
ActionPlace Order — Buy, Bracket (Take Profit: order.entry_price * 1.01, Stop Loss: order.entry_price * 0.995)
QuantityExpression: round(account.equity * 0.02 / (price * 0.005))
FrequencyOnce 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.

FieldSetting
Condition 1 LHStime.min_since_rth_open
Condition 1 OperatorGreater Than
Condition 1 RHS360
Condition 2 LHSPosition Quantity
Condition 2 OperatorNot Equals
Condition 2 RHS0
ActionClose Position — Flatten
FrequencyOnce 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.

FieldSetting
Condition 1 LHSRSI (Period: 14)
Condition 1 OperatorLess Than
Condition 1 RHS30
ActionPlace Order — Buy, Market
QuantityExpression: round(account.equity * 0.02 / ATR(14))
FrequencyOnce

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.

Add a second action to the entry rule (or create a separate rule with the same conditions):

FieldSetting
ActionSet Variable — Name: entryPrice, Value: price, Scope: Local
FieldSetting
ActionSet Variable — Name: trailingStop, Value: price - ATR(14) * 1.5, Scope: Local
FieldSetting
Condition 1 LHSPosition Quantity
Condition 1 OperatorGreater Than
Condition 1 RHS0
Condition 2 LHSExpression: price - ATR(14) * 1.5
Condition 2 OperatorGreater Than
Condition 2 RHSvars.trailingStop
ActionSet Variable — Name: trailingStop, Value: price - ATR(14) * 1.5, Scope: Local
FrequencyNo 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.

FieldSetting
Condition 1 LHSPrice
Condition 1 OperatorLess Than
Condition 1 RHSvars.trailingStop
Condition 2 LHSPosition Quantity
Condition 2 OperatorGreater Than
Condition 2 RHS0
ActionClose Position — Flatten
FrequencyNo limit

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.

FieldSetting
Condition 1 LHSSMA (Period: 50, Timeframe: Daily)
Condition 1 OperatorGreater Than
Condition 1 RHSSMA (Period: 200, Timeframe: Daily)
Condition 2 LHSRSI (Period: 14)
Condition 2 OperatorLess Than
Condition 2 RHS35
Condition 3 LHSPrice
Condition 3 OperatorGreater Than
Condition 3 RHSSMA (Period: 20)
Condition 4 LHSsession.is_rth
Condition 4 OperatorEquals
Condition 4 RHSTrue
ActionPlace Order — Buy, Market
QuantityExpression: round(account.equity * 0.02 / ATR(14))
FrequencyOnce 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.
FieldSetting
Condition 1 LHSRSI (Period: 14)
Condition 1 OperatorGreater Than
Condition 1 RHS65
Condition 2 LHSPosition Quantity
Condition 2 OperatorGreater Than
Condition 2 RHS0
ActionClose Position — Flatten
FrequencyNo limit
FieldSetting
Condition 1 LHSPrice
Condition 1 OperatorLess Than
Condition 1 RHSExpression: bars["D"].low[1] (yesterday’s low)
ActionClose Position — Flatten
FrequencyNo limit

Using the previous day’s low as a stop-loss level provides a natural support reference from the higher timeframe.


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.