📺 TradingView Integration

TradingView Webhook Setup

Automate your TradingView alerts to execute trades on all your NinjaTrader accounts simultaneously.

1

Prerequisites

Before setting up TradingView automation, make sure you have:

  • TradingView Pro, Pro+, or Premium — Webhook alerts require a paid TradingView subscription
  • MomentumFlow installed and connected — Complete the Getting Started guide first
  • At least one Trading Group created — With accounts assigned and webhook enabled
  • NinjaTrader running — The addon must be connected for trades to execute
💡 Free TradingView Users

TradingView's free plan doesn't support webhook alerts. You can still use MomentumFlow's Quick Trade dashboard for manual trade copying, or upgrade to TradingView Pro ($12.95/mo) for automation.

2

Get Your Webhook URL

Your webhook URL is where TradingView sends alerts. Find it in your MomentumFlow dashboard:

  1. Open your MomentumFlow Dashboard
  2. Navigate to your Trading Group settings
  3. Enable "Webhook" for the group
  4. Copy the Webhook URL displayed
⚠️ Keep Your Webhook URL Private

Your webhook URL includes your unique token. Don't share it publicly — anyone with this URL could trigger trades on your accounts.

3

Create TradingView Alert

Set up an alert in TradingView to trigger your webhook:

  1. Open the Alert Dialog
    • Right-click on chart → Add Alert
    • Or press Alt+A (Windows) / Option+A (Mac)
    • Or click the alarm clock icon in the toolbar
  2. Set Your Condition
    • Choose your indicator or strategy
    • For strategies, select "Order fills only"
  3. Configure Notifications Tab
    • Check "Webhook URL"
    • Paste your webhook URL from Step 2
  4. Set the Alert Message
    • Go to the Message field
    • Enter your JSON payload (see Step 4)
  5. Name and Save
    • Give it a descriptive name (e.g., "MGC Long Entry")
    • Click Create
💡 Pro Tip

Create separate alerts for LONG, SHORT, and FLATTEN signals. This gives you more control and makes debugging easier.

4

Alert Message Formats

Choose the JSON format that matches your needs. Copy and paste directly into TradingView's alert message field.

Simplest format — uses your group's default SL/TP settings:

Long Entry
{
  "direction": "LONG"
}
Short Entry
{
  "direction": "SHORT"
}
Close/Flatten All
{
  "direction": "FLATTEN"
}

Override your group's default stop loss and take profit (values in ticks):

Long with Custom SL/TP
{
  "direction": "LONG",
  "sl": 200,
  "tp": 100
}
📏 Tick Values by Instrument

MGC: 1 tick = $1 (10 ticks = $10) | GC: 1 tick = $10 | ES: 1 tick = $12.50 | MES: 1 tick = $1.25

Automatically move stop to breakeven after reaching a profit target:

Long with Auto-Breakeven
{
  "direction": "LONG",
  "sl": 200,
  "tp": 100,
  "be_trigger": 70,
  "be_offset": 2
}
Field Description
be_trigger Move stop to breakeven after X ticks of profit
be_offset Offset from entry when moving to breakeven (e.g., +2 ticks)

Add a trailing stop that follows price:

Long with Trailing Stop
{
  "direction": "LONG",
  "sl": 200,
  "tp": 100,
  "trail_trigger": 50,
  "trail_distance": 20
}
Field Description
trail_trigger Start trailing after X ticks of profit
trail_distance Trail stop X ticks behind price

For TradingView strategies, use placeholders to automatically detect direction:

Auto Direction from Strategy
{
  "direction": "{{strategy.order.action}}"
}

TradingView will automatically replace {{strategy.order.action}} with "buy" or "sell" based on your strategy's orders.

💡 Strategy Alert Setup

When creating alerts for strategies, select "Order fills only" as the condition to trigger on actual strategy entries/exits.

5

Test Your Setup

Before going live, test your webhook connection:

  1. Enable Sim Mode — In NinjaTrader, connect to your simulation account first
  2. Trigger a Test Alert — In TradingView, click the alert and select "Run now" (or wait for it to trigger)
  3. Check the Dashboard — Your MomentumFlow dashboard should show the received signal in Signal History
  4. Verify Trade Execution — Check that the trade appeared in NinjaTrader's positions
⚠️ Always Test in Simulation First

Never test with real money. Use NinjaTrader's simulation mode until you're confident everything works correctly.

Troubleshooting

Issue Solution
Alert not triggering Check TradingView alert is active (not paused/expired)
Signal received but no trade Verify NinjaTrader is connected and group has accounts assigned
Invalid JSON error Check for missing quotes or commas in your alert message
Wrong position size Check your group's per-account SIZE settings
Session blocked Verify current time is within your group's session windows

Full Reference

Accepted Direction Values

MomentumFlow accepts various formats (case-insensitive):

You Send Action
LONG, BUY, buy Open long position
SHORT, SELL, sell Open short position
FLATTEN, CLOSE, FLAT Close all positions

All Available Fields

Full Options (All Fields)
{
  "direction": "LONG",
  "token": "your_secret_token",
  "group": "TRADINGVIEW",
  "symbol": "MGC",
  "quantity": 2,
  "sl": 200,
  "tp": 100,
  "be_trigger": 70,
  "be_offset": 2,
  "trail_trigger": 50,
  "trail_distance": 20
}
Field Required Description
direction ✅ Yes Trade direction: LONG, SHORT, or FLATTEN
token No Security token (if enabled in your settings)
group No Target group name. Default: first webhook-enabled group
symbol No Instrument symbol. Default: group's default instrument
quantity No Position size. Default: group's per-account SIZE setting
sl No Stop loss in ticks. Default: group's SL setting
tp No Take profit in ticks. Default: group's TP setting
be_trigger No Breakeven trigger in ticks
be_offset No Breakeven offset from entry
trail_trigger No Trailing stop trigger in ticks
trail_distance No Trailing stop distance in ticks

Need Help?

Having trouble with your TradingView integration? We're here to help.