~~Title: Custom Notifications~~
{{tag>guides}}
=== Note ===
For some variables (eg. ''balance'') to be accessible you need to use the notify option together with a command (like ''updatebalance'', ''check'', ''close'' etc.)
\\
– see the "Cmd" column on the "Setup: Commands" page in PV
==== Pre-defined Variables for Custom Notifications ====
^ Variable ^ Description ^
| _count | Number of times the current command has been run |
| account | PV Account used for this command |
| alert | Current PV alert name |
| available | Available (free) balance of this account |
| balance | Balance information (free + total) of this account |
| bartime | Bar time (position in bar) when this alert was triggered |
| exchange | Exchange used for this command |
| leverage | Leverage information (set for this command or present in checked order/position) |
| price | Final price calculated (or present in checked order/position) |
| time | Current time |
| total | Total balance (equity) of this account |
**Note:** Additionally all syntax parameters (like ''q'', ''b'', ''s'' etc.) can be used and also all exchange specific fields – see the PV log when submitting orders for the corresponding field names!
==== Receive Information about an Open Position ====
check=pos notify=telegram:~~codedoc:clean:"~~{_symbol} {_side} position - entry: {_entry} - size: {_size} ({relSize}) - profit: {_profit} ({pnlTotal})~~codedoc:clean:"~~
\\
**Tip:** Check the log or the position monitor in ProfitView for all the fields that can be used in custom notifications!
\\
In addition the following built in variables are available for notifications on position check or close commands:
^ Variable ^ Description ^
| _date | Date/Time when position was opened (if supported) |
| _entry | Average entry price of the position |
| _profit | Absolute profit/loss of the position (native units/contracts) |
| _side | Side of the position - long or short |
| _size | Absolute size of the position (in native units/contracts) |
| _sizeUSD | Absolute size of the position (in USD) |
| _sizeCoin | Absolute size of the position (in "Coin"/market currency) |
| _symbol | Symbol/market of the position |
| _symbols | Symbols/markets of multiple positions (eg. ''ch=pos sym=*'') |
| pnl | PnL relative to the unleveraged margin used by the position |
| pnlLev | Same as above but taking position leverage into account\\ (multiplied by leverage) |
| pnlTotal | Current PnL in relation to total account equity\\ (use ''yield=balance'' for relation to available balance) |
| relSize | Relative size of the position in relation to total account equity\\ (use ''yield=balance'' for relation to available balance) |
=== Attention ===
Always double check that you are using the right syntax/alert!