Strategy Message

Close Open Position

Exit {{ openPositionSide }} {{ openPositionSymbol }} position.

This message indicates that TradersPost has detected an open position for the specified ticker in the webhook. Consequently, an exit order will be sent to the broker to close this position.

You can close any open long or short position using action=exit:

{
    "ticker": "AAPL",
    "action": "exit",
}

Or you can use action=buy or action=sell with sentiment=flat to close a specific long or short position. Here is an example that would only be allowed to flatten a short position:

{
    "ticker": "AAPL",
    "action": "buy",
    "sentiment": "flat"
}

Or if you want to flatten a long position:

{
    "ticker": "AAPL",
    "action": "sell",
    "sentiment": "flat"
}

To close the current position and open a position on the opposite side in one step, use action=reverse.

The sentiment field is also useful for compatibility with TradingView strategies so you can use their variable values directly in the webhook message JSON. Here is an example of a webhook JSON message that would close a position based on the TradingView strategy's order action and market position:

{
    "ticker": "{{ticker}}",
    "action": "{{strategy.order.action}}",
    "sentiment": "{{strategy.market_position}}",
}

The variables above are placeholders for the TradingView strategy's order action and market position. The webhook message will be replaced with the actual values when the alert is triggered.

Start trading at scale today. Sign up for free.

Free 7-day trial

Set-up in 3 minutes

Paper account for testing

Start now