Skip to content
NyriaDocs

Stop loss and take profit

Add a stop loss and take profit to an alert on a paper account. On a live account, send them as exit alerts.

A strategy or a bot has no stop loss or take profit setting. Both come from your alerts.

On a paper account

Add stop_loss and take_profit to an OPEN alert that names its direction. Each takes a price, or a percent from your entry like "2%". On a long, the stop sits below it and the target above. A short is the mirror.

A limit entry with a 2% stop loss and a 6% take profit:

{
  "action": "OPEN",
  "instrument": "SPY",
  "direction": "LONG",
  "order_type": "limit",
  "limit_price": 775,
  "stop_loss": "2%",
  "take_profit": "6%"
}

Stops and targets run on paper and sandbox accounts. They work on stocks, ETFs and options. Alpaca paper takes stocks and ETFs only. The webhook reference lists every key and what each account takes.

Nyria's TradingView setup wizard adds the keys for you. Pick them in its Order types, stops and targets panel.

On a live account

A live position closes when an exit alert arrives. Build the stop and target into your TradingView strategy. Its exits become those alerts.

  1. In Pine, call strategy.exit with a stop and a limit. It closes the position inside your script.
  2. Create one Order fills only alert per ticker, with the strategy message.
  3. In Nyria, set Close on exit alerts on for the side you hold. With it off, exit alerts for that side are ignored.

When a level fills, TradingView sends the alert and Nyria closes the position. Your levels stay in TradingView. On a live stock, ETF or option account, Nyria places no stop or target at your broker.

From an indicator, send a CLOSE alert with the direction you hold.

When a key is refused

An alert an account can't take is refused, and the bot log says why. Nyria never swaps in a market order.

A stop loss on the wrong side of entry is refused too. Tradier needs a limit or stop entry for these keys, not a market one.

Your edge, on autopilot.

Trading carries risk. Read the risk disclosure.

© 2026 Nyria LLC. All rights reserved.