From Trading Rules to TradingView Alerts with PickMyTrade

Dark trading desk and laptop chart with the title From Trading Rules to TradingView Alerts with PickMyTrade.

Guest post by RetryLab, edited by PickMyTrade. RetryLab builds custom trading indicators and risk tools. This article is part of a cross-promotion collaboration.

To turn your trading rules into automated order requests, first make each rule precise, then build a TradingView script that generates the right alerts. Configure those alerts with the current PickMyTrade payload for your broker and test both entries and exits on a permitted demo account.

Most traders who want to automate already know their idea. The missing step is translating “buy the 9/21 EMA cross during my morning session” into conditions a script can evaluate. This guide follows that process, including the checks that matter before connecting a prop-firm account.

The workflow: written rules → Pine Script → TradingView alert → PickMyTrade processing → broker order request. A successful alert does not, by itself, confirm a broker fill.

1. Write trading rules a script can check

Start with numbers and explicit conditions. Decide which symbol, timeframe, timezone, position size and exit behavior you intend to use before asking someone to build the script.

  • Entry: the 9 EMA crosses above the 21 EMA on a 5-minute chart.
  • Exit: the 9 EMA crosses below the 21 EMA, or the script detects that the trading window has ended.
  • Window: 09:30–11:30 in the chart symbol’s exchange timezone.
  • Size: one contract for this futures example, with the routed quantity checked separately.
  • Risk rule: a $500 intraday-loss threshold in the strategy simulation, plus separate checks against the account’s actual limits.

“Trade only when the trend is strong” leaves room for interpretation. “ADX above 25” is a condition. Treat the values here as teaching examples, not a recommended trading system.

Exchange time is not necessarily New York time. If your intended session is the New York morning, specify that timezone in the script requirements and test daylight-saving changes.

2. Turn the rules into Pine Script

A strategy script is useful for illustrating entries and exits because TradingView can generate alerts from its simulated order fills. An indicator can also generate signals, but the alert configuration must match how its author implemented them.

The following Pine Script v6 example uses fixed sizing and a session input. It is educational code, not a broker-tested integration or a complete prop-firm risk system. Compile it in TradingView and validate its behavior before attaching a webhook.

//@version=6
strategy("EMA cross + session window (example)",
     overlay = true,
     default_qty_type = strategy.fixed,
     default_qty_value = 1)

fastLen = input.int(9, "Fast EMA", minval = 1)
slowLen = input.int(21, "Slow EMA", minval = 1)
sess = input.session("0930-1130", "Window (exchange time)")
maxLoss = input.float(500, "Simulated intraday loss limit", minval = 0)

strategy.risk.max_intraday_loss(maxLoss, strategy.cash)

inSession = not na(time(timeframe.period, sess))
fast = ta.ema(close, fastLen)
slow = ta.ema(close, slowLen)
longSignal = ta.crossover(fast, slow)
exitSignal = ta.crossunder(fast, slow)

if inSession and longSignal
    strategy.entry("Long", strategy.long)

if exitSignal or not inSession
    strategy.close("Long")

plot(fast, "Fast EMA", color.teal)
plot(slow, "Slow EMA", color.orange)

What the daily-loss setting actually does

strategy.risk.max_intraday_loss() acts on the strategy simulation: reaching its threshold cancels pending simulated orders, closes the simulated position and stops further trading until the session ends. It does not read the funded account’s actual equity or enforce that firm’s rule. See TradingView’s strategy risk-management documentation.

A $500 script setting does not cap real losses at $500. Broker fills, fees, other trades, the firm’s reset time and its drawdown calculation can differ. The sample also has no per-trade protective stop and no news filter.

Check session exits and alert timing

This simple session check requests a close when the script evaluates an out-of-session bar. With default strategy calculation and fill timing, that is not an exact 11:30 liquidation. Test the boundary on the intended timeframe; use a specifically designed and tested exit rule if a firm requires positions closed by a deadline.

For indicator-based signals, ask the author whether the script uses alertcondition() or alert(), whether it waits for bar close, and how entry and exit messages are distinguished. A chart marker alone is not a complete automation specification.

3. Connect the TradingView alert to PickMyTrade

Use the current generator and documentation for your broker. The PickMyTrade TradingView alert setup guide below covers the Tradovate route. For other supported brokers, start with the matching guide in the PickMyTrade documentation.

  1. In PickMyTrade, open Generate Alert, select the intended account and configure the alert for your script and instrument.
  2. Copy the generated alert code into the TradingView alert’s message field.
  3. Copy the webhook URL from the same PickMyTrade setup into TradingView’s Notifications → Webhook URL field. Use it exactly as generated.
  4. For the order-fill strategy example above, use the strategy’s order-fill alert source, shown as Order fills only when that selector is available. Do not apply this choice blindly to scripts that send their payload through alert().
  5. Check the destination account, symbol and quantity before enabling the alert.

Use a TradingView subscription that currently includes webhooks and enable two-factor authentication, which TradingView requires for webhook alerts. Check your plan’s current feature list rather than relying on older plan names. See TradingView’s webhook requirements.

TradingView stores a snapshot of the script, inputs, symbol and timeframe when you create a script alert. After changing those settings, recreate the alert to apply the new configuration. See TradingView’s alert documentation.

4. Five checks before using a funded account

  1. Compare actual account limits. Read the firm’s current rules for your exact account type, including the daily reset timezone and whether loss calculations include open positions and fees. A buffer below a limit cannot guarantee you will remain within it.
  2. Confirm routed size. Fixed size in Pine does not establish the final broker quantity. Check the generated payload, account configuration and any applicable multiplier, then verify the result in demo.
  3. Plan news windows. Check the firm’s current restrictions and the official release schedule. A news filter should distinguish blocking new entries from managing an existing position. The sample code above does not implement this filter.
  4. Practice stopping the workflow. Know how to pause the TradingView alert and inspect open positions and working orders at the broker. Pausing future alerts does not close an existing position or cancel orders already submitted.
  5. Verify permission separately. Broker connectivity does not establish that a prop firm permits your script, automation method or account usage. Resolve those questions with the firm before connecting.

5. Test entries, exits and failure cases in demo

Use a suitable demo environment where the workflow is permitted. Start with the intended symbol, timeframe and session. A faster chart can help with a separate connectivity test, but it changes the strategy and does not validate the original settings.

  • Source: confirm that TradingView generated the intended entry or exit alert and inspect its webhook delivery status.
  • Processing: check PickMyTrade’s Alert Log for receipt, processing and any reported errors.
  • Destination: inspect the broker’s actual order status, filled quantity, position and remaining working orders.
  • Edge cases: test session end, the simulated loss threshold, a paused alert and any separately implemented news filter.

If an exit is missing, inspect the broker before retrying. An alert log entry is not proof that the account is flat. Record the timestamps and error details so you can identify which stage needs attention.

Before moving to another account, regenerate or verify its configuration and repeat the relevant checks. A demo test is evidence about that test environment; it does not promise the same live fills or establish firm permission.

Need help building your script?

RetryLab offers an Indicator Builder service for traders who describe their rules in words. According to RetryLab, deliverables can include a TradingView indicator or strategy with alerts and source code. Agree the entry, exit, sizing, timing and webhook requirements before commissioning a build, then validate the delivered script.

RetryLab also describes Prop Firm Guard as a free, read-only TradingView panel for monitoring configured loss limits. It does not place orders. Check its current documentation, inputs and calculation scope; do not treat its display as authoritative broker equity or a guarantee against a rule breach.

This article is educational and is not financial advice. Automation follows configured rules; it does not make a strategy profitable or guarantee execution, compliance or payouts.

Automate Your TradingView Strategies
Connect your alerts with PickMyTrade — automated trade execution, no coding required. Start free →
For AI tools & developers:View Markdown →

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Markdown version