DocsAPITradingView → Journal
TradingView · Auto-journaling

TradingView → Journal

Every time your TradingView strategy closes a trade, it pings TradeJournal Pro and the trade lands in your journal — with pair, direction, entry, exit, lot size, and P&L pre-filled. No CSV uploads, no manual entry.

When to use this vs. the signal copier

Two different flows — pick the right one for your alert:

  • This page — for TradingView strategies: log a completed trade to the journal. Use when you backtest in TradingView or your strategy auto-trades elsewhere and you just want the journal to mirror it.
  • /webhook-wizard — for TradingView study alerts: send a pending signal to the copier so it gets auto-executed on your broker. Use when you want TradingView to drive your live trades.
1

Mint a write-scope API key

Sign in, open /account → API Keys, click Create key, name it "TradingView journal", and check the write scope. Copy the plaintext key the second it appears — you only see it once.

2

Add a TradingView alert

On your strategy chart, click the clock icon → Create Alert. Set Condition to your strategy, then:

Webhook URL (paste into TradingView alert form)

https://tradejournalpro.net/api/v1/trades

HTTP Headers — TradingView Premium only

Authorization: Bearer tjp_live_YOUR_KEY_HERE
Content-Type: application/json

TradingView's free/Pro tiers don't let you set request headers. Workaround: put the key in the JSON body as api_key and the receiver will accept it — but that's only safe over HTTPS to your own domain. Premium tier is recommended.

3

Alert message body

Paste this into TradingView's Message textarea exactly. The double-brace tokens are filled in by TradingView at fire time.

{
  "date":         "{{timenow}}",
  "pair":         "{{ticker}}",
  "direction":    "{{strategy.order.action}}",
  "entry_price":  {{strategy.order.price}},
  "exit_price":   {{close}},
  "stop_loss":    {{strategy.order.contracts}},
  "take_profit":  {{strategy.order.contracts}},
  "lot_size":     {{strategy.position_size}},
  "pnl":          {{strategy.netprofit}},
  "risk_reward":  1.0,
  "outcome":      "{{strategy.order.action}}",
  "session":      "OTHER",
  "strategy":     "{{strategy.order.alert_message}}",
  "notes":        "TV alert · bar {{time}}"
}
  • · {{ticker}} resolves to e.g. XAUUSD on TradingView's symbol.
  • · {{strategy.order.action}} = buy or sell — receiver normalises both casings.
  • · {{strategy.netprofit}} is cumulative P&L; if you'd rather log per-trade, swap in your own plot() value.
4

Optional: Pine v5 strategy boilerplate

If you're writing your strategy from scratch, this snippet fires the alert on every position-size change (entry, exit, partial close):

//@version=5
strategy("My Strategy → TradeJournal Pro", overlay=true)

// ... your entry/exit logic here ...

// Fire on every order:
alertcondition(strategy.position_size != strategy.position_size[1],
  title="TradeJournal Pro — log trade",
  message="see TradingView 'Message' field below — DO NOT replace this with text")

Need to verify it's working?

After your first alert fires, open /trades — the most recent row should match the trade you just closed in TradingView. If nothing shows up, hit https://tradejournalpro.net/api/v1/me with your bearer token to confirm the key authenticates.