Docs

Trading Guide

Automating Infinity Algo Alerts via 3Commas

Connect Infinity Algo signals directly to 3Commas for automated trading execution.


Three Integration Methods

Automatic Position Flipping

What it does:

  • Switches Long ↔ Short automatically
  • One bot handles both directions
  • Closes opposite position before opening new

Best for:

  • Trending markets
  • Active trading
  • Maximum efficiency
  • Less alert management
Direction: Reversal (both)
Pairs: Single or Multi-pair (up to 200)
Alerts: 2 total
- Buy Signal → enter_long
- Sell Signal → enter_short

For simplicity, we recommend one pair per bot for reversal workflows.

Exit Without Disabling Bot

What it does:

  • Closes position cleanly
  • Bot stays active for next signal
  • No manual re-enabling needed

Best for:

  • Continuous trading
  • Quick re-entry
  • Automated workflow
  • Active strategies
Direction: Long or Short
Alerts: 3 total
- Entry: enter_long/enter_short
- Exit: exit_long/exit_short
- Re-entry: enter_long/enter_short

Disable Bot & Close All

What it does:

  • Closes all positions at market
  • Disables bot completely
  • Requires manual re-enable

Best for:

  • Emergency stops
  • End of session
  • Risk events
  • Manual intervention
Action: disable
Sub-action: market_close
Note: Bot must be manually re-enabled

Step 1: Configure Signal Bot

Navigate to 3Commas:

  1. Log in → 3Commas.io
  2. BotsSignal BotCreate Bot
  3. Configure with these settings:
Setting Value
Name e.g. Infinity Algo BTC
Exchange Select your exchange
Pairs Single or Multi (up to 200)
Alert Type Custom Signal
Direction Long / Short / Reversal (both)
TP/SL Set here or via webhook
Risk Caps Max Investment, Leverage

For multi-pair bots, also set Max active SmartTrades.


Step 2: Get Webhook Credentials

After saving your bot, find “Message for deal start signal” and copy:

{
  "secret":   "ab12cd34.ef56gh78…",   // Keep this private!
  "bot_uuid": "f1a2b3c4-…-9d0e1f2a",  // Your bot's ID
  "action":   "enter_long",
  "tv_exchange": "{{exchange}}",
  "tv_instrument": "{{ticker}}"
}

Step 3: Create TradingView Alerts

Alert Configuration

Field Value
Condition Match your Infinity Algo signal exactly
Options Once Per Bar Close (not “Once Per Bar”)
Webhook URL https://api.3commas.io/signal_bots/webhooks
Message JSON template with YOUR-SECRET & YOUR-UUID

JSON Templates

{
  "secret": "YOUR-SECRET",
  "bot_uuid": "YOUR-UUID",
  "action": "enter_long",

  "tv_exchange": "{{exchange}}",
  "tv_instrument": "{{ticker}}",

  "order": {
    "amount": 150,
    "currency_type": "quote",
    "order_type": "market"
  },

  "take_profit": {
    "enabled": true,
    "steps": [
      { "order_type": "limit", "price_percent": 1, "volume_percent": 25 },
      { "order_type": "limit", "price_percent": 2, "volume_percent": 25 },
      { "order_type": "limit", "price_percent": 3, "volume_percent": 25 },
      { "order_type": "market", "price_percent": 4, "volume_percent": 25 }
    ]
  },

  "stop_loss": {
    "enabled": true,
    "order_type": "market",
    "trigger_price_percent": 1
  },

  "max_lag": 300,
  "timestamp": "{{timenow}}"
}

Note: For limit entry, add "price" or "price_percent" with optional "price_percent_ref_type"

{
  "secret": "YOUR-SECRET",
  "bot_uuid": "YOUR-UUID",
  "action": "enter_short",

  "tv_exchange": "{{exchange}}",
  "tv_instrument": "{{ticker}}",

  "order": {
    "amount": 150,
    "currency_type": "quote",
    "order_type": "market"
  },

  "take_profit": {
    "enabled": true,
    "steps": [
      { "order_type": "limit", "price_percent": 1, "volume_percent": 25 },
      { "order_type": "limit", "price_percent": 2, "volume_percent": 25 },
      { "order_type": "limit", "price_percent": 3, "volume_percent": 25 },
      { "order_type": "market", "price_percent": 4, "volume_percent": 25 }
    ]
  },

  "stop_loss": {
    "enabled": true,
    "order_type": "market",
    "trigger_price_percent": 1
  },

  "max_lag": 300,
  "timestamp": "{{timenow}}"
}
{
  "secret": "YOUR-SECRET",
  "bot_uuid": "YOUR-UUID",
  "action": "exit_long",

  "tv_exchange": "{{exchange}}",
  "tv_instrument": "{{ticker}}",

  "order": {
    "amount": 100,
    "currency_type": "position_percent"
  },

  "max_lag": 300,
  "timestamp": "{{timenow}}"
}

Note: Exit orders are market-only — don’t add "order_type": "limit"

{
  "secret": "YOUR-SECRET",
  "bot_uuid": "YOUR-UUID",
  "action": "exit_short",

  "tv_exchange": "{{exchange}}",
  "tv_instrument": "{{ticker}}",

  "order": {
    "amount": 100,
    "currency_type": "position_percent"
  },

  "max_lag": 300,
  "timestamp": "{{timenow}}"
}
{
  "secret": "YOUR-SECRET",
  "bot_uuid": "YOUR-UUID",
  "action": "disable",

  "tv_exchange": "{{exchange}}",
  "tv_instrument": "{{ticker}}",

  "positions_sub_action": "market_close",

  "max_lag": 300,
  "timestamp": "{{timenow}}"
}

Quick Reference

Parameter Purpose Values
price_percent Take profit distance from entry Integer: 1 = 1%, 2 = 2%
volume_percent % of position to close Must sum to 100%
trigger_price_percent Stop loss distance Integer: 1 = 1% loss
currency_type Order size unit quote, base, margin_percent, position_percent
amount Position size Number based on currency_type
max_lag Reject stale signals Seconds (300 = 5 min)
timestamp Signal freshness Always use {{timenow}}
price_percent_ref_type Price reference for limit current_price, base_entry_price, avg_entry_price

Which Method Should You Use?

Feature Reversal Bot Clean Exit Panic Stop
Best For Trending markets Continuous trading Emergency stops
Alerts Needed 2 (minimal) 3 (entry/exit/re-entry) 1 (stop all)
Position State Always in Flexible gaps Fully closed
Bot Status Always active Always active Disabled
Re-entry Automatic Automatic Manual required
Ideal Trader Active/Confident Flexible/Cautious Risk-averse

Choose Reversal if you:

  • Trade trending pairs
  • Trust your signals
  • Want set-and-forget

Choose Clean Exit if you:

  • Need position control
  • Trade multiple pairs
  • Want gap periods

Advanced Features

Up to 8 Take Profit Levels

  • UI supports up to 4 levels
  • JSON supports up to 8 levels
  • Volumes must total 100%
  • Can mix limit and market orders
  • Trailing only on last step
"take_profit": {
  "enabled": true,
  "steps": [
    { "order_type": "limit", "price_percent": 1, "volume_percent": 20 },
    { "order_type": "limit", "price_percent": 2, "volume_percent": 20 },
    { "order_type": "limit", "price_percent": 3, "volume_percent": 15 },
    { "order_type": "limit", "price_percent": 4, "volume_percent": 15 },
    { "order_type": "limit", "price_percent": 5, "volume_percent": 10 },
    { "order_type": "limit", "price_percent": 6, "volume_percent": 10 },
    { "order_type": "limit", "price_percent": 7, "volume_percent": 5 },
    { "order_type": "market", "price_percent": 8, "volume_percent": 5,
      "trailing": { "enabled": true, "percent": 0.2 }
    }
  ]
}

Dynamic Stop Loss

"stop_loss": {
  "enabled": true,
  "order_type": "market",
  "trigger_price_percent": 2,
  "trailing": {
    "enabled": true,
    "percent": 0.5
  }
}

Trails 0.5% behind highest profit

Price Deviation & Deal Close Conditions

In bot configuration (not JSON):

  • Price deviation filters: Prevent unfavorable entries
  • Minimum profit: May block exits until profit target met

If exits don’t close, check your bot’s Minimum profit/Deal close conditions


Troubleshooting Checklist

Check Details
Valid Credentials JSON must include valid secret and bot_uuid
Required Fields Always include tv_exchange and tv_instrument in ALL signals
Correct Webhook URL Must be exactly https://api.3commas.io/signal_bots/webhooks
Alert Timing Alerts fire Once Per Bar Close (not “Once Per Bar”)
One Alert Per Action Never combine entry & exit in one JSON
Field Names Use price_percent not price_deviation
Volumes Sum to 100 All volume_percent must total exactly 100
Exit Orders Exit signals use market execution only — no limit orders
Signal Freshness Include max_lag and timestamp to prevent stale signals
Bot Re-enabling If using disable, must manually re-enable bot
Exit Not Working Check bot’s Minimum profit/Deal close conditions

JSON Field Glossary

Field Purpose Values & Rules
secret Private bot token Required — Copy exactly from Step 2
bot_uuid Unique Signal Bot ID Required — Copy from Step 2
action Bot command Requiredenter_long, enter_short, exit_long, exit_short, disable
tv_exchange TradingView exchange Required — Always {{exchange}}
tv_instrument TradingView pair Required — Always {{ticker}}
positions_sub_action When action is disable market_close → flatten & disable
cancel → cancel only
order.amount Position size Based on currency_type setting
order.order_type Entry order type market or limit (limit needs price or price_percent)
currency_type Unit for amount quote, base, margin_percent, position_percent
price Exact limit price For limit orders — exact price value
price_percent Take profit / limit distance Integer: 1 = 1%, 2 = 2%
price_percent_ref_type Reference for percent current_price, base_entry_price, avg_entry_price
volume_percent % to close at each take profit 1-100 (must sum to 100%)
trigger_price_percent Stop loss trigger Integer: 1 = 1% loss
max_lag Signal age limit Seconds (300 = 5 minutes)
timestamp Current time Always {{timenow}}

Resources