Price Alert & Notification Strategies
Absolute Price Target Alert (Tick Mode - Recommended for Alerts)
Tags: alert, price_target, notification, absolute_price, target_price, tick
Functions: emit, entry, price
Description: Alerts when price reaches a user-specified target. The price variable is a real-time tick price, reacting faster than candle close.
Timeframe: tick (recommended for price alerts)
Code:
ticker = context['ticker']
# User specifies exact target price
# Example: "Alert me if BTC is at or below 95000 dollars" -> target_price = 95000
target_price = 95000 # This value comes from user's request
# Alert when tick price reaches target (faster than candle-based)
# 'price' is the real-time tick price in tick mode
alert_cond = price < target_price
emit(alert_cond, entry(ticker, 'LONG', Weight(1.0), when=NoPosition()))
Absolute Price Target Alert (Candle Mode)
Tags: alert, price_target, notification, absolute_price, target_price, candle
Functions: emit, entry
Description: Alerts when the candle close price reaches the target. Slower than tick mode but more stable.
Code:
ticker = context['ticker']
# User specifies exact target price
# Example: "Alert me if BTC is at or below 95000 dollars" -> target_price = 95000
target_price = 95000 # This value comes from user's request
# Alert when candle close reaches target
alert_cond = close < target_price
emit(alert_cond, entry(ticker, 'LONG', Weight(1.0)))
Percentage Drop Alert (Target Price from Main Agent)
Tags: alert, percentage_drop, target_price, percent_change
Functions: emit, entry
Description: Alerts when price drops N% from the current price. The main agent pre-calculates target_price (e.g. current 100000, 5% drop -> target_price = 95000). Compares against absolute price, not bar-to-bar.
Code:
ticker = context['ticker']
# target_price is ALREADY CALCULATED by the main agent
# Example: current_price=100000, 5% drop → target_price=95000
# DO NOT use reference_price variable! Use target_price directly.
target_price = 95000 # This exact value comes from the main agent (pre-calculated)
# Alert when price drops below target
alert_cond = close < target_price
emit(alert_cond, entry(ticker, 'LONG', Weight(1.0)))
Percentage Rise Alert (Target Price from Main Agent)
Tags: alert, percentage_rise, target_price, percent_change
Functions: emit, entry
Description: Alerts when price rises N% from the current price. The main agent pre-calculates and provides target_price.
Code:
ticker = context['ticker']
# target_price is ALREADY CALCULATED by the main agent
# Example: current_price=100000, 10% rise → target_price=110000
target_price = 110000 # This exact value comes from the main agent (pre-calculated)
alert_cond = close > target_price
emit(alert_cond, entry(ticker, 'LONG', Weight(1.0)))
RSI Threshold Alert
Tags: alert, rsi, threshold, indicator, oversold, overbought
Functions: rsi, emit, entry
Description: Alerts when RSI reaches a specified threshold.
Code:
ticker = context['ticker']
rsi_val = rsi(close, 14)
# Alert when RSI drops below threshold
threshold = 30 # oversold level
alert_cond = rsi_val < threshold
emit(alert_cond, entry(ticker, 'LONG', Weight(1.0)))
Indicator Crossing Zero Alert
Tags: alert, crossing, zero_cross, threshold, indicator
Functions: ema, emit, entry
Description: Alerts when the 12-period EMA minus the 26-period EMA crosses above zero.
Code:
ticker = context['ticker']
# The fast-minus-slow EMA spread can cross zero while prices remain positive.
indicator_value = ema(close, 12) - ema(close, 26)
# Cross above threshold (was below, now above)
threshold = 0
cross_up = (indicator_value > threshold) & (indicator_value.shift(1) <= threshold)
emit(cross_up, entry(ticker, 'LONG', Weight(1.0)))
Cross-Venue Premium Alert
Tags: alert, premium, arbitrage, cross_exchange, perpetual
Functions: get_data, emit, entry
Description: Triggers when the Hyperliquid BTC perpetual premium over Binance Futures crosses above a specified value.
Code:
# Get BTC perpetual data from two supported venues
binance = get_data('BINANCEFUTURES:BTC/USDT:USDT')
hyperliquid = get_data('HYPERLIQUID:BTC/USDC:USDC')
# Calculate the Hyperliquid premium percentage
venue_premium = (hyperliquid.close / binance.close - 1) * 100
# Alert when premium crosses above threshold
threshold = 2 # 2%
cross_above = (venue_premium > threshold) & (venue_premium.shift(1) <= threshold)
emit(cross_above, entry('BINANCEFUTURES:BTC/USDT:USDT', 'LONG', Weight(1.0)))
Funding Rate Alert
Tags: alert, funding_rate, perpetual, futures
Functions: get_data, emit, entry
Description: Alerts when the perpetual contract's observed funding rate is negative. The data provider supplies the latest confirmed funding observation for each candle.
Contract: market_type=PERPETUAL, mode=isolated, timeframe=1h, universe=["BINANCEFUTURESUSD:BTC/USDT:USDT"]. Requires the contract's funding data.
Code:
ticker = 'BINANCEFUTURESUSD:BTC/USDT:USDT'
perp = get_data(ticker)
# Alert when funding rate goes negative
alert_cond = perp.funding_rate < 0
emit(alert_cond, entry(ticker, 'LONG', Weight(1.0)))
MA Cross Alert (Golden/Death Cross)
Tags: alert, ma, crossover, golden_cross, death_cross, trend
Functions: sma, emit, entry
Description: Alerts when a moving average golden cross or death cross occurs.
Code:
ticker = context['ticker']
fast_ma = sma(close, 20)
slow_ma = sma(close, 50)
# Golden cross: fast MA crosses above slow MA
golden_cross = (fast_ma > slow_ma) & (fast_ma.shift(1) <= slow_ma.shift(1))
emit(golden_cross, entry(ticker, 'LONG', Weight(1.0)))
Support/Resistance Break Alert (Tick Mode - Instant)
Tags: alert, support, resistance, breakout, level, tick
Functions: emit, entry, price
Description: Instantly alerts when support/resistance is broken. Uses the price variable for real-time tick price checks.
Timeframe: tick
Code:
ticker = context['ticker']
# Support/Resistance level from user
resistance_level = 100000 # User specified level
# Instant alert when tick price breaks resistance
# Use 'price' for real-time tick price
break_resistance = price > resistance_level
emit(break_resistance, entry(ticker, 'LONG', Weight(1.0), when=NoPosition()))
Support/Resistance Break Alert (Candle Mode)
Tags: alert, support, resistance, breakout, level, candle
Functions: emit, entry
Description: Alerts when support/resistance is broken based on candle close price.
Code:
ticker = context['ticker']
# Support/Resistance level from user
support_level = 90000 # User specified level
# Alert when price breaks below support
break_support = (close < support_level) & (close.shift(1) >= support_level)
emit(break_support, entry(ticker, 'LONG', Weight(1.0)))
Bollinger Band Touch Alert
Tags: alert, bbands, bollinger, band_touch, volatility
Functions: bollinger_bands, emit, entry
Description: Alerts when price touches the upper or lower Bollinger Band.
Code:
ticker = context['ticker']
upper, middle, lower = bollinger_bands(close, 20, 2)
# Alert when price touches lower band
touch_lower = close <= lower
emit(touch_lower, entry(ticker, 'LONG', Weight(1.0)))
Volume Spike Alert
Tags: alert, volume, spike, unusual_volume, volume_surge
Functions: ts_mean, emit, entry
Description: Alerts when volume surges N times above the average.
Code:
ticker = context['ticker']
vol_avg = ts_mean(volume, 20)
# Alert when volume is 3x average
multiplier = 3
volume_spike = volume > vol_avg * multiplier
emit(volume_spike, entry(ticker, 'LONG', Weight(1.0)))
ATR Volatility Alert
Tags: alert, atr, volatility, volatility_spike
Functions: atr, ts_mean, emit, entry
Description: Alerts when ATR-based volatility spikes significantly above its average.
Code:
ticker = context['ticker']
atr_val = atr(high, low, close, 14)
atr_avg = ts_mean(atr_val, 50)
# Alert when volatility spikes
volatility_spike = atr_val > atr_avg * 1.5
emit(volatility_spike, entry(ticker, 'LONG', Weight(1.0)))
MACD Cross Alert
Tags: alert, macd, crossover, momentum, signal_line
Functions: macd, emit, entry
Description: Alerts when the MACD line crosses the signal line.
Code:
ticker = context['ticker']
macd_line, signal_line, histogram = macd(close, 12, 26, 9)
# MACD crosses above signal line (bullish)
macd_cross_up = (macd_line > signal_line) & (macd_line.shift(1) <= signal_line.shift(1))
emit(macd_cross_up, entry(ticker, 'LONG', Weight(1.0)))
Multi-Condition Alert (Candle Mode)
Tags: alert, multi_condition, combined, compound
Functions: rsi, bollinger_bands, emit, entry
Description: Alerts when multiple conditions are simultaneously satisfied (e.g. RSI oversold AND Bollinger lower band touch).
Code:
ticker = context['ticker']
rsi_val = rsi(close, 14)
upper, middle, lower = bollinger_bands(close, 20, 2)
# Combined condition
oversold = rsi_val < 30
at_lower_band = close <= lower
# Alert when both conditions met
alert_cond = oversold & at_lower_band
emit(alert_cond, entry(ticker, 'LONG', Weight(1.0)))
Tick Price + Indicator Combo Alert (Tick Mode)
Tags: alert, tick, indicator, combo, hybrid
Functions: rsi, sma, emit, entry, price, get_data
Description: Combines real-time tick price conditions with candle-based indicators. Triggers when price breaks target AND indicator conditions are met. IMPORTANT: Always explicitly specify candle timeframe when using indicators in tick mode.
Timeframe: tick
Code:
ticker = context['ticker']
# RECOMMENDED: Explicitly specify candle timeframe for indicators
data = get_data(ticker, "1m") # 1-minute candles for indicator calculation
rsi_val = rsi(data.close, 14)
ma_20 = sma(data.close, 20)
# Target price breakout
target_price = 100000
# Tick price breaks target AND RSI is not overbought
# 'price' = real-time tick, rsi_val[-1] = latest 1m candle's RSI
entry_cond = price > target_price and rsi_val[-1] < 70
emit(entry_cond, entry(ticker, 'LONG', Weight(1.0), when=NoPosition()))
# Exit when tick price falls below MA20
exit_cond = price < ma_20[-1]
emit(exit_cond, exit_position(ticker, when=HasPosition()))
Scalping Entry Alert (Tick Mode)
Tags: alert, scalping, tick, quick_entry, momentum
Functions: sma, atr, emit, entry, price, get_data
Description: Tick mode scalping alert. Enters when price crosses above fast MA in an uptrend with ATR-based stop loss. IMPORTANT: Always explicitly specify candle timeframe when using indicators in tick mode.
Timeframe: tick
Code:
ticker = context['ticker']
# RECOMMENDED: Explicitly specify candle timeframe for indicators
data = get_data(ticker, "1m") # 1-minute candles
ma_fast = sma(data.close, 5)
ma_slow = sma(data.close, 20)
atr_val = atr(data.high, data.low, data.close, 14)
# Trend filter from candles
uptrend = ma_fast[-1] > ma_slow[-1]
# Entry when tick price crosses above fast MA in uptrend
# ATR-based stop distance
entry_cond = uptrend and price > ma_fast[-1]
stop_price = ma_fast[-1] - atr_val[-1]
emit(
entry_cond,
entry(ticker, 'LONG', Weight(0.5), stop_loss=AbsolutePrice(stop_price), when=NoPosition())
)