Skip to content

Use Case: Financial Markets - Technical Analysis ​

Overview ​

Real-time trading signal generation using classic technical indicators and SASE+ pattern detection.

Target Market ​

  • Crypto trading (BTC, ETH, altcoins)
  • Forex (currency pairs)
  • Equities (stocks, ETFs)
  • Commodities (gold, oil, etc.)

Technical Indicators Implemented ​

Trend Indicators ​

IndicatorDescriptionSignal
SMA (Simple Moving Average)Average price over N periodsTrend direction
EMA (Exponential Moving Average)Weighted average favoring recent pricesFaster trend detection
Golden CrossSMA20 crosses above SMA50Bullish reversal
Death CrossSMA20 crosses below SMA50Bearish reversal

Momentum Indicators ​

IndicatorDescriptionSignal
RSI (Relative Strength Index)Measures speed/change of price movementsOverbought (>70) / Oversold (<30)
MACDDifference between EMA12 and EMA26Trend momentum and crossovers
MACD HistogramMACD - Signal lineMomentum strength

Volatility Indicators ​

IndicatorDescriptionSignal
Bollinger BandsSMA ± 2 standard deviationsVolatility and breakouts
BandwidthBand width as % of middle bandSqueeze detection
%BPrice position within bandsOverbought/oversold within bands

Signal Types ​

Individual Signals ​

Trading signal types hierarchy

Confluence Signals ​

The most powerful signals come from indicator confluence - when multiple indicators align:

Strong Buy Conditions:

  • RSI < 35 (oversold but not extreme)
  • %B < 0.2 (price near lower Bollinger Band)
  • MACD histogram > 0 (positive momentum)
  • SMA20 > SMA50 (uptrend)

Strong Sell Conditions:

  • RSI > 65 (overbought but not extreme)
  • %B > 0.8 (price near upper Bollinger Band)
  • MACD histogram < 0 (negative momentum)
  • SMA20 < SMA50 (downtrend)

Architecture ​

Financial data flow architecture

Example Output ​

json
{
  "signal_type": "STRONG_BUY",
  "direction": "BUY",
  "symbol": "BTC/USD",
  "price": 42150.00,
  "confidence": 0.85,
  "indicators": {
    "rsi": 32.5,
    "bb_percent_b": 0.15,
    "macd_histogram": 125.3,
    "trend": "bullish"
  },
  "reason": "Multiple bullish indicators aligned: RSI oversold, price near lower BB, positive MACD histogram, uptrend",
  "timestamp": "2026-01-23T01:15:00Z"
}

Comparison with Traditional Solutions ​

AspectTraditional (Python/Java)Varpulis
Latency10-100ms< 1ms
Code complexity500+ lines~400 lines (declarative)
Multi-indicator joinManual state managementNative stream joins
Pattern detectionCustom implementationBuilt-in SASE+
ScalingManual threadingDeclarative parallelization
ObservabilityAdd-on librariesBuilt-in metrics

Risk Disclaimer ​

⚠️ This example is for educational purposes only.

  • Technical indicators are lagging and not predictive
  • Past performance does not guarantee future results
  • Always use proper risk management
  • Never invest more than you can afford to lose
  • This is not financial advice

Running the Example ​

bash
# Parse and validate
varpulis check examples/financial_markets.vpl

# Run with event file simulation
varpulis simulate -p examples/financial_markets.vpl -e market_data.evt


# On a bus, the program is a Vejas detect unit: put it under detects/

See Also ​

Varpulis - Next-generation streaming analytics engine