Pine Script Webhook Alert for PickMyTrade
Builds the PickMyTrade webhook JSON payload inside Pine, so a TradingView alert can auto-trade a connected Apex, Tradeify, or Bulenox account.
//@version=6
strategy("Target Filled - PickMyTrade Webhook Example", overlay=true, calc_on_every_tick=false)
// --- Inputs ---------------------------------------------------
acctToken = input.string("YOUR_PICKMYTRADE_TOKEN", "PickMyTrade Account Token")
orderQty = input.int(1, "Contracts", minval=1)
// --- PickMyTrade payload builder (assembled at runtime) -----------
// Match these field names exactly to the alert template your own
// PickMyTrade dashboard generates — rename here if yours differs.
pmtPayload(direction) =>
'{"symbol": "' + syminfo.ticker + '", "data": "' + direction + '", "quantity": ' +
str.tostring(orderQty) + ', "token": "' + acctToken + '"}'
// --- Sample signal — replace with your own entry logic ---------
fastMA = ta.ema(close, 9)
slowMA = ta.ema(close, 21)
if ta.crossover(fastMA, slowMA)
strategy.entry("Long", strategy.long, qty=orderQty)
alert(pmtPayload("buy"), alert.freq_once_per_bar_close)
if ta.crossunder(fastMA, slowMA)
strategy.entry("Short", strategy.short, qty=orderQty)
alert(pmtPayload("sell"), alert.freq_once_per_bar_close) Settings
| Input | Default | Purpose |
|---|---|---|
| acctToken | — | Your PickMyTrade account token, copied from the dashboard. |
| orderQty | 1 | Contract quantity sent in the payload and used for the entry. |
How to use
- Generate an alert template in your PickMyTrade dashboard first, and mirror its exact field names inside
pmtPayload. - Swap the EMA-crossover placeholder for your own entry conditions.
- Create a single TradingView alert with condition "Order fills and alert() function calls" and paste in the PickMyTrade webhook URL.
- Per-firm routing — which broker and account a payload lands on — is configured on the PickMyTrade side, not in Pine. See the PickMyTrade Apex setup guide.
Which firms allow this
Automation policy varies by firm and can change between the evaluation and a funded account. Current policy for the firms PickMyTrade most commonly routes to:
| Firm | Automation Policy |
|---|---|
| Apex Trader Funding | Allowed during the evaluation. Not allowed for commercial/resold automation on live Performance Accounts — a script may still drive manual-confirm execution. |
| Tradeify | Explicitly permitted on both evaluations and funded accounts. |
| Bulenox | Permitted during evaluations via TradingView alerts to an execution broker; page caveats to always verify current policy. |
On NinjaTrader 8 or Tradovate? Automate with CrossTrade
If your account runs on NinjaTrader 8 or Tradovate, CrossTrade is the automation platform we recommend. It connects TradingView alerts to NinjaTrader 8 through a desktop add-on, and to Tradovate in the cloud with nothing to install. Its Account Manager can also hold a max daily loss, max daily profit, and trailing drawdown on each account, flattening and locking the account when one is hit. On NinjaTrader, those limits run while NinjaTrader and the add-on are running.
A CrossTrade alert message is a list of key=value lines rather than JSON, and it
doesn't need alert() at all. Create one alert on the strategy, set the condition
to "Order fills only," and paste this into the alert's message box:
key=your-secret-key;
command=place;
account=sim101;
instrument=ES1!;
action={{strategy.order.action}};
qty={{strategy.order.contracts}};
order_type=market;
tif=day; - TradingView fills in
{{strategy.order.action}}(buy or sell) and{{strategy.order.contracts}}each time the strategy's order fills, so the strategy's own entries and exits drive the orders. - Swap
your-secret-key,sim101, andES1!for your own CrossTrade key, account, and instrument. The CrossTrade docs cover every field. - Paste your own CrossTrade webhook URL into the alert's Notifications tab. Webhook alerts need a paid TradingView plan.
- "Order fills only" keeps the PickMyTrade
alert()payloads from the snippet above out of this alert, so CrossTrade only receives its own message. - Check your firm's current automation rules before connecting a prop firm account.
CrossTrade offers a 7-day free trial, no credit card required. Target Filled is built by the team behind CrossTrade, the automation platform we recommend.
Frequently Asked Questions
What webhook format does PickMyTrade use?
str.tostring. Field names have to match whatever template your PickMyTrade dashboard actually generates, so pull that template first and rename the keys here if they differ.