Custom Strategies · Help Center

Connect a Custom (Personal) Strategy to AstraBit

Create an AstraBit bot driven by your own strategy via webhooks — TradingView alerts, custom-coded signals, or anything that can send JSON to an endpoint. This guide covers bot setup, signal connection, alert payloads, and testing.

Webhook-driven TradingView compatible Secret-authenticated

Works with any language or platform that can send a webhook. Technical setup guide only; not trading advice.

Before You Begin

Indicator vs. Strategy Scripts

If you’re using TradingView, there’s a functional difference between the two script types — and it determines which endpoint you must use.

Strategy Scripts

A Strategy offers a backtest so you can see the trades and results that would’ve been taken — but by design it tends to repaint and give false signals if not coded correctly, because TradingView’s backtesting engine directly generates the signals. Strategies MUST use the Unified Signal endpoint on AstraBit.

Indicator Scripts

An Indicator should not repaint and does have the ability to create customized alerts via alertcondition() — the recommended approach for clean signals.

DCA Not Compatible

DCA bots & strategies are currently not compatible with the Unified Signal endpoint.

JSON Only, Always Valid

Alert messages must contain a JSON-formatted payload and no other text to be parsed by AstraBit. Validate your formatting with a tool like jsonlint.com.

Bot Setup

Create Your
Personal-Strategy Bot

Five steps to a bot that listens for your signals.

How Authentication Works

  • Your bot gets Signal Notification URLs (webhook endpoints)
  • Every request must include your secret phrase in the JSON body
  • Received signals appear in your bot’s Signal Log

You can revisit or regenerate your URLs anytime via Edit Bot → Step Five (Connect your bots).

1

Create a Trading Bot

  1. Create a trading bot and go to Step One (Strategy).
2

Select the Personal Strategy Tab

  1. Select the Personal Strategy tab.
  2. Enable the toggle to use the bot with a personal strategy.
Select personal strategy option step in AstraBit setup process.
Enable the Personal Strategy toggle
3

Configure the Rest of Your Bot

  1. Fill in your bot’s allocations, type, and risk management settings.
4

Save Your Signal URLs & Secret Phrase

  1. After creation, a window shows your bot’s Signal Notification URLs and your secret phrase used to authenticate all requests.
You have your webhook endpoints and secret — keep them private.
Select notification URLs step in AstraBit personal strategy setup.
Your Signal Notification URLs
Configure notification URLs step in AstraBit personal strategy setup process.
URLs and secret phrase window
5

Revisit or Regenerate Anytime

  1. Go to Edit Bot at any time to revisit and/or regenerate your Signal Notification URLs on Step Five (Connect your bots).
Select notification URL option step in AstraBit personal strategy setup.
Regenerate URLs from Edit Bot

Connecting Signals

Wire Up Your Webhooks

The URLs are webhook endpoints that expect the body message to contain JSON with your authentication secret:

{ "secret": "{YOUR_SECRET_PHRASE}" }

Alert Conditions Reset on Update

Updating an alert’s Condition resets the next dropdown to the default first item. If you update your indicator settings and want to update the alert with them, you must re-set the condition trigger afterward. Example: the default trigger is “Long Close” — when updating a BTC Long alert and BTC Short alert, change “Long Close” to “Long Open” for the Long alert and to “Short Open” for the Short alert.

TradingView Unified Signal Alert Setup

For Strategy scripts, use the Unified Signal endpoint with this payload:

{
    "code": "SOME_CODE_HERE",
    "asset": "{{ticker}}",
    "order_action": "{{strategy.order.action}}",
    "order_price": "{{strategy.order.price}}",
    "order_contracts": "{{strategy.order.contracts}}",
    "isTest": false,
    "current_position_size": "{{strategy.position_size}}",
    "market_position": "{{strategy.market_position}}",
    "market_position_size": "{{strategy.market_position_size}}",
    "prev_market_position": "{{strategy.prev_market_position}}",
    "prev_market_position_size": "{{strategy.prev_market_position_size}}"
}
Create alert step in AstraBit personal strategy setup showing alert configuration fields.
Create the alert in TradingView
Configure alert notification settings with webhook URL in AstraBit personal strategy setup.
Add the webhook URL under notifications

TradingView Custom Alert Signal Setup

Finalize alert configuration with webhook and message settings in AstraBit personal strategy setup.
Webhook and message settings
Set alert name and message for webhook signal in AstraBit personal strategy setup.
Alert name and JSON message

Example fields:

{
    "secret": "YOUR_SECRET_KEY_WILL_BE_HERE",
    "order_price": "{{close}}",
    "close": "50"
}
1secret — unique authentication of your strategy signal to AstraBit.
2order_price — current recorded execution price.
3close (optional) — specify up to 100% of the CURRENT position to close (default: close 100%).

TradingView Manual Alert

Anatomy of a Signal Alert

TradingView chart with moving averages and alert setup for webhook signal integration.
Alert setup for a long signal
TradingView chart with moving averages and alert setup for webhook signal integration (short strategy).
Alert setup for a short signal
1Condition — depends on the signals available to you; custom indicator signals via alertcondition() are recommended. See the Pine Script v5 documentation.
2Options — how often the alert fires depends on your strategy. Once Per Bar Close waits for candle-close confirmation before sending; Once Per Bar sends during the candle — useful for Take Profit or Stop Loss level signals.
3Expiration time — TradingView alerts expire unless you have a Premium account; lower tiers can manually edit and extend the expiration.
4Alert Actions — where the webhook URL goes; this sends the signal from TradingView to AstraBit.
5Alert Name — a convenient name to track your alerts and avoid crossing signals.
6Message — MUST contain a JSON-formatted payload and no other text to be parsed by AstraBit. Validate at jsonlint.com.

Unified Signals — Required Values

{
    "code": "STRATEGY_CODE_HERE",
    "asset": "{{ticker}}",
    "price": "{{close}}",
    "order_action": "{{strategy.order.action}}",
    "order_price": "{{strategy.order.price}}",
    "order_contracts": "{{strategy.order.contracts}}",
    "isTest": false,
    "current_position_size": "{{strategy.position_size}}",
    "market_position": "{{strategy.market_position}}",
    "market_position_size": "{{strategy.market_position_size}}",
    "prev_market_position": "{{strategy.prev_market_position}}",
    "prev_market_position_size": "{{strategy.prev_market_position_size}}"
}
1code — unique authentication of your strategy signal to AstraBit.
2order_price — current recorded execution price.
3order_action — current order action being taken: [Buy/Sell].
4order_contracts — current volume delta from previous position state to current position state.
5market_position — current position state: [Long/Short/Flat].
6prev_market_position — previous position trade state: [Long/Short/Flat].
7prev_market_position_size — previous position volume size.

Custom-Coded Strategies

Using your own code instead of TradingView? The same rules apply — in summary:

1Send a webhook API call to the provided endpoints.
2The message body should contain JSON data including your secret.
3The AstraBit Signal Log shows any signals that were received correctly.

Testing Signals

Verify Before You Trade

Confirm your signal setup is authenticating and being received correctly with a one-off test alert from TradingView:

1Create a test alert that uses the “Close Signal” Notification URL.
2Select the asset for the chart you’re on (normally the first option).
3Condition: Greater Than.
4Value: 0.
5Frequency: Only Once.

This sends a single test signal whenever it’s saved — or each time it’s enabled from the TradingView alerts sidebar. Then check your personal bot’s Signal Log to confirm the close signal was received by AstraBit.

TradingView alert setup screen for testing webhook signal configuration.
The test alert configuration

Once the Test Lands

You know your signals can send and authenticate. The Alert Message is correct and can be copied and pasted to all other alerts for that strategy.

Quick Recap

Three Rules for Clean Signals

JSON Only

The alert message contains a valid JSON payload and nothing else.

Secret in Every Request

Every webhook call authenticates with your secret phrase (or strategy code for Unified Signals).

!

Strategies Need Unified

TradingView Strategy scripts must use the Unified Signal endpoint — and DCA bots aren’t compatible with it.

Need help along the way?

If you experience any problems, contact support by email or submit a ticket through Discord.

Contact Support →

This site is registered on wpml.org as a development site. Switch to a production site key to remove this banner.