General information
Placeholders
Pre-defined values like the alert name, side, chart and time, in scripts, notifications and conditions
It is always recommended to use testnet/sandbox first!
Three ways to use them
Placeholders are values ProfitView knows about the alert that triggered: its name, side, chart, account, run mode, the time … They work in three places:
[name]in square brackets anywhere in the script: replaced as text before the script runs, eg.id=[id]-ENTRY,[side]=10%,goto=[sym], also inside notification texts and labels.{name}in curly braces in a notification text (notify=,echo=): filled when the notification is sent, together with the fields of the order or position, see Custom Notifications.- the plain name in conditions and assignments that are evaluated when the line runs:
if=(res=60 and hour<22),set=_mins:(hour*60+minute).
Note: In a notification text the fields of the order or position come first:
{side} is the side as the exchange reports it (eg. Buy), {time} the date and time, {symbol} the symbol with the timeframe. For the placeholder values write [side], [time], [sym] in the text instead.Your own variables work the same way everywhere: local ones (_name, from preset parameters, plot data or set=), global ones ($name), and the OHLC values (open, close …) when the TradingView message sends them.
# no new entries on weekends [if weekend]exit[end] [side]=[_myRisk ?? 2]% lev=5 market sl=[-]1% id=[id]-ENTRY err=abort notify=telegram:"[id]: [side] {sym} on {tf} at {price:1}"
Calculations and fallbacks
- Calculations with
+ - * / % ^and parentheses:p=[close - 2*_atr],q=[_risk / _lev]%. In square brackets they are calculated before the run, so the values must be known when the alert fires. - In notifications the same works inside the curly braces, with
:for the number of decimals:{price-close},{_entry*1.02:1}. - Fallbacks with
??(since 1.3.110):q=[_myRisk ?? $defaultRisk ?? 1]%takes the first variable that is set (not empty), else the last value. Only the last value may be a number, calculation or quoted text:t=[_type ?? "limit"]. - Conditions before the run:
[if hour >= 22 or weekend]exit[end], or[if _x > 0] … [else] … [end], more on the Checks & Conditionals page.
Pre-defined placeholders
| Placeholder | Name | Description |
|---|---|---|
[name] [NAME] | Alert Name | The name of the PV Alert that triggered, as written or in uppercase |
[id] | Alert ID (Short Name) | The first alphanumeric part of the PV Alert name, eg. BTC5M_LONG → BTC5M. Usually names the strategy, good for order ids: id=[id]-SL |
[res] | Resolution | The resolution in minutes of the event that triggered (usually the chart), eg. 0.01 = 1 second, 60 = 1 hour |
[tf] | Timeframe | The same as a timeframe, eg. 1s, 1h |
[side] [SIDE] | Book Side | long / short or buy / sell, detected as described below (uppercase with [SIDE]) |
[!side] [!SIDE] | Opposite Side | The opposite side, eg. long for a short signal |
[+] [-] | Price Offset Sign | The sign from the view of a long: sl=[-]3% tp=[+]5% is sl=-3% tp=+5% for a long and sl=+3% tp=-5% for a short. Use it for every signed price offset (sl=, tp=, p=, so=, gt= …), also after the p prefix: sl=p[-]1% |
[ex] | Exchange Alias | The first exchange alias in the alert name, eg. Some Bybit BTCUSDT Entry → BYBIT, otherwise the exchange of the chart or the default. Useful with wildcard alert names (General Options): Foo-*-Signal fired as Foo-Bybit-BTCUSDT-Signal |
[sym] | Symbol | The part right after the exchange alias in the alert name, eg. BTCUSDT, otherwise the symbol of the chart or the default |
[acc] | Account | The account this run is for, when ap=, run= or trigger= got a list of accounts. Otherwise the part of the alert name after exchange and symbol |
[accx] | Account (empty default) | Like [acc], but empty for the default account *, eg. maxslip=$mslfor[accx] |
[accs <(ex:(sym:))filter>] | Multiple Accounts | All accounts of the exchange, optionally filtered by name: ap=[accs] (= [accs *]), ap=[accs bybit:group1*]. With a symbol it covers several exchanges at once: ap=[accs bybit:btcusd:*1],[accs bybit:btcusdt:*2]. Other placeholders go in curly braces: ap=[accs {id}*]. In a TradingView message put it in quotes, ENTRY(ap="[accs]"), and for manual runs give the exchange (ex:), since placeholders are resolved before the run |
[caller] | Caller Alert | The id of the PV Alert that started this one with run= / trigger= (otherwise the current alert) |
[this] | This Alert | The id of the running PV Alert |
[alert] | Is TV Alert | 1 if a TradingView chart alert triggered it (otherwise 0) |
[screener] | Is TV Screener | 1 if a TradingView screener alert triggered it |
[manual] | Is Manual Run | 1 if it was run manually |
[auto] | Is Interval Run | 1 if the scheduler started it (Run in Intervals) |
[internal] | Is Internal Run | 1 if another PV Alert started it with run= or trigger= |
[fork] | Is Internal Run (Fork) | 1 if another (waiting) PV Alert started it with run= |
[mode] | Run Mode | One of alert, screener, manual, auto, internal, fork |
[telebot] | Telegram Bot | The Telegram user id that triggered the alert (otherwise 0) |
[long] [short] | Is Long / Short | 1 if the detected side is long / short (otherwise 0) |
[disabled] | Is Disabled | 1 if running new alerts is disabled (global pause) |
[inst] | Instance Name | The instance name set in the General Options |
[weekend] | Is Weekend | 1 on Saturday and Sunday (otherwise 0) |
[weekday] | Day of Week | 0 to 6, 0 = Sunday |
[month] | Month | 1 to 12 |
[day] | Day of Month | 1 to 31 |
[date] | Date | Month × 100 + day, 101 to 1231 |
[hour] | Hour | 0 to 23 |
[minute] | Minute | 0 to 59 |
[time] | Time | Hour × 100 + minute, 0 to 2359 |
[barpos] | Bar Position | Where in the bar the alert fired, in % of the bar time (0–100; Once Per Bar Close is 100 or more) |
[bartime] | Bar Time | Seconds from the start of the bar to when the alert fired |
[slip] | Time Slippage | Seconds from firing to arriving in ProfitView (see Maximum time since alert fired in the General Options) |
Where the side comes from, the first match wins: a
side in the preset parameters or the plot data of the TradingView message (side:long, side:1 …), then the open position if Detect Side is on for the PV Alert (or side:auto), then the alert name: long, short, buy or sell, else one of the letters L, S, B.Up to date in the app under
Setup: Commands → Unified Alerts / Placeholders.Attention: Always double check that you are using the right syntax/alert!