How to automate a trading strategy
To automate a trading strategy, keep its rules in a tool that can send a webhook, have that tool send an Autoview command each time a rule fires, and point it at your Autoview webhook URL. Autoview reads the command and places the order on your connected exchange. Add d=1 for a dry run first, then remove it to go live.
The tool can be TradingView, TrendSpider, a workflow tool, your own script or an AI agent. Autoview reads the same command from all of them, so the steps below are the same whatever sends it.
What are the parts of an automated strategy?
An automated strategy has four parts, and each one has a single job:
- The rules. When to enter, when to exit and how much to trade. You write these.
- The signal source. The tool that watches the market, checks the rules and fires when one is met.
- The webhook. When a rule fires, the signal source sends a short text command to your Autoview webhook URL.
- The exchange connection. Autoview reads the command and places the order through the API key you connected.
Autoview is the last two parts. The first two are yours.
Where does the strategy logic live?
In the signal source. Autoview does not decide when your strategy enters or exits. Each webhook carries a finished instruction, such as "buy 0.001 BTCUSDT at market", and Autoview carries it out.
This split has a practical upside. You can change the rules, or move them to a different tool, without touching your Autoview setup. As long as the new tool sends the same command to the same webhook URL, the orders come out the same.
What does the alert text look like?
The body of the webhook is a plain line of text with the order in it. A dry-run entry for a spot pair looks like this:
s=BTCUSDT b=buy q=0.001 t=market d=1And the matching exit:
s=BTCUSDT b=sell q=0.001 t=market d=1Here is what each part does:
| Part | What it does |
|---|---|
s=BTCUSDT | The symbol, written the way your exchange writes it. Copy it from your exchange's own market page, because every exchange spells symbols differently. |
b=buy | The side. On a spot pair, b=buy and b=sell. To open a margin or futures position, use b=long or b=short. |
q=0.001 | The size, sent as it is in your exchange's own unit: the coin on a spot pair, contracts on a futures broker. Always set q. If you leave it off, Autoview uses 100% of your balance. |
t=market | Fill now at the market price. Without it, the order type is limit. |
d=1 | Dry run. Autoview reads the command and logs what it would have done, but sends nothing to your exchange. |
The command reference covers every parameter, including stop loss and take profit, and the alert syntax page lists them all.
If your tool can only send JSON, wrap the same line in an object with an alert field and set the Content-Type to application/json:
{"alert": "s=BTCUSDT b=buy q=0.001 t=market d=1"}A form-encoded body is refused. The web platform guide lists the three body shapes Autoview accepts.
Which tools can send the signal?
Any system that can make an HTTP POST to your webhook URL, with the command in the body, can drive your orders. Some common ones:
- TradingView. A Pine Script strategy can attach its own command to every order it fills. The automate a TradingView strategy guide walks through it step by step. For an indicator alert, see automate TradingView alerts.
- TrendSpider. Paste your webhook URL into a Strategy Bot's entry or exit webhook URL, and put the command in the bot's Webhook Body. The web platform guide has the exact settings and a link to TrendSpider's webhook help.
- Your own script. If your rules run in Python, a bot or a server job, POST the command yourself. Set the Content-Type header explicitly, because many HTTP libraries default to form encoding. The custom webhooks page has curl examples.
- A workflow tool. Zapier and n8n can both send the command when a step in your workflow fires.
- An AI agent. An agent that POSTs to your webhook follows the same rules as a script. See AI agents.
- A strategy you bought. If it can fire an alert, it can be automated. Read can I automate a purchased trading strategy? before you pay.
A minimal Python sender looks like this. Replace the URL with your own webhook URL:
import requests
requests.post(
"YOUR_AUTOVIEW_WEBHOOK_URL",
data="s=BTCUSDT b=buy q=0.001 t=market d=1",
headers={"Content-Type": "text/plain"},
)
Step by step: from rules to live orders
- Connect an exchange. In your Autoview dashboard, open the API Keys page and click Set Up Exchange. Give the API key trading and read access, and leave withdrawals off. The exchange guides show the steps for each exchange. For a first run, a demo or testnet account keeps real money out of it.
- Create a webhook and link it. In Autoview, create a webhook, then create a link that pairs it with your exchange connection. The link decides which account the commands arriving at that webhook trade on. Copy the webhook URL. The web platform guide walks through both screens.
- Write one command per action. Decide what your strategy sends for each event: an entry, an exit, maybe a close. Put
d=1on every one of them for now. - Wire the commands into your signal source. Paste the webhook URL into your tool's webhook setting and put the matching command in the body it sends for each event.
- Dry-run it. Let the strategy fire, or trigger it by hand, and check the result as described in the next section.
- Go live small. Remove
d=1from every command, keep the size near your exchange's minimum, and watch the first live order arrive. Raiseqonly after that round trip looks right.
Keep the webhook URL private. Anyone who has it can send your account a command. For an extra layer, set a key on the webhook and add ?key=yourkey to the URL. The webhook key guide covers it.
Live orders need an active Autoview subscription. Without one, Autoview runs every command as a dry run.
How do I test it before going live?
Keep d=1 on every command and let the strategy send a real signal. Then check two places:
- Your signal source. Its own log or history should show the request went out with the full command in the body.
- Your Autoview log. It shows the command that arrived and the order Autoview would have placed. Check the symbol, the side and the size.
Do it for an entry and for an exit. A clean dry run proves the command reaches Autoview and reads correctly. It does not prove your exchange accepts the order. Only a small live order proves that. Testing and debugging covers the rest.
Why did my signal not place an order?
Start with the Autoview log. The usual causes:
- Nothing in the log. The request never reached your webhook. Check the URL in your signal source matches your Autoview webhook URL exactly.
- The webhook key was rejected. A request with a missing or wrong key is refused, and the rejection shows in the log. Check the
?key=value. - No API key linked. A webhook with no link has nowhere to send the order. Create the link from Step 2.
- The tool sent a form or the wrong JSON. A form body is refused, and a JSON object without a text
alertfield is rejected. Send plain text or{"alert": "..."}. - It ran as a dry run. A command still carries
d=1, or the account has no active subscription. - The exchange rejected the order. The log carries the exchange's own response. The usual cause is a symbol in the wrong format or a size below the exchange's minimum.
FAQ
How do I automate my trading strategy?
Write the strategy's rules in a tool that can send a webhook, make it send an Autoview command each time a rule fires, and point it at your Autoview webhook URL. Autoview reads the command and places the order on the exchange account linked to that webhook. Add d=1 to the command for a dry run first, then remove it to go live.
Does Autoview decide when to trade?
No. The rules live in the system that sends the alert. Autoview reads the command in each alert and places that order. It does not generate signals or change your strategy.
Do I need TradingView to automate a strategy?
No. TradingView is one alert source. Any system that can make an HTTP POST to your webhook URL with the command in the body works the same way, including TrendSpider, a workflow tool like Zapier or n8n, or your own script.
How do I test an automated strategy before it trades real money?
Add d=1 to every command. Autoview reads it and logs the order it would have placed, but sends nothing to your exchange. Check the symbol, side and size in your Autoview log, then remove d=1 and place one small live order.
A note on what Autoview is. Autoview is an execution tool, not a trading or investment advisor. It places the orders your own strategy tells it to. It does not generate signals, recommend trades, or make any claim about results. Trading carries risk of loss, and you are responsible for the strategy you automate. See our disclosures.