Skip to main content

Signal Parameters Overview

Welcome to the OptAlgo Signal Parameters documentation. This comprehensive guide explains how to send trading signals to OptAlgo from TradingView, custom scripts, or any external system.

What Are Signals?​

Signals are JSON-formatted messages sent to OptAlgo's API that trigger trading actions on your connected exchanges. Each signal can open positions, close positions, update stop losses/take profits, or perform other trading operations.

Quick Start​

Minimum Required Signal​

Every signal must include strategy_key and position_side. In practice, every signal also needs exchange and ticker: they must match the bot (for a single-symbol bot, exits included), or the signal is rejected. Futures entries also need leverage.

{
"strategy_key": "your_strategy_key_here",
"exchange": "BINANCE",
"ticker": "BTCUSDT.P",
"position_side": "LONG",
"action": "BUY",
"leverage": 5
}

position_side and action are case-sensitive: always use upper case.

How to Get Your Strategy Key​

  1. Log in to OptAlgo Dashboard
  2. Create or select a bot in My Bots (see My Bots)
  3. Copy the bot's strategy key
  4. Use this key in all signals for that bot. Keep it private: it does not expire and anyone who has it can send signals to the bot.

API Endpoint​

POST https://api.optalgo.com/signal-listener/signal
Content-Type: application/json

The endpoint answers 204 No Content once it has received and processed a signal, including signals that a check rejected. Only a missing or invalid strategy_key (400) and a body that is not a valid signal, for example without position_side (422), produce an error status. Check the bot's logs in the app to see what happened to a signal. See Signal Flow.

Signal Structure​

Signals consist of three main components:

1. Authentication​

  • strategy_key - Required for all signals

2. Trading Parameters​

  • Core: exchange, ticker, action, position_side
  • Pricing: entry_price, stop_loss_price, take_profit_price
  • Order types: entry_order_type, exit_order_type
  • Position sizing: cost, tradable_ratio, leverage

3. Advanced Options​

  • Trailing stops
  • Safety checks
  • Grid trading
  • Chase orders
  • Custom task execution

Common Use Cases​

Opening a Position​

{
"strategy_key": "your_key",
"exchange": "BINANCE",
"ticker": "BTCUSDT.P",
"position_side": "LONG",
"action": "BUY",
"leverage": 5,
"entry_price": 50000,
"stop_loss_price": 48000,
"take_profit_price": 55000
}

Closing a Position​

{
"strategy_key": "your_key",
"exchange": "BINANCE",
"ticker": "BTCUSDT.P",
"position_side": "CLOSE"
}

Updating Stop Loss​

{
"strategy_key": "your_key",
"exchange": "BINANCE",
"ticker": "BTCUSDT.P",
"position_side": "MOVE_STOP_LOSS",
"stop_loss_price": 49000,
"take_profit_price": 55000
}

MOVE_STOP_LOSS replaces both the stop-loss and the take-profit with the prices in the signal: always send both levels you want to keep.

Shortened examples

To keep them short, some examples in the parameter and position-type pages leave out exchange and ticker. Always include both in real signals.

Documentation Sections​

📚 Parameter Reference​

Detailed documentation for the signal parameters organized by category:

  • Authentication parameters
  • Core trading parameters
  • Pricing parameters
  • Order types
  • Margin and leverage
  • Position sizing
  • Trailing stops
  • Safety checks
  • Grid trading
  • Advanced options

🎯 Position Types​

Complete guide to all supported position_side values:

  • Opening positions (LONG, SHORT)
  • Closing positions (CLOSE, CLOSE_PARTIAL, CLOSE_ALL)
  • Position management (UPDATE_ORDER, MOVE_STOP_LOSS)
  • Chase orders
  • Advanced operations

💡 Examples​

Ready-to-use signal examples for common scenarios:

  • Basic long/short entries
  • Partial closes
  • Updating orders
  • Trailing stops
  • Safety checks
  • TradingView integration

🔄 Signal Flow​

Understand how signals are processed from reception to execution

✅ Best Practices​

Tips and patterns for reliable signal implementation

🔧 Troubleshooting​

Common errors and how to fix them

Key Concepts​

Bot Types and Auto-Configuration​

A single-symbol bot trades the symbol you chose. An auto bot is configured by its first entry or VALIDATE_ALERT, which sets:

  • Symbol and exchange
  • Account type (Futures for a .P ticker, otherwise Spot)
  • Allocation of 100 in the quote currency, unless you set one

A multi-symbol bot trades any ticker on one exchange with one key. See My Bots.

Trade IDs​

trade_id is optional. With it, exits and stop moves act on the open trade with that id. Without it, they act on the bot's open trade. Most TradingView bots hold one position at a time and do not need a trade_id. If you use one, keep it identical between the entry and its exits (do not build it from {{timenow}}), and keep it at 36 characters or fewer.

Safety Checks​

Validate position consistency between OptAlgo and external systems:

{
"strategy_key": "your_key",
"exchange": "BINANCE",
"ticker": "BTCUSDT.P",
"position_side": "VALIDATE_ALERT",
"in_position": true,
"safety_check": true
}

Symbol Format​

  • Spot: "BTCUSDT", "ETHUSDT"
  • Futures: "BTCUSDT.P", "ETHUSDT.P"

Support​

  • Dashboard: https://app.optalgo.com
  • Webhook: POST https://api.optalgo.com/signal-listener/signal
  • Help: Contact support through the dashboard

Next Steps​

  1. New to OptAlgo? Start with Parameter Reference to understand all available options
  2. Ready to implement? Check out Examples for ready-to-use signals
  3. Integrating with TradingView? See TradingView Example
  4. Having issues? Visit Troubleshooting