OPEN-SOURCE SCRIPT
업데이트됨 Hyperliquid-Ready Webhook Strategy Template

Most webhook templates get you 80% of the way there — then your bot double-fills an order at 3am and you learn about the missing 20%. This template IS the missing 20%.
What this is
An open-source strategy template whose real value is the alert payload: a production-grade JSON webhook message with the fields most templates skip. The included strategy (EMA 21/55 cross + RSI filter, ATR-based SL/TP) is a simple demo — swap in your own logic. It happens to test reasonably on BTC 4H, but the point of this script is the plumbing, not the entry logic. Bring your own edge.
The payload — and why each field exists
→ id — unique per event (ticker + timeframe + action + bar time). Your backend treats this as an idempotency key: TradingView sometimes retries the same alert when your server responds slowly. Dedupe by id (one Redis SET NX) and you'll never double-fill. The action is part of the id so an entry and its exit on the same bar can never collide — a bug I caught in live testing of this exact script.
→ ts — fire-time timestamp via {{timenow}}. Reject alerts older than N seconds so a delayed or replayed webhook can't trade a stale price.
→ secret — replace with a long random token and verify it server-side (or better, HMAC the body). Anyone who finds your webhook URL can POST to it. This field is your lock.
→ reduce_only — true on exits, so a close can never accidentally flip you into a new position if state desyncs.
Also included: leverage and qty fields for your backend (cap leverage server-side too — never trust the client alone), and an on-chart payload preview table so you can eyeball your exact JSON before wiring real money.
Setup (2 minutes)
Add to chart (crypto perps: BTC/ETH/SOL, 15m–4H)
Create alert → condition: this strategy → "Order fills events" → message box: {{strategy.order.alert_message}}
Point the alert's webhook URL at your execution backend or bridge
Works with any TradingView→exchange webhook bridge. Important: alerts snapshot the script when created — if you edit the code, delete and re-create your alerts.
Who I am
I build custom TradingView→Hyperliquid execution pipelines (Pine Script v6, non-custodial agent wallets). If you want this wired to live execution or adapted to your strategy, links are in my signature.
What this is
An open-source strategy template whose real value is the alert payload: a production-grade JSON webhook message with the fields most templates skip. The included strategy (EMA 21/55 cross + RSI filter, ATR-based SL/TP) is a simple demo — swap in your own logic. It happens to test reasonably on BTC 4H, but the point of this script is the plumbing, not the entry logic. Bring your own edge.
The payload — and why each field exists
→ id — unique per event (ticker + timeframe + action + bar time). Your backend treats this as an idempotency key: TradingView sometimes retries the same alert when your server responds slowly. Dedupe by id (one Redis SET NX) and you'll never double-fill. The action is part of the id so an entry and its exit on the same bar can never collide — a bug I caught in live testing of this exact script.
→ ts — fire-time timestamp via {{timenow}}. Reject alerts older than N seconds so a delayed or replayed webhook can't trade a stale price.
→ secret — replace with a long random token and verify it server-side (or better, HMAC the body). Anyone who finds your webhook URL can POST to it. This field is your lock.
→ reduce_only — true on exits, so a close can never accidentally flip you into a new position if state desyncs.
Also included: leverage and qty fields for your backend (cap leverage server-side too — never trust the client alone), and an on-chart payload preview table so you can eyeball your exact JSON before wiring real money.
Setup (2 minutes)
Add to chart (crypto perps: BTC/ETH/SOL, 15m–4H)
Create alert → condition: this strategy → "Order fills events" → message box: {{strategy.order.alert_message}}
Point the alert's webhook URL at your execution backend or bridge
Works with any TradingView→exchange webhook bridge. Important: alerts snapshot the script when created — if you edit the code, delete and re-create your alerts.
Who I am
I build custom TradingView→Hyperliquid execution pipelines (Pine Script v6, non-custodial agent wallets). If you want this wired to live execution or adapted to your strategy, links are in my signature.
릴리즈 노트
v1.1 — Pine v6 · executor-contract upgrade- NEW: ATR trailing stop with ratchet → fires modify_sl webhook events so your backend can amend the exchange-side stop as the trade moves. Min-improvement threshold (× ATR) respects your alert budget. Backtest stop ratchets identically — what you test is what executes.
- Payload aligned to a real production executor contract: signal_id (idempotency — collision-proof across same-bar events), token (auth), strategy (ownership tag for multi-strategy backends: one strategy owns each coin), side_intent (route on intent, not action names), qty / leverage (server-side clamped), price_ref, sl_price / tp_price.
- FIXED: the on-chart payload preview table now actually renders. Two bugs: the whole JSON drew as one cell wider than the pane, and barstate.islast never fires for a strategy under a Strategy Tester deep-backtest range — so v1.0's table never displayed. Now chunked across short rows and drawn on barstate.isconfirmed. Works everywhere.
- DOCUMENTED: the stale-exit trap. TradingView composes strategy.exit alert messages at order placement, but stop fills happen intrabar — exit alerts arrive with an old ts BY DESIGN. Exempt reduce_only / modify_sl from strict freshness checks; a replayed exit is harmless by construction. This bug cost me a manual recovery on my own testnet — documented so it doesn't cost you.
- Alert setup is now: "Order fills and alert() function calls" (order fills carry entries/exits, alert() calls carry trail updates).
- Rename map in comments for wiring to any TradingView→exchange bridge.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.