Close Syntax

Create an alert message with instructions to close positions.

๐Ÿ“ Basic Rules

  • Use Key=Value to set up instructions. Multiple keys can be separated by commas (,).
  • Spacing around keys, values, or between multiple keys is not important.
  • Keys are case-insensitive โ€” upper or lower case does not matter.
  • The order of Key=Value pairs is not important. You can arrange them in any order.
  • Each action requires mandatory keys to be considered valid.
  • Optional keys can be included to provide additional settings or data.
  • Keys that are not supported by the action will be ignored.
  • Maximum message length is 512 characters.

๐Ÿ”‘ Supported Keys

KeyValuesExampleDescription
action*Closeaction=CloseClose action
sizeVolume, % Positionsize=1; size=30%Size to close
ticketnumberticket=4974331881Ticket filter
typeLong, Shorttype=Long; type=ShortPosition type filter
symboltextsymbol=GBPUSDPosition symbol filter
profitparam numbersprofit=100:500; profit=*:500; profit=100:*Position profit filter

Notes:

  • Keys that marked with * are mandatory keys
  • Missing any of mandatory keys will make the message invalid

๐Ÿ’ก Explanation


action

Use this key to define the trade action you want to perform. This is mandatory key.
For closing positions, use action=Close


size

Use this key to define the the close size of position.

You can specify the close size in two units:

  • Fixed lot size
  • Percentage of Position

Detailed as below:

1. Fixed lot size

Use a number without sign suffix to set fixed lot size.

action=Close, size=0.1

๐Ÿ‘‰๐Ÿป Result: All open positions will be closed with a volume of 0.1 lots each.


2. Percentage of Position

Use a number with percent sign (%) suffix to use account percentage lot size.

action=Close, size=50%

๐Ÿ‘‰๐Ÿป Result: All open positions will be closed at 50% of their position size.


ticket

Use this key to filter positions by ticket.

When ticket is used, don't use other filters as it has no meaning.

action=Close, ticket=4974331881

๐Ÿ‘‰๐Ÿป Result: The position with ticket number = 4974331881 will be closed.


type

Use this key to filter positions by type.

Valid type values are as below:

  • Long โ€” Long positions
  • Short โ€” Short positions
action=Close, type=Long

๐Ÿ‘‰๐Ÿป Result: All Long positions wil be closed.


symbol

Use this key to filter positions by symbol.

Our symbol-mapping feature helps you here in some cases. For more details, please read in Buy/Sell syntax

action=Close, symbol=EURUSD

๐Ÿ‘‰๐Ÿป Result: All positions for the EURUSD symbol will be closed.


profit

Use this key to filter positions by profit. Specify the range as MinProfit:MaxProfit

Notes:

  • Use * as the placeholder for MinProfit if you want no minimum limit. For example: profit=*:500
  • Use * as the placeholder for MaxProfit if you want no maximum limit. For example: profit=100:*

๐Ÿ†— Examples

Example #1

action=close, size=1, ticket=4974331881

Explanation

  • Close 1 lot of positions
  • Process on position ticket = 4974331881

Example #2

action=close, size=50%, type=long, profit=100:500

Explanation

  • Close 50% of positions
  • Process on all symbols with type is Long
  • Position profit must be between 100 and 500

Example #3

action=close, size=100%, symbol=EURUSD, type=short, profit=30:*

Explanation

  • Close 100% of positions
  • Process on EURUSD symbol with type is Short
  • Position profit must be more than 30