The 6-stage flow
What happens at each stage
You've added KE SETS Trade (plus the supporting Curve / Trend / Zone indicators) to your TradingView chart. As price action unfolds, the Pine script on your chart evaluates the SurgeU 6-step methodology in real time — Curve direction, Trend alignment, Zone freshness, structure quality, reward-to-risk — and assigns a Surge Score (0-10) plus a grade (HIGH / MED / LOW).
When a setup grades HIGH or MED, the indicator paints a BUY or SELL signal on the chart with entry, stop-loss, and 3 take-profit levels.
Because you configured an alert on the SETS Trade indicator's alert() function, TradingView's server-side alert engine immediately notices the signal and sends an HTTP POST to your configured webhook URL. The body of that POST is a JSON payload generated by the Pine script — it contains the ticker, side (buy/sell), entry price, stop-loss price, TP levels, the Surge Score, the grade, and your subscriber-specific webhook secret for authentication.
Webhook URL: https://api.kingdomedgealgo.com/webhook — same endpoint for every KE subscriber. Your unique secret in the payload is what tells the bot which subscriber the signal belongs to.
The KingdomEdge cloud bot (a Flask app running on Railway, multi-tenant, ~24/7 uptime) receives the POST at /webhook. First thing it does: look up the secret in the payload against the subscriber database. If the secret matches one of your stored webhook secrets, the signal routes to your account specifically. If no match, the request is rejected with 401 — no further processing.
If you're a Concierge subscriber, your secret is generated by Mark and stored both in Railway env vars (so it survives restarts) and in your subscriber record.
Before placing any order, the bot runs a series of safety checks:
· Paused? If you've paused the bot (via your dashboard), the signal is logged but no order placed.
· Market hours? The bot enforces 06:30 – 13:00 PT NYSE hours by default (configurable).
· Max risk per trade? Each signal is checked against your dollar-risk-per-trade setting; if it would exceed, the signal is blocked.
· Reward-to-risk threshold? If the signal's R:R ratio falls below your minimum (default 2.0), blocked.
· Quantity override? If you've capped position size, the order qty is adjusted.
If any gate blocks the signal, the bot logs the reason but doesn't place an order. You can see blocked signals on your dashboard's Activity view.
Once gates pass, the bot calls your broker's API (Alpaca by default for Concierge tier) to place a bracket order. A bracket is a 3-part conditional order:
· Entry — market or limit buy/sell at the signal's price
· Take-profit legs — TP1 / TP2 / TP3 (or single-TP @ TP2, depending on your settings) — partial-close orders at each profit target
· Stop-loss — full-close order at the SL price, with automatic move-to-break-even after TP1 hits
All legs are submitted to your broker as an OCA (one-cancels-all) group, so when one TP or SL fires, the others automatically cancel. The broker manages execution from here — the KE bot's job is done for this trade.
The bot fans out a notification to two places simultaneously:
· Discord #signals-channel — a rich embed showing the ticker, side, grade, entry, stops, TPs. Every cohort subscriber sees this. Good for spotting patterns.
· Optional email (if you have trade_email_enabled = true in settings) — same details, in your inbox.
You don't need to do anything. The bot watches the broker for fills + lifecycle events (TP1 hit / TP2 hit / SL hit / position closed) and logs each one. Every Saturday morning at 9 AM PT, your weekly digest summarizes the week with win rate, R-multiples, and per-trade detail.
Who owns what
KingdomEdge is deliberately broker-neutral and storage-light. We own the methodology, the indicators, the bot logic, and your weekly reports. We don't custody your money, hold your trading account, or have power to withdraw funds.
| Component | Who owns / hosts it | What we (KE) can do |
|---|---|---|
| TradingView account | You — directly with TradingView | Grant access to KE invite-only indicators |
| Brokerage account | You — directly with Alpaca (or your chosen broker) | Place orders via API keys you generate (revoke anytime) |
| API keys (broker) | You generated; we store encrypted | Place orders only — cannot withdraw, transfer, or change account settings |
| Pine indicators | KingdomEdge IP — invite-only license | Grant / revoke per subscriber |
| KE bot infrastructure | KingdomEdge — Railway-hosted Flask app | Receive webhooks, route to brokers, log events |
| Subscriber data | KingdomEdge — Supabase (encrypted) | Sensitive fields Fernet-encrypted; never exposed in logs |
| Trade history | Your broker (source-of-truth) | We read fills for your weekly report; you can verify against broker statement |
Why we built it this way
Separation of concerns. KingdomEdge could have built its own brokerage. Instead, we connect to brokerages you already know and trust (Alpaca, Tradier, IBKR via partner integration). This way your money stays where you put it, you can switch brokers without leaving KE, and you can audit every trade against your broker's official records.
Indicators on TradingView, not a custom app. You already know TradingView. You're already comfortable with its charts. The 5 KE indicators add to your existing setup — they don't replace anything. Same for alerts: TradingView's alert system is battle-tested across millions of users.
The bot is just a router. The intelligence lives in the indicators (Pine scripts you can read the inputs of). The bot's job is to take indicator signals + your risk rules and submit clean bracket orders. Simple, auditable, replaceable.
Common questions about how it works
What happens if the bot crashes mid-signal?
What happens if my broker is down?
Can KingdomEdge withdraw money from my account?
What's the difference between Pine indicators and the bot?
Why a webhook? Why not just integrate directly?
Where can I see logs of what the bot did for me?
#signals-channel shows every fire in real time. For deeper inspection (e.g., why a signal was blocked), email support with the approximate signal time and we'll pull the bot's log entries.
Still have questions?
This page is a snapshot of a system that evolves. If something here is unclear or out of date, please email support — every question that surfaces here usually means 5 other subscribers were wondering the same thing.