Skip to content

Guide

Why didn't my short alert close my long in Nyria?

A short alert closes a long only when Long behavior and Short behavior are both set to Enter position. The alert must also report the flip, such as Order fills only with prevMarketPosition long and marketPosition short. A plain short entry reports no position, so Nyria waits for the long's exit alert.

Official documentation

Make a short alert reverse a long

  1. 1

    Open the behavior settings

    Open the strategy's menu, select Edit, then the What it trades step.

  2. 2

    Set both sides

    Set On a long entry alert and On a short entry alert to Enter position.

  3. 3

    Turn on exit alerts

    Turn on Close on exit alerts for the long, so a held short can wait for its exit.

  4. 4

    Report the flip

    Use TradingView's Order fills only alert, or the default text alert that ends New strategy position is -1.

  5. 5

    Read the bot log

    A rejected short reads held alert rejected, with the long still open.

Long-only strategies

  • With Short set to Do nothing, a short alert never closes the long.
  • Set both sides to Enter position first.
  • Then a reversing alert closes the long, then opens the short.

What reverses a position

  • Order fills only with prevMarketPosition long and marketPosition short.
  • The default text alert, which ends New strategy position is -1.
  • A plain SPY short entry reports no position, so it does not reverse alone.

What Nyria does with the long

  • A resting long entry is canceled, then the short opens.
  • A filled long is closed, sized from the fill.
  • Nyria never uses the broker's total position in the ticker.

If the long stays open

  • If any bot still holds the long after the close, no bot gets the short.
  • No account ends up holding both sides.
  • With Close on exit alerts off for the long, the short is not held and opens beside it.

Questions

Why didn't my short alert close my long?
Usually Short is set to Do nothing, or the alert doesn't report the flip.
What alert reverses a position?
An Order fills only alert that reports the flip, or the default text alert.
Does a plain short entry reverse a long?
No. It reports no position, so Nyria waits for the long's exit alert.
What if the exit alert never arrives?
The short is rejected, and the bot log reads held alert rejected.
Can an account hold both sides?
No. If a bot still holds the long, no bot gets the short.

Next

Try a paper bot first

No card required. Paper is free. Live trading from $15 a month.