> ## Documentation Index
> Fetch the complete documentation index at: https://docs.luxalgo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Placeholders

Placeholders are strings that refer to a specific series of values or events, and have the form `{placeholder_title}`, where `placeholder_title` is the name of the placeholder to access and `{}` makes sure the string is recognized as a placeholder.

With scripted strategies, placeholders allow accessing market data such as ohlc prices, volume, but also strategy data such as net profit, winrate, entry prices...etc.

## Market Data Placeholders

Market data placeholder allows referencing typical market data such as ohlc prices and volume.

These placeholders are available for all toolkits.

| Placeholder | Description                                                   |
| ----------- | ------------------------------------------------------------- |
| `{open}`    | Open price of the bar                                         |
| `{high}`    | High price of the bar                                         |
| `{low}`     | Low price of the bar                                          |
| `{close}`   | Close price of the bar                                        |
| `{hl2}`     | Median price `(high + low) / 2`                               |
| `{ohlc4}`   | Average price `(open + high + low + close) / 4`               |
| `{hlc3}`    | Typical price `(high + low + close) / 3`                      |
| `{hlcc4}`   | Weighted average of hlc prices `(high + low + 2 * close) / 4` |
| `{volume}`  | Volume for the bar                                            |
| `{range}`   | Difference between High and Low prices                        |
| `{tr}`      | True Range                                                    |

## Time Related Placeholders

Time placeholder allows referencing time related information such as the bar hour and minute, day, bar index...etc.

These placeholders are available for all toolkits.

| Placeholder                   | Description                                                                                                                                                   |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `{barindex}`                  | Index of the current bar                                                                                                                                      |
| `{last_barindex}`             | Index of the most recent bar                                                                                                                                  |
| `{second}`                    | Current bar second                                                                                                                                            |
| `{minute}`                    | Current bar minute                                                                                                                                            |
| `{hour}`                      | Current bar hour                                                                                                                                              |
| `{dayofweek}`                 | Current bar day of the week ranging from 1 to 7, with 1 for sunday                                                                                            |
| `{dayofmonth}`                | Current bar day of the month                                                                                                                                  |
| `{weekofyear}`                | Current bar week of the year                                                                                                                                  |
| `{month}`                     | Current bar month of the year                                                                                                                                 |
| `{year}`                      | Current bar year (with timezone)                                                                                                                              |
| `{time}`                      | Unix timestamp of the bar                                                                                                                                     |
| `{unix_ts}`                   | Unix timestamp of the bar (Deprecated, use `{time}`)                                                                                                          |
| `{timeframe}`                 | Chart timeframe in minutes                                                                                                                                    |
| `{hhmm-hhmm}`                 | Session placeholder, `True` when the bar is located within the specific session interval, see [here](./placeholders#session-placeholder) for more information |
| `{YYYY-MM-DDThh:mm:ss±hh:mm}` | Datestring placeholder, equal to the timestamp of the specified date, see [here](./placeholders#datestring-placeholder) for more information                  |

<Note>
  Note that `{dayofweek}` returns the day based on the time of the bar's open. For overnight sessions (e.g. EURUSD, where Monday session starts on Sunday, 17:00) this value can be lower by 1 than the day of the trading day.
</Note>

The timezone for the time related placeholders (with the exception of `time`, and the datestring placeholder) is defined by the `Timezone` dropdown setting, defining the timezone using UTC. Default value is `exchange`, which uses the exchange timezones to get the value of the time related placeholders.

### Datestring Placeholder

You can easily define dates and optionally th time and timezone using the **Datestring** placeholder, following the ISO 8601 standard. The syntax of the placeholder is as follows:

```code Example theme={null}
{YYYY-MM-DDThh:mm:ss±hh:mm}
```

* `YYYY`: Year
* `MM`: Month
* `DD`: Day
* `hh`: Hour
* `mm`: Minute
* `±hh:mm`: Timezone offset, default timezone is UTC-0 (optional)

<Note>
  The **Datestring** placeholder is not affected by the **Timezone** setting
</Note>

This placeholder can be useful alongside `{time}` to constraint the evaluation of conditions to a specific date interval. For example:

```code Example theme={null}
{close} > {open} and {time} >= {2025-01-01}
```

The above script will only trigger if the closing price is above the opening price while the time is on or after January 1st, 2025.

Dates and times are separated by `T`, for example `{2025-01-01T04:00}`. `±hh:mm` can be used to offset the timezones, as such if the timezone of interest is the New York timezone (UTC-4), we would use:

```code Example theme={null}
{2025-01-01T04:00-04:00}
```

### Session Placeholder

You can easily detect if the current bar is within a specific session (time interval) by using the session placeholder with pattern `{hhmm-hhmm}`, where `hh` is the hour and `mm` the minute.

The value of this placeholder will be `True` when the bar time is located between the start time `{hhmm-` and end time `-hhmm}`.

For example, if we want to detect when the bar is located in the session starting at 14:30 and ending at 16:45 we would simply use:

```python Example theme={null}
{1430-1645}
```

## Strategy Statistics Placeholders

It is possible to use the actual strategy results made over time as part of our entry or exit conditions using the following data placeholders:

| Placeholder              | Description                                 |
| ------------------------ | ------------------------------------------- |
| `{entry_price}`          | Average entry price of the current position |
| `{net_profit}`           | Total net profit from all closed trades     |
| `{equity}`               | Current equity including open trades        |
| `{open_profit}`          | Unrealized profit/loss of open trades       |
| `{gross_profit}`         | Total gross profit from winning trades      |
| `{gross_loss}`           | Total gross loss from losing trades         |
| `{gross_profit_percent}` | Gross profit expressed as a percentage      |
| `{gross_loss_percent}`   | Gross loss expressed as a percentage        |
| `{profit_factor}`        | Ratio of gross profit to gross loss         |
| `{winrate}`              | Percentage of closed trades that were wins  |
| `{closed_trades}`        | Number of closed trades                     |
| `{open_trades}`          | Number of currently open trades             |
| `{win_trades}`           | Number of winning closed trades             |
| `{loss_trades}`          | Number of losing closed trades              |
| `{avg_trade}`            | Average profit/loss per trade               |
| `{avg_winning_trade}`    | Average profit of winning trades            |
| `{avg_losing_trade}`     | Average loss of losing trades               |
| `{max_drawdown}`         | Maximum drawdown in account value           |
| `{max_drawdown_percent}` | Max drawdown expressed as a percentage      |
| `{max_runup}`            | Maximum runup in account value              |
| `{max_runup_percent}`    | Max runup expressed as a percentage         |
| `{position_size}`        | Current position size                       |

## External Placeholders

<img src="https://mintcdn.com/luxalgo/0Jdje6xa5PGD9ypH/public/images/alert-scripting/placeholders/external.png?fit=max&auto=format&n=0Jdje6xa5PGD9ypH&q=85&s=e235700ba423bf368122da7b7c6ea1ec" alt="" width="543" height="392" data-path="public/images/alert-scripting/placeholders/external.png" />

Users can refer to a series of values outside the toolkit by using external placeholder. A maximum of 3 external placeholders can be used:

* `{external1}`
* `{external2}`
* `{external3}`

In order to use external placeholders, users must first select the external source from the provided dropdowns located in the Strategy Scripting settings. Once selected, external sources can be referred from their respective placeholders.

## User Defined Placeholders (UDP)

User defined placeholders (UDPs) are custom placeholders defined by users and assigned to a specific condition set by the user. These placeholders can later be referenced as part of other conditions or UDPs.

To define an UDP a line must start with a placeholder with a unique name, followed by an equal sign `=`, then followed by the condition we want to assign to this placeholder, for example `{my_placeholder} = {close} > {open}`

Let's take a more complex example and say we want to go long on a new bullish fair value gap while we also had one on the previous bar.

Doing this could involve a long and messy script, to make things easier we can create an UDP that refers to the condition of a bullish fair value gaps:

```
{bull_fvg} = {low} > {high[2]} and {close[1]} > {high[2]}
@long() = {bull_fvg} and {bull_fvg[1]}
```

## Backtester Trigger Placeholders

The trigger placeholders below are unique to their respective Backtesters, and refer to their respective features.

### Backtester (S\&O) Trigger Placeholders

| Placeholder                    | Description                                                                   |
| ------------------------------ | ----------------------------------------------------------------------------- |
| `{bullish_confirmation}`       | `True` on a new normal bullish confirmation signal                            |
| `{bullish_confirmation+}`      | `True` on a new strong bullish confirmation signal                            |
| `{bullish_confirmation_any}`   | `True` on a any new bullish confirmation signal                               |
| `{bullish_confirmation_turn+}` | `True` when a normal bullish confirmation signal turns strong                 |
| `{bearish_confirmation}`       | `True` on a new normal bearish confirmation signal                            |
| `{bearish_confirmation+}`      | `True` on a new strong bearish confirmation signal                            |
| `{bearish_confirmation_any}`   | `True` on any new bearish confirmation signal                                 |
| `{bearish_confirmation_turn+}` | `True` when a normal bearish confirmation signal turns strong                 |
| `{bullish_contrarian}`         | `True` on a new normal bullish contrarian signal                              |
| `{bullish_contrarian+}`        | `True` on a new strong bullish contrarian signal                              |
| `{bullish_contrarian_any}`     | `True` on any new bullish contrarian signal                                   |
| `{bearish_contrarian}`         | `True` on a new normal bearish contrarian signal                              |
| `{bearish_contrarian+}`        | `True` on a new strong bearish contrarian signal                              |
| `{bearish_contrarian_any}`     | `True` on any new bearish contrarian signal                                   |
| `{confirmation_exits}`         | `True` on a new exit buy or sell confirmation signal                          |
| `{contrarian_exits}`           | `True` on a new exit buy or sell contrarian signal                            |
| `{exit_sell}`                  | `True` on a new exit sell signal                                              |
| `{bullish_smart_trail}`        | `True` if Smart Trail is up-trending                                          |
| `{bearish_smart_trail}`        | `True` if Smart Trail is down-trending                                        |
| `{switch_bullish_smart_trail}` | `True` if Smart Trail switches to bullish                                     |
| `{switch_bearish_smart_trail}` | `True` if Smart Trail switches to bearish                                     |
| `{price_above_rzr1}`           | `True` if the closing price is above the lower Reversal Zones resistance R1   |
| `{price_below_rzs1}`           | `True` if the closing price is below the upper Reversal Zones support S1      |
| `{price_co_rzr1}`              | `True` if the closing price cross over the lower Reversal Zones resistance R1 |
| `{price_cu_rzs1}`              | `True` if the closing price cross under the upper Reversal Zones support S1   |
| `{bullish_catcher}`            | `True` if Trend Catcher is up-trending                                        |
| `{bearish_catcher}`            | `True` if Trend Catcher is down-trending                                      |
| `{switch_bullish_catcher}`     | `True` if Trend Catcher switches to bullish                                   |
| `{switch_bearish_catcher}`     | `True` if Trend Catcher switches to bearish                                   |
| `{bullish_tracer}`             | `True` if Trend Tracer is up-trending                                         |
| `{bearish_tracer}`             | `True` if Trend Tracer is down-trending                                       |
| `{switch_bullish_tracer}`      | `True` if Trend Tracer switches to bullish                                    |
| `{switch_bearish_tracer}`      | `True` if Trend Tracer switches to bearish                                    |
| `{bullish_neo}`                | `True` if Neo Cloud is up-trending                                            |
| `{bearish_neo}`                | `True` if Neo Cloud is down-trending                                          |
| `{switch_bullish_neo}`         | `True` if Neo Cloud switches to bullish                                       |
| `{switch_bearish_neo}`         | `True` if Neo Cloud switches to bearish                                       |
| `{confirmation_uptrend}`       | `True` when confirmation signal indicates an uptrend                          |
| `{confirmation_downtrend}`     | `True` when confirmation signal indicates a downtrend                         |
| `{contrarian_uptrend}`         | `True` when contrarian signal indicates an uptrend                            |
| `{contrarian_downtrend}`       | `True` when contrarian signal indicates a downtrend                           |
| `{trend_strength_trending}`    | `True` when trend strength indicates a trending market (above 50)             |
| `{trend_strength_ranging}`     | `True` when trend strength indicates a ranging market (under 50)              |
| `{confirmation_exits}`         | `True` when confirmation-based exit condition is met                          |
| `{contrarian_exits}`           | `True` when contrarian-based exit condition is met                            |
| `{price_cross_rz_avg}`         | `True` when price crosses the average of The Reversal Zones                   |

### Backtester (PAC) Trigger Placeholders

| Placeholder                 | Description                                               |
| --------------------------- | --------------------------------------------------------- |
| `{bullish_choch}`           | `True` when a bullish Change of Character (CHoCH) occurs  |
| `{bearish_choch}`           | `True` when a bearish Change of Character (CHoCH) occurs  |
| `{bullish_bos}`             | `True` when a bullish Break of Structure (BOS) occurs     |
| `{bearish_bos}`             | `True` when a bearish Break of Structure (BOS) occurs     |
| `{bullish_trend}`           | `True` when market structure trend is bullish             |
| `{bearish_trend}`           | `True` when market structure trend is bearish             |
| `{bullish_ob_exited}`       | `True` when price exits a bullish order block             |
| `{bearish_ob_exited}`       | `True` when price exits a bearish order block             |
| `{bullish_new_fvg}`         | `True` on detection of a new bullish Fair Value Gap (FVG) |
| `{bearish_new_fvg}`         | `True` on detection of a new bearish Fair Value Gap (FVG) |
| `{bullish_fvg_mitigated}`   | `True` when bullish FVG is mitigated                      |
| `{bearish_fvg_mitigated}`   | `True` when bearish FVG is mitigated                      |
| `{bullish_fvg_entered}`     | `True` when price enters bullish FVG                      |
| `{bearish_fvg_entered}`     | `True` when price enters bearish FVG                      |
| `{bullish_fvg_within}`      | `True` when price is within bullish FVG                   |
| `{bearish_fvg_within}`      | `True` when price is within bearish FVG                   |
| `{bullish_fvg_exited}`      | `True` when price exits bullish FVG                       |
| `{bearish_fvg_exited}`      | `True` when price exits bearish FVG                       |
| `{bullish_new_ifvg}`        | `True` on detection of a new bullish Inverse FVG          |
| `{bearish_new_ifvg}`        | `True` on detection of a new bearish Inverse FVG          |
| `{bullish_ifvg_mitigated}`  | `True` when bullish Inverse FVG is mitigated              |
| `{bearish_ifvg_mitigated}`  | `True` when bearish Inverse FVG is mitigated              |
| `{bullish_ifvg_entered}`    | `True` when price enters bullish Inverse FVG              |
| `{bearish_ifvg_entered}`    | `True` when price enters bearish Inverse FVG              |
| `{bullish_ifvg_within}`     | `True` when price is within bullish Inverse FVG           |
| `{bearish_ifvg_within}`     | `True` when price is within bearish Inverse FVG           |
| `{bullish_ifvg_exited}`     | `True` when price exits bullish Inverse FVG               |
| `{bearish_ifvg_exited}`     | `True` when price exits bearish Inverse FVG               |
| `{bullish_new_dfvg}`        | `True` on detection of a new bullish Double FVG           |
| `{bearish_new_dfvg}`        | `True` on detection of a new bearish Double FVG           |
| `{bullish_dfvg_mitigated}`  | `True` when bullish Double FVG is mitigated               |
| `{bearish_dfvg_mitigated}`  | `True` when bearish Double FVG is mitigated               |
| `{bullish_dfvg_entered}`    | `True` when price enters bullish Double FVG               |
| `{bearish_dfvg_entered}`    | `True` when price enters bearish Double FVG               |
| `{bullish_dfvg_within}`     | `True` when price is within bullish Double FVG            |
| `{bearish_dfvg_within}`     | `True` when price is within bearish Double FVG            |
| `{bullish_dfvg_exited}`     | `True` when price exits bullish Double FVG                |
| `{bearish_dfvg_exited}`     | `True` when price exits bearish Double FVG                |
| `{bullish_new_vi}`          | `True` on detection of a new bullish Volume Imbalance     |
| `{bearish_new_vi}`          | `True` on detection of a new bearish Volume Imbalance     |
| `{bullish_vi_mitigated}`    | `True` when bullish Volume Imbalance is mitigated         |
| `{bearish_vi_mitigated}`    | `True` when bearish Volume Imbalance is mitigated         |
| `{bullish_vi_entered}`      | `True` when price enters bullish Volume Imbalance         |
| `{bearish_vi_entered}`      | `True` when price enters bearish Volume Imbalance         |
| `{bullish_vi_within}`       | `True` when price is within bullish Volume Imbalance      |
| `{bearish_vi_within}`       | `True` when price is within bearish Volume Imbalance      |
| `{bullish_vi_exited}`       | `True` when price exits bullish Volume Imbalance          |
| `{bearish_vi_exited}`       | `True` when price exits bearish Volume Imbalance          |
| `{bullish_new_og}`          | `True` on detection of a new bullish Opening Gap          |
| `{bearish_new_og}`          | `True` on detection of a new bearish Opening Gap          |
| `{bullish_og_mitigated}`    | `True` when bullish Opening Gap is mitigated              |
| `{bearish_og_mitigated}`    | `True` when bearish Opening Gap is mitigated              |
| `{bullish_og_entered}`      | `True` when price enters bullish Opening Gap              |
| `{bearish_og_entered}`      | `True` when price enters bearish Opening Gap              |
| `{bullish_og_within}`       | `True` when price is within bullish Opening Gap           |
| `{bearish_og_within}`       | `True` when price is within bearish Opening Gap           |
| `{bullish_og_exited}`       | `True` when price exits bullish Opening Gap               |
| `{bearish_og_exited}`       | `True` when price exits bearish Opening Gap               |
| `{bullish_liquidity_grab}`  | `True` on detection of a bullish liquidity grab           |
| `{bearish_liquidity_grab}`  | `True` on detection of a bearish liquidity grab           |
| `{bullish_trendline_break}` | `True` on a bullish trendline break                       |
| `{bearish_trendline_break}` | `True` on a bearish trendline break                       |

### Backtester (OSC) Trigger Placeholders

| Placeholder                             | Description                                         |
| --------------------------------------- | --------------------------------------------------- |
| `{regular_bullish_hyperwave_signal}`    | `True` on a new regular bullish HyperWave signal    |
| `{regular_bearish_hyperwave_signal}`    | `True` on a new regular bearish HyperWave signal    |
| `{oversold_bullish_hyperwave_signal}`   | `True` on a new oversold bullish HyperWave signal   |
| `{overbought_bearish_hyperwave_signal}` | `True` on a new overbought bearish HyperWave signal |
| `{hyperwave_co_80}`                     | `True` when HyperWave crosses over 80               |
| `{hyperwave_cu_20}`                     | `True` when HyperWave crosses under 20              |
| `{hyperwave_co_50}`                     | `True` when HyperWave crosses over 50               |
| `{hyperwave_cu_50}`                     | `True` when HyperWave crosses under 50              |
| `{hyperwave_above_80}`                  | `True` when HyperWave is above 80                   |
| `{hyperwave_below_20}`                  | `True` when HyperWave is below 20                   |
| `{hyperwave_above_50}`                  | `True` when HyperWave is above 50                   |
| `{hyperwave_below_50}`                  | `True` when HyperWave is below 50                   |
| `{moneyflow_co_50}`                     | `True` when Money Flow crosses over 50              |
| `{moneyflow_cu_50}`                     | `True` when Money Flow crosses under 50             |
| `{moneyflow_above_50}`                  | `True` when Money Flow is above 50                  |
| `{moneyflow_below_50}`                  | `True` when Money Flow is below 50                  |
| `{new_bullish_overflow}`                | `True` on a new bullish Overflow signal             |
| `{new_bearish_overflow}`                | `True` on a new bearish Overflow signal             |
| `{bullish_overflow}`                    | `True` if bullish Overflow is active                |
| `{bearish_overflow}`                    | `True` if bearish Overflow is active                |
| `{reversal_any_up}`                     | `True` on any new bullish reversal signal           |
| `{reversal_any_down}`                   | `True` on any new bearish reversal signal           |
| `{bullish_divergence}`                  | `True` on a new bullish divergence                  |
| `{bearish_divergence}`                  | `True` on a new bearish divergence                  |
| `{weak_bullish_confluence}`             | `True` on a new weak bullish confluence             |
| `{weak_bearish_confluence}`             | `True` on a new weak bearish confluence             |
| `{strong_bullish_confluence}`           | `True` on a new strong bullish confluence           |
| `{strong_bearish_confluence}`           | `True` on a new strong bearish confluence           |
