Notifications

Custom Notifications

Information about an Open Position etc.

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
VariableDescription
_countNumber of times the current command has been run
accountPV Account used for this command
alertCurrent PV alert name
availableAvailable (free) balance of this account
balanceBalance information (free + total) of this account
bartimeBar time (position in bar) when this alert was triggered
exchangeExchange used for this command
leverageLeverage information (set for this command or present in checked order/position)
priceFinal price calculated (or present in checked order/position)
timeCurrent time
totalTotal 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:
VariableDescription
_dateDate/Time when position was opened (if supported)
_entryAverage entry price of the position
_profitAbsolute profit/loss of the position (native units/contracts)
_sideSide of the position - long or short
_sizeAbsolute size of the position (in native units/contracts)
_sizeUSDAbsolute size of the position (in USD)
_sizeCoinAbsolute size of the position (in “Coin”/market currency)
_symbolSymbol/market of the position
_symbolsSymbols/markets of multiple positions (eg. ch=pos sym=*)
pnlPnL relative to the unleveraged margin used by the position
pnlLevSame as above but taking position leverage into account (multiplied by leverage)
pnlTotalCurrent PnL in relation to total account equity (use yield=balance for relation to available balance)
relSizeRelative 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!