Custom Trading Signal Engine Development Pine Script + Python Signal Cores

The chart shows you what happened. The dashboard shows you what is happening. The signal engine is the layer that decides what to do about it — and it is the only piece of a trading stack that has to be proprietary if you want a real edge. We build custom signal engines on the same architecture as our internal Cube Bot Signaling system: a Pine Script v5 indicator suite that runs inside TradingView, paired with a Python signal core that handles persistence, multi-source data fusion, and adaptive thresholds. The result is a buy/sell signal stream tuned to your specific instrument, your session, and your risk profile — not the same alert pinging 800 other Discord subscribers.

Back to Blog

The Three Layers Of A Trading Stack — And Why The Engine Is The Only One That Has To Be Yours

Every trading workflow has three distinct layers. Most traders blur them, and that is exactly why they get stuck. The first layer is the chart — price visualization, drawing tools, indicator overlays. TradingView is the world-class commodity tool there. The second layer is the dashboard — equity curve, trade cards, order flow, hourly analytics. We covered the dashboard layer in the custom trading indicator dashboard blog. The third layer is the signal engine — the function that consumes price and produces a buy/sell decision.

The chart can be commodity. The dashboard should be custom. The signal engine has to be proprietary, because the entire premise of a profitable system is that your buy/sell logic is different from everyone else's. The moment you outsource the engine to a paid Discord signal service, a TradingView marketplace indicator, or a copy-trade subscription, you are trading the same alerts as every other subscriber — and any market with 800 traders firing identical orders at the same tick is not a market with edge.

A custom signal engine flips that equation. You own the rules. You see the rules. You can backtest the rules. You can change the rules when the market regime changes. And critically — nobody else has the rules.

2
canonical signal layers: Pine Script (chart-side) + Python (server-side)
multi-TF
simultaneous timeframe evaluation feeds the composite score
0.0–1.0
composite signal score from weighted indicator inputs
100%
code & logic ownership, full source delivered

The Two-Layer Architecture: Pine Script + Python

The reference build for our internal Cube Bot Signaling system has two cooperating layers. The Pine Script layer lives inside TradingView and consumes the highest-quality price feed in retail finance. The Python layer lives on a server and handles everything Pine Script cannot do — persistent state, external API calls, multi-source fusion, and adaptive parameter learning.

Pine Script v5 TradingView Alerts + Webhooks Python 3.11 FastAPI / Flask Pandas + NumPy Databento (live ticks) Tradovate REST + WebSocket Postgres / SQLite (history) Redis (queue + state) Discord webhooks Railway / Fly.io / Hetzner JSONL (audit log)

Pine Script gets the cleanest, least-rate-limited price data of any retail platform. It is also rigidly constrained: no external HTTP, capped indicator memory, no persistent state across script reloads. Python has none of those constraints. Routing the chart-side detection through Pine Script alerts and the orchestration through a Python core gets you the best of both worlds.

// Pine Script v5 — the chart-side detector //@version=5 indicator("Cube Signal Detector", overlay=true) len = input.int(14, "Lookback") thresh = input.float(0.7, "Composite threshold", minval=0.0, maxval=1.0) // Multi-timeframe momentum & range stack mom1m = ta.change(close, 3) / close mom5m = request.security(syminfo.tickerid, "5", ta.change(close, 3) / close) mom15m = request.security(syminfo.tickerid, "15", ta.change(close, 3) / close) range1 = (high - low) / close // Composite score (weights tuned per instrument) score = 0.35 * mom1m + 0.30 * mom5m + 0.20 * mom15m + 0.15 * range1 if score > thresh alert('{"side":"long","score":' + str.tostring(score) + '}', alert.freq_once_per_bar_close)

The Pine Script alert fires a JSON payload. TradingView posts that JSON to a webhook URL pointed at the Python server. The Python server then enriches it with off-chart data — news embargo windows, DOM imbalance, session blackouts, adaptive threshold — and decides whether the signal becomes a published SIGNAL, gets logged for backtest, or gets suppressed.

Multi-Timeframe Analysis: Why One Timeframe Is Always Wrong

The single most common signal-engine failure mode is using one timeframe. A 1-minute oscillator fires constantly in chop. A 1-hour MACD lags so badly it is signaling on the previous swing's exhaust. The fix is not "use a different timeframe" — it is "use multiple timeframes simultaneously, score them as one composite, and require alignment." That is exactly what the Cube engine does.

1m Detector

Short-window momentum and range expansion. Fires fast but generates the most noise. Used as a gating signal, never as a standalone trigger.

5m Confirmer

Same momentum and range logic on a longer window. Required to align with the 1m signal direction before composite score can clear threshold.

15m Regime Filter

Slower trend and volatility filter. Determines whether the market is in a regime where short-term signals have historically resolved as winners.

Composite Score

Weighted sum of all three timeframes plus optional add-ons (VWAP position, ORB, news filter). Score > 0.7 fires a SIGNAL; below that, log only.

The Custom Indicator Suite

Off-the-shelf indicators are calibrated for the average instrument across the average market. That is the wrong calibration for any single instrument. A signal engine worth shipping has its own indicator suite — either fresh formulas or tuned re-implementations of the classics — whose parameters live in your config and whose weights are learned from your live PnL.

The Cube reference build ships with 8 in-house indicators, each with documented inputs and outputs, each unit-tested against historical bars, and each weighted into the composite score with a configurable coefficient. Some of them are familiar (TTM Squeeze, ORB, VWAP-distance), some are bespoke (a panel-alignment counter ported from our OCR engine, a delta-momentum hybrid, a session-clock bias).

TTM Squeeze (custom-tuned)

Bollinger inside Keltner detection with our own compression-to-expansion timing rule. Fires only after squeeze-release confirms momentum direction.

Opening Range Breakout

Configurable opening-range minutes per instrument and per session. Long signals weighted up when price breaks ORB high; shorts weighted up below ORB low.

VWAP Position

Distance from session VWAP, normalized to instrument volatility. Long signals score higher above VWAP; shorts below. Mean-reversion mode inverts.

Order-Flow Hybrid

Pulls DOM imbalance + tick delta from the broker WebSocket and folds it into the composite score. Bearish flow blocks long entries entirely.

Session-Clock Bias

Time-of-day weight derived from rolling-30-day hourly win rate. Suppresses signals during historically losing hours; boosts during winning hours.

News Embargo Filter

Scheduled-event awareness (FOMC, NFP, CPI). Hard suppress signals 5 minutes before and 30 minutes after high-impact macro events.

Architectural note: Every indicator is a pure function on the input series. They write outputs to a single indicators.json file the signal core reads on each evaluation. Adding a new indicator is one file, one function, one weight in the config — no edits to the dispatcher. This separation is what lets a signal engine evolve over months without breaking earlier logic.

Adaptive Logic: Parameters That Learn From Your PnL

Static thresholds are a slow death. A composite-score threshold of 0.7 that worked beautifully in a trending market becomes a drought-maker in chop. The Cube engine ships with an adaptive layer that rewrites its own thresholds every 60 seconds based on rolling performance.

The layer reads the trade history file from disk, computes win rate over the last 30 trades and trade cadence over the last 60 minutes, and selects one of four operating modes: NORMAL (on pace, threshold 0.70), RELAXED (under cadence target but win rate fine, threshold 0.60), CAUTIOUS (win rate below 35%, threshold 0.78 plus tighter hold time), or DROUGHT (no trade in 45 min, threshold 0.55 to allow exploration).

The mode change propagates to the signal scorer immediately. The dashboard surfaces the active mode for the trader. The bot reads the mode and adjusts its execution gates accordingly. One feedback loop, three consumers, all using the same source of truth.

Signal Distribution: Discord, Webhook, REST, JSONL

A SIGNAL is useless if it does not get to the right consumer fast enough. The Cube engine fans out every signal to four destinations simultaneously: a JSONL audit log (for backtest replay and analytics), a REST endpoint (for the dashboard live feed), a Discord webhook (for human traders and signal-room subscribers), and a broker-execution webhook (for the auto-trade bot if one is wired up).

# Python signal core — fan-out on every fired signal async def publish(signal): payload = {**signal, "timestamp": time.time(), "version": "v3"} await asyncio.gather( log_to_jsonl(payload), broadcast_dashboard(payload), # /signals SSE stream post_discord_webhook(payload), notify_executor(payload), # Tradovate / NinjaTrader handler )

Discord notification is deliberately throttled and templated — one branded embed per signal with side, score, instrument, and the active adaptive mode. No emoji spam, no upsell, just structured data. The same signal feed can be exposed publicly via Cloudflare Tunnel + Cloudflare Access for invite-only signal rooms, with full transparency into the scoring logic if you want to teach the underlying system to subscribers.

Custom Signal Engine vs. Subscription Signals vs. TradingView Marketplace

If you have ever bought into a signals Discord and wondered why the alerts showed up 30 seconds late, why the win rate looked nothing like the marketing screenshots, or why every member's broker fill was visibly worse than the seller's chart-side entry — this is the structural reason. Subscription signals fundamentally cannot scale.

Capability Custom Signal Engine Discord / Telegram Signals / TV Marketplace
Latency from signal to your machine Milliseconds — webhook direct Seconds to minutes (relayed)
Logic transparency Full source — you see every rule Black box
Tunable to your instrument Yes — per-instrument weights One-size-fits-all
Adaptive to recent PnL 4-mode auto-adjust Static rules forever
Auto-execution compatible Native webhook to broker Manual order copy-paste
Crowded signal risk Zero — only you trade it Hundreds of subscribers same alert
Backtestable Full JSONL history, reproducible Vendor screenshots, unverifiable
Cost over 3 years One-time engineering build $70–$300/mo subscription
Code & data ownership 100% yours, full source Vendor's IP

Optional: AI Layer For Adaptive Weight Learning

For traders willing to commit to a long-running data set, we add an optional AI layer that trains on the JSONL signal-history file and proposes new indicator weights weekly. The training run is deliberately conservative — it suggests adjustments, it does not push them live. The trader (or a second-pass validation step) approves the weight update before the next session.

The model itself is intentionally simple: a small gradient-boosted tree over the indicator-output features against the realized trade outcomes. Not because nothing fancier works — because a small interpretable model that suggests changes is more valuable than a black-box neural net that you cannot debug when it starts losing. Trading is a domain where you have to trust the logic, and trust requires understanding.

What We Can Build For You

If you have a discretionary trading approach you can articulate in rules, or a Pine Script indicator you bought that almost works but needs to integrate with your broker, your dashboard, and your bot — a custom signal engine is a 6–10 week build. We start by transcribing your rules into the Pine Script + Python two-layer architecture, then ship adaptive logic, multi-source fusion, and signal distribution as separate milestones.

Rule Transcription

Take a discretionary playbook ("If A and B and not C, enter at break of D") and turn it into Pine Script + Python with parameter sweeps and backtests.

Multi-TF Composite

1m / 5m / 15m / 1h alignment scoring with configurable weights per instrument. Required-confluence logic before any signal fires.

Adaptive Threshold Engine

4-mode auto-adjust based on rolling win rate and trade cadence. Surfaces mode to dashboard and to the executor.

Signal Distribution

Fan-out to JSONL log, dashboard SSE stream, Discord webhook, and broker auto-execute endpoint. All in parallel.

Backtest Replay Pipeline

Replay the JSONL history through a fresh signal evaluator so you can test parameter changes against the exact ticks you traded.

Signal Room (Optional)

Public-safe signal feed via Cloudflare Access for paying subscribers. Branded embeds, no execution exposure, full audit trail.

Pair this with the custom trading dashboard for visualization, and the custom futures trading bot for execution, and you have a complete proprietary trading stack with one company supporting it.

Frequently Asked Questions

How long does it take to build a custom trading signal engine?
A focused engine — Pine Script detector + Python orchestrator + one indicator suite + one signal distribution channel — ships in 4–6 weeks. The full reference build (multi-TF composite, 8 indicators, adaptive thresholds, news embargo, fan-out distribution, AI weight-learning option) takes 8–12 weeks. We deliver in milestones so the engine is live early and gets richer over the build.
Can you integrate the signal engine with my existing dashboard or bot?
Yes. The signal engine publishes to a standard webhook + JSONL contract that any dashboard, bot, or notification channel can consume. We have integrated with Tradovate, NinjaTrader, custom Python bots, Discord bots, and SMS alert systems. If your existing tooling speaks JSON over HTTP, it can consume our signals.
Will the engine work for stocks, options, or crypto?
Yes. The architecture is asset-agnostic. We adjust the indicator suite per instrument family — futures get ORB and session-clock bias, options get IV-rank and skew, crypto gets funding-rate and exchange-flow inputs — but the composite-scoring layer and the adaptive-mode engine stay the same.
Can I sell signals from this engine to other traders?
Yes. The signal-room option exposes a public-safe feed via Cloudflare Access (invite-only, email-gated). Subscribers see signals and a stripped-down dashboard but never your account. We also help with Stripe-gated subscription tiers if you want to monetize the feed. If your engine has a real edge, this is a high-margin productized service.

Ready to own the engine, not rent the alerts?

If you have rules in your head or in a Pine Script you bought, and you are tired of competing with 800 other Discord subscribers on the same alert — let us build the proprietary engine. Call or text Jacob at (320) 360-8285, or message DM HUNT through the contact form for a same-day reply.

Free Quote