Examples

Real examples. Copy them, adapt them.

Dome Script strategies, Python Lab analysis patterns, and Smart Alert setups — shown with working code. These aren't demos. They're starting points.

Dome Script

Dome Script examples — copy, adapt, validate

Here are real Dome Script examples. They cover the patterns you'll use most: entries with confirmation, range awareness, risk gates, orderflow reads, and regime filters. Paste them into the Script Editor and make them yours.

Breakout with Volume Confirmation Dome Script
Fires when price breaks a level you've marked AND volume backs it up. Stops you from chasing moves on thin air.
// Breakout + volume confirmation
study("Breakout Vol Confirm", overlay=true)

resistance = input("Resistance Level", type=price)
vol_ma     = sma(volume, 20)
vol_ratio  = volume / vol_ma

breakout = close() > resistance
    and close(1) <= resistance
    and vol_ratio >= 1.5

if breakout
    alert("BO above resistance — vol "
        + round(vol_ratio, 2) + "x avg",
        level="HIGH")
    plotmark(shape="triangle_up",
        color="green")
VWAP Mean Reversion Setup Dome Script
Flags when price has stretched far from VWAP and volume is fading — the conditions that often precede a snap back. Not a signal. A heads-up.
// VWAP deviation mean reversion
study("VWAP MR Setup", overlay=true)

vwap    = avwap(anchor="session")
vwap_sd = avwap_stdev(anchor="session")
upper   = vwap + vwap_sd * 1.5
lower   = vwap - vwap_sd * 1.5
vol_declining = volume < sma(volume, 10)

long_mr  = close() < lower and vol_declining
short_mr = close() > upper and vol_declining

if long_mr
    alert("Long MR — below -1.5sd VWAP")
if short_mr
    alert("Short MR — above +1.5sd VWAP")
Daily Range Monitor Dome Script
Tells you when most of the day's range is already used up. If you're chasing continuation trades late in the session, this tells you when to think twice.
// Daily range consumption tracker
study("ADR Monitor")

adr_period  = input("ADR Period", default=14)
warn_pct    = input("Warn at %", default=80)

daily_high  = session_high("1D")
daily_low   = session_low("1D")
adr         = sma(high("1D") - low("1D"), adr_period)
consumed    = (daily_high - daily_low) / adr * 100

if consumed >= warn_pct
    alert("ADR at " + round(consumed, 1)
        + "% — reduce continuation bias",
        level="MEDIUM")

plot(consumed, label="ADR %")
hline(warn_pct, color="amber")
Daily Loss Hard Gate Dome Script
Locks out all entry signals once your daily loss limit is hit. It overrides everything else. That's the point — this is for the days when you'd otherwise keep going.
// Risk gate: block entries if daily loss hit
study("Risk Gate")

daily_limit  = input("Daily Loss Limit $", default=500)
session_pnl  = session.pnl()   // live from Session Mgmt
gate_open    = session_pnl > (-daily_limit)

if not gate_open
    alert("RISK GATE CLOSED — daily loss limit"
        + " reached. No new entries.",
        level="CRITICAL")

// Use gate_open as a filter in any other script:
// if my_signal and gate_open then ...
export(gate_open, "risk_gate_open")
Aggressive Selling at Support Dome Script
Alerts when you see heavy negative orderflow right at a support level. Could be absorption — or could be the support failing. Either way, worth watching.
// Delta divergence at structure level
study("Delta at Support Alert", overlay=true)

support      = input("Support Level", type=price)
delta_thresh = input("Delta Threshold", default=-5000)
proximity    = input("Support Proximity %", default=0.3)

bar_delta   = orderflow.delta()
near_sup    = abs(close() - support)
    / support * 100 <= proximity
large_neg_d = bar_delta <= delta_thresh

if near_sup and large_neg_d
    alert("Large neg delta at support — "
        + str(bar_delta) + " — watch for absorption",
        level="HIGH")
    plotmark(shape="circle", color="red")
What Kind of Market Is This Right Now? Dome Script
Classifies the market as trending, ranging, volatile, or compressed — and exports that label so your other scripts can filter themselves based on conditions.
// Market regime classifier
study("Regime Classifier")

atr_period  = 14
atr         = atr(atr_period)
atr_ma      = sma(atr, 50)
adr_ratio   = atr / atr_ma
adx         = adx(14)
bb_width    = bbwidth(20, 2)
bb_width_ma = sma(bb_width, 50)

regime = if adx > 25 and adr_ratio > 1.1
    "TRENDING"
elif adr_ratio > 1.4
    "VOLATILE"
elif bb_width < bb_width_ma * 0.7
    "COMPRESSED"
else
    "RANGING"

export(regime, "market_regime")
plot_label(regime)
Python Lab

Python Lab examples for quantitative research

Research patterns that help you find out whether your edge is real. These work with Dome Terminal's data API and standard Python libraries. Run them, read the output, and let the numbers tell you what's actually happening.

Is Your Edge Getting Worse? Python
Runs a rolling Sharpe ratio on your trade returns. If it's trending down, your edge may be decaying. Good to run monthly on any live strategy.
import pandas as pd
import numpy as np
from dome import get_trades

trades = get_trades("BTC/USDT", days=180)
returns = trades["pnl_pct"]

def rolling_sharpe(r, window=30, rf=0.0):
    excess = r - rf
    return (
        excess.rolling(window).mean() /
        excess.rolling(window).std()
    ) * np.sqrt(252)

sharpe_30d = rolling_sharpe(returns, window=30)
sharpe_90d = rolling_sharpe(returns, window=90)

# Flag decay: 30d Sharpe falling below 0.5
decay_dates = sharpe_30d[sharpe_30d < 0.5].index
print(f"Decay periods: {len(decay_dates)} days")
Are You Actually Diversified? Python
Builds a rolling correlation matrix across your watchlist. Shows you which of your positions are really the same trade in disguise — before a correlated move wipes them all at once.
import pandas as pd
import seaborn as sns
from dome import get_ohlcv

symbols = ["BTC/USDT", "ETH/USDT",
           "SOL/USDT", "EUR/USD",
           "GOLD"]

closes = pd.DataFrame({
    s: get_ohlcv(s, tf="1D")["close"]
    for s in symbols
})
returns = closes.pct_change().dropna()

# 60-day rolling correlation
corr_60d = returns.tail(60).corr()

sns.heatmap(corr_60d, annot=True,
            cmap="RdYlGn_r", vmin=-1, vmax=1)

# Flag high correlations
high_corr = (corr_60d.abs() > 0.75
             & corr_60d != 1.0)
print(corr_60d[high_corr].stack())
Does This Hold on Data It Hasn't Seen? Python
Walk-forward validation template. Trains on one window, tests on the next, rolls forward. This is the test that separates real edge from curve-fitting.
from dome.lab import WalkForward, score

wf = WalkForward(
    symbol="BTC/USDT", tf="4H",
    train_bars=1000,
    test_bars=250,
    step_bars=100,
)

def strategy(data, fast=10, slow=30):
    sig = data["close"].ewm(fast).mean() > \
          data["close"].ewm(slow).mean()
    return sig.astype(int)

results = wf.run(
    strategy,
    param_grid={"fast": [8,10,14],
                "slow": [25,30,40]},
    metric=score.sharpe
)

print(results.summary())
results.plot_equity_curve()
Find the Mistake You Keep Repeating Python
Pulls your journal data and shows which emotion tags cluster with your losing trades. Tells you which setups actually have edge, and which ones just feel like they do.
from dome import get_journal
import pandas as pd

journal = get_journal(days=90)

# Expectancy by emotion tag
by_emotion = (
    journal.explode("emotion_tags")
    .groupby("emotion_tags")["pnl_r"]
    .agg(["mean", "count", "std"])
    .rename(columns={"mean": "avg_r"})
    .sort_values("avg_r")
)
print(by_emotion)

# Win rate by setup type
by_setup = journal.groupby("setup_tag").apply(
    lambda g: pd.Series({
        "win_rate": (g["pnl_r"] > 0).mean(),
        "expectancy": g["pnl_r"].mean(),
        "n_trades": len(g),
    })
)
print(by_setup.sort_values("expectancy", ascending=False))
Smart Alerts

Set up your alerts like this

These are the four alert setups worth having. Each one tells you something specific — and each one comes with a clear action when it fires. All configured in the Alert Manager, no scripting needed.

Price Level Alert

Price Level Alert

Fires when price hits a level you've marked. You step away, it touches your zone, you get the call. Add a close confirmation so you're not triggered by wicks.

// Alert Manager config (no code needed) Trigger: Price crosses 67,400 (ask) Confirm: Close above on current bar Level: HIGH Message: "67,400 resistance touched — check delta" Channel: Desktop + sound
Indicator State Alert

Market Structure Changed

Fires when Quant Brain's bias flips from Neutral to Bullish or Bearish. Useful when you're not watching the screen — get notified when the structure shifts, then decide if it matters.

// Alert Manager config Trigger: QB bias changes to Bullish/Bearish Source: Quant Brain · 4H Symbol: BTC/USDT Level: MEDIUM Message: "QB bias flip: {prev} → {new} on {symbol} {tf}" Channel: Desktop + notification
Risk Alert

You're Down Too Much — Review Now

Fires when your total unrealized portfolio loss crosses a dollar threshold. This is your early warning before the hard daily limit. When this fires: stop adding, review what's open, decide deliberately.

// Alert Manager config Trigger: Portfolio unrealized PnL falls below -400 USD Source: Session Management · All Positions Level: HIGH Message: "Portfolio drawdown: {pnl}. Review open exposure." Channel: Desktop + sound (urgent)
Session Alert

Journal Before You Forget

Fires 30 minutes before your session end. Your job when this goes off: review open positions, decide if they stay or go, and log your journal entry while the trades are still fresh in your head — not an hour later when everything feels more rational than it was.

// Alert Manager config Trigger: Time-based Fire at: 30 min before session end (config: 16:30 UTC) Level: LOW Message: "30 min to session end — review open positions and complete journal entry" Channel: Desktop

The full Script Library has more.

Dome Terminal ships with a library of Dome Script templates covering the most common patterns. Open them in the Script Editor, adapt to your setup, and deploy when they're ready.