Skip to main content

Strategy Patterns

Common strategy patterns you can build in BrighterTrading. Each one describes the indicators, conditions, and blocks you need. Use these as starting points — adapt them to your own analysis.

warning

These are educational examples, not trading advice. Always backtest and paper trade before running any strategy live. Past performance does not predict future results.

Setup / Initialisation

The idea. Run some logic once when the strategy first starts — set initial values, record the starting price, or configure thresholds — then skip it on every subsequent cycle.

Setup:

  1. Use execute_if with is_first_run as the condition
  2. Inside, use set_variable to store any initial values you need (e.g. starting price, threshold levels) and set_leverage if you're trading margin or futures
  3. The body runs once, on the very first tick, and is skipped every tick after

Example use cases:

  • Record the price at strategy start to calculate percentage moves later
  • Set a "max_trades" variable to limit how many trades the strategy can make
  • Store the starting balance to calculate returns
  • Set the trading mode and leverage once instead of every tick

Blocks used: execute_if, is_first_run, set_variable, set_leverage, current_price


RSI Oversold Buy

The idea. RSI below 30 suggests the asset is "oversold" — it's dropped fast and may bounce. Buy when RSI dips low, set a stop loss to limit downside, and take profit when the bounce plays out.

Setup:

  1. Add an RSI indicator (period 14)
  2. In the strategy builder, use a comparison block: RSI value < 30
  3. Attach an Open Position (Long) block inside the condition, with:
    • stop_loss at 2% below entry
    • take_profit at 5% above entry

Blocks used: indicator_rsi, comparison, open_position, stop_loss, take_profit


Moving Average Crossover

The idea. When a fast moving average crosses above a slow one, it may signal an uptrend starting. When it crosses below, the trend may be reversing.

Setup:

  1. Add two SMA indicators: one with period 20 (fast), one with period 50 (slow)
  2. Use set_flag to track whether you're currently in a position
  3. Condition to buy: Fast SMA > Slow SMA AND flag "in_position" is false
  4. Condition to sell: Fast SMA < Slow SMA AND flag "in_position" is true
  5. Use Open Position (Long) to enter, Close Position (All) to exit, and set the flag accordingly

Blocks used: indicator_sma (x2), comparison, logical_and, flag_is_set, set_flag, open_position, close_position


Bollinger Band Bounce

The idea. When price touches the lower Bollinger Band, it's far from the average and may revert. Buy near the lower band, sell near the upper band.

Setup:

  1. Add a Bollinger Bands indicator
  2. Condition to buy: Current price is at or below the Lower Band value
  3. Condition to sell: Current price is at or above the Upper Band value
  4. Use Open Position (Long) to enter and Close Position (All) to exit

Blocks used: indicator_bolbands, comparison, current_price, open_position, close_position


Dollar-Cost Averaging with Margin

The idea. Enter a margin position and add to it on a schedule, spreading your entry price over time. Monitor liquidation distance for safety.

Setup:

  1. Use Set Mode / Leverage with Mode = Margin and your chosen leverage (e.g. 3x) in an initialisation block
  2. Use Open Position (Long) to enter with initial collateral
  3. Use schedule_action (Repeat) to run every N hours/minutes
  4. Inside the scheduled action, use Add Collateral to top up the position
  5. Use Liquidation Buffer with a comparison block — if buffer drops below 20%, use Close Position (All) to exit

Blocks used: set_leverage, open_position, schedule_action, add_position_collateral, get_liquidation_buffer, comparison, close_position


Risk Management Template

The idea. A reusable safety layer you can add to any strategy. Limits drawdown, detects stop loss triggers, notifies you of important events, and tracks state with flags.

Setup:

  1. max_drawdown — Set to your tolerance (e.g. 10%). Action: Pause.
  2. get_sys_flag — Check if a stop loss or liquidation was triggered
  3. If triggered, use notify_user to send yourself an alert
  4. Use set_flag / flag_is_set to track state (e.g. "stop_hit", "paused_by_drawdown")
  5. Use reset_sys_flag after handling the trigger

Blocks used: max_drawdown, get_sys_flag, notify_user, set_flag, flag_is_set, reset_sys_flag

tip

Combine this template with any of the patterns above. Put the risk management blocks at the top of your strategy so they're checked on every cycle before the trading logic runs.


Margin Long with Safety Net

The idea. Open a leveraged long position when conditions look favourable, but monitor your liquidation distance and auto-close if it gets dangerous. Margin trading amplifies both gains and losses — this pattern keeps you safe.

Setup:

  1. Use Set Mode / Leverage with Mode = Margin and leverage (e.g. 3x) in an initialisation block — runs once during setup
  2. Use execute_if to check your entry condition (e.g. RSI oversold) AND Has Position is FALSE
  3. Inside, use Open Position (Long) with your collateral amount, and attach stop_loss / take_profit options inside it
  4. In a separate execute_if, check Liquidation Buffer — if it drops below 20%, use Close Position (All)
  5. If you need to adjust SL/TP mid-trade (for example after adding collateral), use Update Stop Loss and Update Take Profit

Blocks used: set_leverage, execute_if, comparison, has_position, open_position, get_liquidation_buffer, close_position, set_position_stop_loss, set_position_take_profit

warning

Margin trading can result in losses exceeding your collateral. Always set a stop loss and monitor your liquidation buffer. Start with low leverage (2-3x) until you're comfortable.


Futures with Funding Rate Awareness

The idea. Perpetual futures charge periodic funding rates — longs pay shorts (or vice versa) depending on market sentiment. This pattern checks the funding rate before entering a position to avoid paying excessive fees.

Setup:

  1. Use Set Mode / Leverage with Mode = Futures and your leverage in an initialisation block
  2. Before opening a position, check get_futures_funding_rate:
    • If you're going Long, a very positive funding rate means you'll be paying — consider waiting
    • If you're going Short, a very negative funding rate means you'll be paying
  3. Combine the funding rate check with your entry condition using logical_and
  4. Use Open Position when conditions align (with SIDE = Long or Short)
  5. Monitor with Liquidation Buffer and Position Unrealized PnL

Blocks used: set_leverage, get_futures_funding_rate, comparison, logical_and, open_position, get_liquidation_buffer, get_position_pnl, close_position


Multi-Timeframe Confirmation

The idea. Check a condition on a higher timeframe before acting on a lower timeframe signal. For example, only buy on the 5-minute chart if the 1-hour trend is also bullish. This reduces false signals.

Setup:

  1. Set up indicators on both timeframes (e.g. an EMA on 5m and an EMA on 1h)
  2. Use a source block to define the higher timeframe data source
  3. Use last_candle_value with the source to read the higher timeframe candle
  4. Combine the higher timeframe condition with your regular condition using logical_and
  5. Only enter a trade when both timeframes agree

Blocks used: source, last_candle_value, comparison, logical_and, execute_if, open_position

tip

Multi-timeframe strategies tend to have fewer but higher-quality signals. They're particularly effective when your higher timeframe confirms the overall trend direction.