Alert message reference

The actions, quantity, and message formats your TradingView alert can send to Lune.

Markdown
Updated Jul 3, 2026

The alert message tells Lune what to do. It carries an action (enter, exit, add, or partially exit) and a quantity. This page lists every action Lune accepts and the message formats you can send.

Actions#

Set action to say what the signal does. Lune accepts these values:

LongEntryactionOptional

Open or add to a long position.

ShortEntryactionOptional

Open or add to a short position.

LongExitactionOptional

Close a long position.

ShortExitactionOptional

Close a short position.

LongPartialExitactionOptional

Close part of a long position.

ShortPartialExitactionOptional

Close part of a short position.

LongAddToPositionactionOptional

Add contracts to an open long. Used for scaling in, martingale, or DCA.

ShortAddToPositionactionOptional

Add contracts to an open short.

Quantity#

Set quantity to the number of contracts. Whether Lune uses this number depends on your sizing mode. See Position sizing.

quantitynumberOptional

Contracts for this signal. Futures trade in whole contracts, so Lune rounds down to a whole number, with a minimum of 1.

The buy and sell fallback#

If you leave action out, Lune maps a plain buy or sell:

buymaps to LongEntryOptional

A buy signal with no action opens or adds to a long.

sellmaps to LongExitOptional

A sell signal with no action closes a long.

Send action directly when you want full control over entries, exits, adds, and partials. Rely on the buy and sell fallback only for simple long-only setups.

Message formats#

Lune accepts three ways to send a signal. Pick the one that matches how your TradingView alert is set up.

Single alert message

One TradingView alert sends one fixed message for every trigger. Best when a single alert covers your whole strategy.

Multiple alert messages

Separate TradingView alerts for entries and exits, each with its own message. Best when you want a different message per event.

Custom Buy/Sell JSON

Raw JSON for non-TradingView tools. Send action directly for full control over every event type.

Note

Custom JSON is the advanced path. It also accepts strategy_prev_market_position and strategy_market_position so Lune can derive the action the same way it does for TradingView. Most users do not need these fields.

Next steps#

Was this page helpful?