# Close / Reverse

<figure><img src="/files/DRv3UKub8oI85jnIXnfU" alt="" width="563"><figcaption></figcaption></figure>

In a <mark style="color:green;">LONG</mark> position, the position is **closed** when a <mark style="color:red;">sell↓</mark> signal is received, for example:

```
{
  "name": "Hook 196",
  "secret": "2ehiexig0r5",
  "side": "sell",
  "symbol": "{{ticker}}"
}
```

In a <mark style="color:red;">**SHORT**</mark> position, the position is **closed** when a <mark style="color:green;">**buy↑**</mark> signal is received, for example:

```
{
  "name": "Hook 196",
  "secret": "2ehiexig0r5",
  "side": "buy",
  "symbol": "{{ticker}}"
}
```

{% hint style="warning" %}
The position will also be closed if TradingView strategy sends <mark style="color:blue;">**"positionSide": "flat"**</mark> instead of <mark style="color:green;">**long**</mark> or <mark style="color:red;">**short.**</mark>
{% endhint %}

## 1. Enabled

If enabled, upon receiving a closing signal, an order will be created to close the position.

{% hint style="warning" %}
When the left checkbox is selected, the value is sourced from TradingView signal, not the terminal settings. [Details ->](/algo-trading/signals-tradingview/controlling-an-option-in-the-signal.md)
{% endhint %}

## 2. Order type

{% content-ref url="/pages/cXejv4wxUqKYElCKBe9d" %}
[Order types](/trading/create-order-grid/order-types.md)
{% endcontent-ref %}

## 3.1 Partial position closing

Select "**Close/reverse by amount in signal**".

<figure><img src="/files/aEFjRF2digUd302zutV5" alt="" width="563"><figcaption></figcaption></figure>

By using the drop-down menu, you can select the method for calculating the closing quantity in the order.

* **Open Amount + Position Amount**

  Used for [position reversal](#3.3.-position-reversal).
* **Amount**\
  Specify the token quantity (contracts) for the created order in the right-hand field.\
  For example, if you enter <mark style="color:red;">**100**</mark> for **XRPUSDT**, an order for <mark style="color:red;">**100 XRP**</mark> will be placed.
* **Volume**\
  Order quantity (volume) is specified.\
  For example, entering <mark style="color:red;">**0.01**</mark> for **LTCBTC** pair will place an order with a volume of <mark style="color:red;">**0.01 BTC.**</mark>
* **Volume, USD**\
  Order quantity (volume) is specified in dollars.\
  For example, if <mark style="color:red;">**100**</mark> is specified for the **LTCBTC** pair, an order with a volume equivalent to <mark style="color:red;">**$100**</mark> will be created.
* **Full balance %**\
  Orders are created based on a percentage of the total balance.(wallet balance + position volume + position PnL).\
  For example, with 1000 USDT in the wallet, 2000 USDT in positions, a PnL of 100 USDT, and a specified 10% balance, the order will be created for (1000 + 2000 + 100) x 10 / 100 = <mark style="color:red;">**310 USDT.**</mark>

{% hint style="info" %}
The full balance includes all tokens in your account. For instance, if your wallet holds 100 BUSD and 100 USDT, the total balance would be 200.
{% endhint %}

* **Full Balance% х Leverage**\
  Just like in the previous example, but the obtained amount is multiplied by the leverage. From the example above, with a leverage of **5x** the order amount would be <mark style="color:red;">**1550 USDT.**</mark>
* **Free Balance, %**\
  Orders are created based on a percentage of the available balance in the specified market.\
  For example, with <mark style="color:red;">**500 USDT**</mark> in your wallet, <mark style="color:red;">**100 USDT**</mark> in positions, and a **10%** balance specification, the order will be created for an amount of (500 - 100) x 10 / 100 = <mark style="color:red;">**40 USDT.**</mark>
* **Free Balance % х Leverage**\
  Just like in the previous example, but the obtained amount is multiplied by the leverage.\
  For example, using the data from the previous item and a **7x** leverage, the order amount will be \*\*40\*7= \*\*<mark style="color:red;">**280 USDT.**</mark>
* **Position volume, %**\
  A value between <mark style="color:red;">0</mark> and <mark style="color:red;">100</mark> is specified.\
  For instance, if you specify <mark style="color:red;">50</mark>, it will partially close the position by half.\
  If you specify <mark style="color:red;">100</mark>, it will completely close the position.
* **Position volume + balance %**\
  Used for [position reversal](#3.3.-position-reversal).
* **Position volume + (balance % x leverage)**\
  Used for [position reversal](#3.3.-position-reversal).

## 3.2. Total position closing

Select "**Close position completely**".

<figure><img src="/files/UDaslkejCnEei38W80Cj" alt="" width="563"><figcaption></figcaption></figure>

## 3.3. Position reversal

{% hint style="info" %}
This option is only available for the Futures Market in one-way mode (non-hedging).
{% endhint %}

When enabled, upon receiving a closing signal, a reverse position will be created for either the signal quantity or the current position quantity.

{% hint style="warning" %}
When enabling position reversal, it is important to deactivate the hedge mode on the exchange and activate the one-way mode.
{% endhint %}

### By signal amount

When selecting this option, you can configure the amount for position reversal:

1. **Open amount + Position amount**\
   For example, if there is $**100** remaining in a position after a partial close, and the opening amount specified in the signal is $**500**, when the close signal is received, a $**600** order will be created. This order will close the current position and open a new position of $**500** in the opposite direction.
2. **Amount**\
   A reverse order will be created for the specified number of tokens (contracts). For example, if the <mark style="color:green;">LONG</mark> position in the **XRPUSDT** pair specifies **100**, it means that when a <mark style="color:red;">SELL</mark> signal is received, an order for **100 XRP** will be created to close the position.
3. **Volume**\
   A reversal order will be created for the specified amount. For example, if you have a <mark style="color:green;">LONG</mark> position in the **LTCBTC** pair and you specify **0.01**, a <mark style="color:red;">SELL</mark> signal will trigger an order to sell **0.01 BTC.**
4. **Volume, USD**\
   A reversal order will be created for the specified dollar amount. For example, if you specify **100** in the **LTCBTC** pair, an order will be created with a volume equivalent to **$100.**
5. **Balance, %**\
   A closing order will be created based on a percentage of the total balance, which includes (wallet balance + position volume + and position PnL).

   For example, with 1000 USDT in the wallet, 2000 USDT in positions, a PnL of 100 USDT, and a specified 10% balance, the order will be created for (1000 + 2000 + 100) x 10 / 100 = **310 USDT.**
6. **Balance % x Leverage**\
   Just like in the previous example, but the obtained amount is multiplied by the leverage.\
   From the example above, with a leverage of **5x** the order amount would be **1550 USDT.**
7. **Position amount, %**\
   When a signal is received, the position is closed based on the specified percentage.
8. **Position amount + balance %**\
   When a signal is received, the current position will be closed, and a new position will be opened based on a percentage of the balance.
9. **Position amount + (balance % x Leverage)**\
   When a signal is received, the current position will be closed, and a new position will be opened based on a percentage of the balance multiplied by the leverage.

### By position amount

When a signal is received, a reversal order will be created, which is equivalent to doubling the current position. This results in closing the current position and opening a new one with the same quantity.

<figure><img src="/files/caTQmvZR1zg13MHzMSyR" alt="" width="563"><figcaption></figcaption></figure>

## Limits

<figure><img src="https://t24536365.p.clickup-attachments.com/t24536365/980ff148-04d2-4d1d-9218-666aac566b1f/image.png" alt="" width="563"><figcaption></figcaption></figure>

## Check profit

If enabled, unprofitable positions will remain open when the close signal is received.

## Bulk operations

<figure><img src="https://t24536365.p.clickup-attachments.com/t24536365/89dc1a36-22d1-44d9-83f5-d84e0b8f3ca4/image.png" alt="" width="563"><figcaption></figcaption></figure>

## Close ALL positions

If this parameter is enabled and a closing signal is received, all open positions in this market will be closed based on the **Limit/Position** settings:

* **Both**\
  Will close all positions on this market.
* **Only Long**\
  Will close all Long positions on this market.
* **Only Short**\
  Will close all Short positions on this market.

If a signal is sent with "`positionSide": "flat`", then all positions on that pair in that market will be closed. For example:

```
{
  "name": "Hook 72767",
  "secret": "dy2uuc5bih8",
  "side": "buy",
  "symbol": "XRPUSDT",
  "positionSide": "flat"
}
```

## Controlling options in the signal

{% content-ref url="/pages/OH8dyhZgmziplkK5VdCm" %}
[Controlling an option in the signal](/algo-trading/signals-tradingview/controlling-an-option-in-the-signal.md)
{% endcontent-ref %}

**Do you have any questions? We can help you in our Telegram chat room.**

{% embed url="<https://t.me/finandy>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.finandy.com/algo-trading/signals-tradingview/interface/close.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
