Webhook Strategy Design for EMA Entries and ATR Trailing Stops
Summary
This template pairs an EMA crossover with an RSI filter to generate long and short entries, then sets initial stop and target levels from ATR. Its main teaching value is the TradingView webhook design: a structured payload carries an event identifier, firing timestamp, authentication token, strategy identifier, trade intent, sizing hint, leverage, reference price, stop and target prices, and a reduce-only flag. An ATR trail can send stop amendments as the position moves, with a minimum improvement threshold to limit alerts.
The accompanying notes explain operational safeguards for an execution backend. Deduplicate repeated events using the identifier, authenticate requests, clamp sizing and leverage on the server, and use strategy ownership tags to avoid signals from different systems interfering. The document also highlights that exit alerts may contain old timestamps because exit messages are prepared when orders are placed; freshness checks should therefore distinguish entries from exits. It provides code and a testnet bug anecdote, but no performance study. The simple signal logic is a replaceable example, and the template is not evidence of profitability or a complete execution system.
Key ideas
- EMA crossovers filtered by RSI provide the example entry signals, while ATR sets initial risk levels.
- A stable event identifier lets a backend recognize and discard duplicate webhook deliveries.
- Authentication, server-side sizing limits, and strategy ownership tags help control execution risks.
- Exit alerts may carry old timestamps, so strict freshness rules can interfere with valid protective exits.
- ATR trailing-stop improvements can be sent as reduce-only amendments, subject to a minimum-change threshold.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.