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 bullish or bearish position using action=exit
:
{
"ticker": "AAPL",
"action": "exit",
}
Or you can use action=buy
or action=sell
with sentiment=flat
to close a specific bullish or bearish position. Here is an example that would only be allowed to flatten a bearish position:
{
"ticker": "AAPL",
"action": "buy",
"sentiment": "flat"
}
Or if you want to flatten a bullish position:
{
"ticker": "AAPL",
"action": "sell",
"sentiment": "flat"
}
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.