It is always recommended to use testnet/sandbox first!
Pre-defined Variables for Custom Notifications
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| 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!Calculations, placeholders and conditions
The fields can be calculated right in the text, with + - * / % ^ and parentheses: {price-close} is the distance of the order price to the candle close (when the TradingView message sends the OHLC values). : sets the number of decimals, {price/2:3} gives eg. 12345.123.
All placeholders and variables are fields as well: {tf}, {id}, {hour}, a plot value {_myplot}, a global variable {$count}. The same names work in the conditions and assignments of a line, eg. if=(res=60 and _myplot>100):
check=pos notify=log:"{_symbol} {_side} ({tf} chart, alert {id}): entry {_entry}, 2% above is {_entry*1.02:1}, PnL {pnl}" check=pos if=(res=60 and hour<22) notify=log:"hourly chart, before 22:00: {_side} {_size} {_symbol}"
Note: In
{…} the fields of the order or position come first, also when a placeholder has the same name: {side} is the side as the exchange reports it (eg. Buy / Sell), {time} the current date and time, {symbol} the symbol with the timeframe. For the placeholder values use square brackets in the text, [side], [time], [sym]: they are replaced before the script runs.Receive Information about an Open Position
check=pos notify=telegram:"{_symbol} {_side} position - entry: {_entry} - size: {_size} ({relSize}) - profit: {_profit} ({pnlTotal})"
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!