TickAtlas
Beginner ~15 min

Webhook Alerts

Get notified instantly when indicator conditions are met. Send alerts to Discord, Slack, Telegram, or any custom webhook endpoint.

Alert System with Python

Poll the API at regular intervals and fire webhooks when conditions are triggered:

python
from flask import Flask, jsonify
import requests, schedule, threading, time

app = Flask(__name__)
API_KEY = "YOUR_API_KEY"
BASE = "https://tickatlas.com/v1"
WEBHOOK_URL = "https://your-app.com/webhook"  # or Discord/Slack URL

def check_alerts():
    """Check indicator conditions and fire webhooks."""
    headers = {"X-API-Key": API_KEY}
    symbols = ["EURUSD", "GBPUSD", "XAUUSD"]

    for sym in symbols:
        rsi = requests.get(f"{BASE}/indicator",
            headers=headers,
            params={"symbol": sym, "indicator": "RSI_14", "timeframe": "H1"}
        ).json()

        if rsi["value"] < 30:
            fire_alert(sym, "RSI OVERSOLD", rsi["value"])
        elif rsi["value"] > 70:
            fire_alert(sym, "RSI OVERBOUGHT", rsi["value"])

def fire_alert(symbol, condition, value):
    """Send alert via webhook."""
    payload = {
        "text": f"Alert: {symbol} - {condition} (RSI: {value:.1f})",
        "symbol": symbol,
        "condition": condition,
        "value": value
    }
    requests.post(WEBHOOK_URL, json=payload)
    print(f"Alert fired: {symbol} {condition}")

# Check every 5 minutes
schedule.every(5).minutes.do(check_alerts)

def run_scheduler():
    while True:
        schedule.run_pending()
        time.sleep(30)

threading.Thread(target=run_scheduler, daemon=True).start()
check_alerts()  # Run immediately

Popular Alert Conditions

RSI Extremes

Alert when RSI crosses above 70 (overbought) or below 30 (oversold)

MACD Crossover

Alert when MACD line crosses the signal line in either direction

Bollinger Band Touch

Alert when price touches or crosses the upper/lower band

ADX Trend Start

Alert when ADX crosses above 25 (new trend forming)

Related