Docs

Trading Guide

Automating Infinity Algo Alerts via WunderTrading

Connect Infinity Algo signals to WunderTrading for automated trading with flexible position management.


Two Trading Workflows

Auto-Flip Positions (Futures Only)

What it does:

  • Automatic Long ↔ Short flipping
  • Just two alerts needed
  • Bot handles position reversal
  • With Swing Trade ON, Enter-Long/Enter-Short flip positions automatically

Best for:

  • Futures trading only
  • Trending markets
  • Minimal alerts
  • Always in position
Swing Trade: ON (Futures only!)
Alerts: 2 total
- Buy Signal → Enter-Long
- Sell Signal → Enter-Short
(Exit-All only for flattening without opening opposite)

Manual Position Control

What it does:

  • Full control over exits
  • No position overlap
  • Works on Spot & Futures
  • Clear entry/exit separation

Best for:

  • Spot trading
  • Risk management
  • Position gaps
  • More control
Swing Trade: OFF
Alerts: 3+ total
- Entry → Enter-Long/Enter-Short
- Exit → Exit-Long/Exit-Short
- Optional re-entry

Step 1: Build Signal Bot in WunderTrading

Navigate to WunderTrading:

  1. Log inBotsSignal BotCreate bot
  2. Configure General tab settings:
Field Value
Name e.g. Infinity Algo BTC
Exchange/API Select your exchange API
Pairs Select up to 10 pairs in UI
Timeframe label Any (just a label)
Multiple entries ON for scale-ins
Swing trade ON for auto-flip (Futures)

Step 2: Configure Entries & Get Webhook

Entries tab configuration:

Setting Value
Bot start condition TradingView Alert
Bot settings format JSON

After saving, your bot will display:

  • Webhook URL: Copy the exact URL shown in your bot’s Alerts tab
  • Alert comments: Copy exactly as shown (default: Enter-Long, Enter-Short, Exit-All)

Step 3: Create TradingView Alerts

Standard Alert Settings

Field Value
Condition Select your Infinity Algo signal (e.g., “Buy Signal - Smart”)
Options Once Per Bar Close (prevents duplicate orders)
Webhook URL Paste the exact URL from your bot’s Alerts tab
Message JSON template (see below)

JSON Templates

{
  "code": "Enter-Long",            // must match your bot's comment EXACTLY
  "orderType": "market",
  "amountPerTradeType": "quote",   // quote currency (e.g., USDT on BTC/USDT)
  "amountPerTrade": 150,

  "takeProfits": [
    { "priceDeviation": 0.01, "portfolio": 0.25 },
    { "priceDeviation": 0.02, "portfolio": 0.25 },
    { "priceDeviation": 0.03, "portfolio": 0.25 },
    { "priceDeviation": 0.04, "portfolio": 0.15 },
    { "priceDeviation": 0.05, "portfolio": 0.07 },
    { "priceDeviation": 0.06, "portfolio": 0.03 }
  ],

  "stopLoss": { "priceDeviation": 0.01 },
  "reduceOnly": true,              // prevents exits from increasing size (Futures only)
  "placeConditionalOrdersOnExchange": false
}
{
  "code": "Enter-Short",           // change only this line
  "orderType": "market",
  "amountPerTradeType": "quote",   // quote currency
  "amountPerTrade": 150,

  "takeProfits": [
    { "priceDeviation": 0.01, "portfolio": 0.25 },
    { "priceDeviation": 0.02, "portfolio": 0.25 },
    { "priceDeviation": 0.03, "portfolio": 0.25 },
    { "priceDeviation": 0.04, "portfolio": 0.15 },
    { "priceDeviation": 0.05, "portfolio": 0.07 },
    { "priceDeviation": 0.06, "portfolio": 0.03 }
  ],

  "stopLoss": { "priceDeviation": 0.01 },
  "reduceOnly": true
}
{
  "code": "Exit-Long",
  "orderType": "market",
  "reduceOnly": true
}

Skip if using Swing trade ON

{
  "code": "Exit-Short",
  "orderType": "market",
  "reduceOnly": true
}

Skip if using Swing trade ON

{
  "code": "Exit-All",
  "orderType": "market",
  "reduceOnly": true
}

Closes all positions at market


Quick Comparison

Feature Swing Trade ON Explicit Exit
Market Type Futures only Spot & Futures
Alerts Needed 2 (minimal) 3+ (entry/exit/re-entry)
Position Control Automatic flip Manual control
Position Gaps Never Possible
Complexity Simple Moderate

Pick Your Workflow

If you want… Use these alerts & JSON
A) Ping-pong (auto flip)
Long → Short → Long with just two alerts
Turn Swing trade = ON in bot (Futures only)
Buy alertEnter-Long JSON
Sell alertEnter-Short JSON
• Use Exit-All only when you want to flatten without opening opposite
B) Explicit exit first
Never overlap positions; more control
Leave Swing trade = OFF
Entry alertEnter-Long or Enter-Short JSON
Exit alertExit-Long or Exit-Short JSON
(Optional) second entry alert to reverse

Advanced Features

0–6 Take Profit Levels

  • Add up to 6 take profit steps
  • Portfolios must sum to 1.0
  • Multi-pair requires priceDeviation (decimals, not %)
  • Single-pair can use price
"takeProfits": [
  { "priceDeviation": 0.01, "portfolio": 0.30 },
  { "priceDeviation": 0.02, "portfolio": 0.25 },
  { "priceDeviation": 0.03, "portfolio": 0.20 },
  { "priceDeviation": 0.04, "portfolio": 0.15 },
  { "priceDeviation": 0.05, "portfolio": 0.07 },
  { "priceDeviation": 0.06, "portfolio": 0.03 }
]

Sum = 1.0 (100%)

Multiple Entries

Enable in bot settings for:

  • DCA on consecutive signals
  • Building larger positions
  • Averaging entry price

Works with both workflows

amountPerTradeType options:

Spot markets:

  • quote - Quote currency (e.g., USDT)
  • base - Base currency (e.g., BTC)
  • percents - Percentage of balance

Derivatives/Futures:

  • quote - Quote currency
  • contracts - Number of contracts
  • percents - Percentage of balance

Pro Tips

  • priceDeviation format – Use decimals (0.02) not percentages (2%)
  • Portfolio sum – Take profit portfolios must add up to exactly 1.0 (100%)
  • reduceOnly – Applies to exits; has no effect on Spot markets
  • Comment codes – Copy exactly from your bot; they change if you edit bot settings
  • Strategy alerts – Use alert() function with {{strategy.order.comment}} for strategies
  • Paper test first – WunderTrading log shows “Signal executed” if webhook parsed correctly

Troubleshooting Checklist

Symptom Likely cause / fix
No deal appears code in JSON doesn’t match bot’s Alert comment exactly (check case!)
Bot opens but doesn’t close Swing trade OFF and you forgot exit alert — or reduceOnly:false caused flip
Webhook error 400 JSON syntax error or using % instead of decimals (use 0.02, not 2%)
Duplicate deals Alert set to “Once Per Bar” instead of “Once Per Bar Close”
Multi-pair TP/SL fails Must use priceDeviation (decimals), not price
Comments changed Bot edits can change comment codes — update alerts after any bot changes

JSON Key Reference

Key What it does Details
code Alert comment identifier Must match bot’s comment exactly (case-sensitive!)
orderType Order execution type market or limit
amountPerTradeType Position size unit Spot: quote/base/percents
Futures: quote/contracts/percents
amountPerTrade Position size Value depends on type above
takeProfits Array of partial exits priceDeviation: decimal (0.02 = 2%)
portfolio: fraction to close (must sum to 1.0)
stopLoss Stop loss configuration priceDeviation: decimal from entry
reduceOnly Prevent size increase true → exits only decrease position (Futures only, no effect on Spot)
placeConditionalOrdersOnExchange Where orders execute false = managed by bot
true = on exchange

Which Workflow Should You Use?

Choose Swing Trade if:

  • Trading Futures only
  • Want minimal alerts
  • Trust your signals
  • Always in position

Choose Explicit Exit if:

  • Trading Spot markets
  • Need position control
  • Want gap periods
  • Risk management focus

Resources