alert(). They are not broker-emulator strategies, and their local plots do not represent exchange exposure.
Choose a complete example
The same running continuous alert can reuse one key for successive cycles. Multiple-position policy plus a group exit can allow concurrent independent entries. A fresh key is not required for every position.
The public examples contain an invalid token, a synthetic target and an intentionally expired credential timestamp. Use the complete script generated privately by Liftx for your real setup. The public code is an inspectable example, not a preconfigured trading connection.
Copy the private example
After creating the setup, select Pine (advanced) above the guide’s numbered steps. Liftx shows one private script: Continuous for Guided setups with OPEN permission, otherwise Exit-only. Both require terminate permission. Copy it with Copy script; the read-only preview includes the full script even when it scrolls. After adding the script to TradingView, its Settings → Inputs → On a termination signal chooses an authorized selector:- One strategy position: exact locally retained lifecycle reference.
- This strategy’s positions: eligible positions belonging to this setup on the script’s exact market.
- All positions in this market: the explicitly granted market target, including manual and other strategies’ matching positions.
TradingView setup, step by step
- Open TradingView Supercharts and select a chart with realtime updates. Confirm its data is appropriate for the intended signal; execution uses the script’s explicit permitted target on the setup’s selected exchange.
- Open Pine Editor, create a new indicator and replace its contents with the complete generated Pine v6 script.
- Save it privately. The code contains the restricted key; never publish it, share its source or include it in a screenshot.
- Add the indicator to the chart and open its Settings → Inputs.
- Configure the inputs while the enable checkbox is off. Set the future times and conditions described below, then enable it before creating the server alert.
- Create one alert with the condition matching the indicator title and Any alert() function call.
- In Notifications, enable Webhook URL and paste
https://hooks.liftx.io/v1/tradingview/events. - Choose an alert expiration appropriate for the workflow and no later than the key expiry when one is set. For One-shot, it must also be after TERMINATE time.
- Create the alert before its future start/open time. Verify the alert’s saved configuration and running status.
- Observe the first deliberate demo event in the TradingView log, Liftx Events and actual positions/orders.
Input reference
Continuous and Exit-only require standard time-based candles of at least one minute. Their timestamp and one-event-per-confirmed-bar logic are designed around that constraint. One-shot is driven by incoming realtime updates, not a wall-clock scheduler.
Customize conditions, preserve the protocol
In the continuous example, these are the demonstration conditions:Configure OPEN and protections
Guided mode keepsliftxOpenRequest empty: the saved setup supplies the full request. For a custom Advanced sender, provide the complete request as JSON text. Position JSON in Trading copies a new opening request with OPEN grids, SL, SLx, TP and rearrangement using the canonical fields. Advanced setup does not import this request for you.
If writing dynamic price/quantity code, explicitly produce coefficient strings and scales using the instrument’s precision. Maintain all required paired arrays and conditional fields. Do not insert floating-point JSON numbers or raw chart decimal text into atomic strings. Keep the nested scope identical to the outer command and within the key’s policy.
Liftx owns protection execution after handoff. Pine should not try to mirror each exchange fill or independently implement SLx execution by assuming its local signal state matches the exchange.
Modify requires current state
The reusableliftxMessage function accepts modify and a complete request. That does not make a cached request safe. A controller must read current canonical position data, map it to the current request with exact slot identities, and preserve OPEN rows. Pine cannot retrieve that state or consume a webhook receipt. Use API modification for changes requiring those observations; the supplied scripts intentionally do not schedule modification.
Restart and expiry behavior
varip tracks local signal state across realtime updates, not a durable Liftx execution ledger. The examples fail closed when restarted after their required future start. They do not recover prior references or rearm themselves.
After an interruption, stop the old alert, inspect Events and real positions, and manage outstanding exposure. Create a new setup/source for a new producer. Keep one coordinated producer per setup and instrument: one Pine alert or one ordinary OPEN/EXIT pair. Independent strategies on the same instrument need separate setups.
A configured key expiry stops new signals in the helpers. A no-expiration key uses liftxCredentialExpiresAt = 0; each command still expires after 60 seconds. Missing data, stopped alerts or failed webhook delivery can also prevent an exit. Existing Liftx protections continue, but an emitted exit or expired key never proves the position is flat.