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 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 + 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 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 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")
// 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")
// 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")
// 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 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.
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")
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())
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()
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))
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
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.
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.
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.
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.
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.