Alert message reference
The actions, quantity, and message formats your TradingView alert can send to Lune.
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:
LongEntryactionOptionalOpen or add to a long position.
ShortEntryactionOptionalOpen or add to a short position.
LongExitactionOptionalClose a long position.
ShortExitactionOptionalClose a short position.
LongPartialExitactionOptionalClose part of a long position.
ShortPartialExitactionOptionalClose part of a short position.
LongAddToPositionactionOptionalAdd contracts to an open long. Used for scaling in, martingale, or DCA.
ShortAddToPositionactionOptionalAdd 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.
quantitynumberOptionalContracts for this signal. Futures trade in whole contracts, so Lune rounds down to a whole number, with a minimum of 1.
Because Lune rounds down, a value below 1 still trades 1 contract. A partial exit with a size that rounds to 1 closes a full contract. See Adds and duplicates.
The buy and sell fallback#
If you leave action out, Lune maps a plain buy or sell:
buymaps to LongEntryOptionalA buy signal with no action opens or adds to a long.
sellmaps to LongExitOptionalA 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.
One TradingView alert sends one fixed message for every trigger. Best when a single alert covers your whole strategy.
Separate TradingView alerts for entries and exits, each with its own message. Best when you want a different message per event.
Raw JSON for non-TradingView tools. Send action directly for full control over every event type.
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.