Custom formulas for filtering
One might want to use this technique when monitoring multiple accounts for risk conditions, and filter a view to just those accounts that meet the condition.
- Have both the Account Summary and the new Formulas widget open
- Create a new formula by hitting the + button in the toolbar, the Formula dialog will open.
- Give your formula a name
- Use the prefix "account." for different account values and simple math operators to construct a formula
- In this example, we are creating a filter to show accounts with a negative balance
- To use the formula as a filter, check the "Condition" box
- Save the formula
- Go to the filters menu in the Account Summary view and choose the filter you just created
Custom formulas for custom columns
One might want to use this technique to create a column to display some risk algorithm that indicates when accounts might be getting into trouble.
- From the task menu, or from the +Column tab in the Column manager dialog, create a new formula, the formula dialog will open.
- Give your formula a name
- Use the prefix "account." for different account values and simple math operators to construct a formula
- In this example, we are creating a column showing purchasing power minus margin, shown as a percentage
- Save the formula
- Because we started the formula from the +Column tab, once the formula was saved it was added to the "In window" tab
Here are two tables detailing common uses of this functionality: The first table groups the Formula Fields, and the second table lists the Formula Fields in alphabetical order.
For a more comprehensive presentation, download the pdf CQG_Account_Alert_Formula_Reference-1. This document was assisted by AI and reviewed by Jim Stavros.
Available Account Formula Fields
| Category | Formula Field | Definition |
|---|---|---|
| Core Account Values | account.currentBalance | Account balance (cash balance in the account) |
| account.nlv | Net Liquidation Value (total value of the account including positions) | |
| account.ote | Open Trade Equity (unrealized P&L for futures positions) | |
| account.mvo | Market Value of Options (value of option positions) | |
| account.upl | Unrealized Profit/Loss (specifically for options) | |
| account.pl or account.profit_loss | Profit/Loss | |
| account.collateral | Collateral on Deposit | |
| Margin Related Fields | account.margin or account.margin_value | Total margin value/requirement |
| account.margin_excess | Margin Excess (calculated as: purchasing power - total margin value) | |
| account.purchasing_power | Purchasing Power (calculated as: balance + MVO + OTE) | |
| account.margin_credit | Margin Credit | |
| account.cash_excess | Cash Excess | |
| Calculated Values | account.ote_pl | OTE + P/L combined |
Key Definitions
| Term | Definition |
|---|---|
| Purchasing Power | Balance + MVO + OTE |
| Margin Excess | Purchasing Power - Total Margin Value |
| NLV (Net Liquidation Value) | Total account value including all positions |
| OTE (Open Trade Equity) | Unrealized profit/loss on futures positions |
| MVO (Market Value of Options) | Current market value of option positions |
| UPL (Unrealized Profit/Loss) | Specifically for options |
Notes:
- Values that change in real time include Balance, OTE, P/L, UPL, MVO, and NLV.
- Margin data is refreshed automatically when updated by your broker.
- Some values may display "N/A" when margin data is unavailable or when the margin subsystem is disabled for the account.
Account Value in Alphabetical Order
| Account Value in Alphabetical Order | Simple Explanation |
|---|---|
| account.cashExcess | Cash available above the amount required for margin. Think of it as your extra cash cushion. |
| account.currentBalance | Your current account balance. Basically, the cash amount currently recorded in the account. |
| account.longOpenPositionsQty | The total quantity of long positions currently open — trades where you expect the price to rise. |
| account.margin | The amount of margin currently required to support your open positions. |
| account.marginCredit | A credit applied toward your margin requirement, depending on the broker/account setup. |
| account.marginExcess | The amount of margin you have available above the required margin. It represents your margin safety cushion. |
| account.minDaysTillPositionContractExpiration | The minimum number of days until one of your open contracts expires. |
| account.mvo | Market Value of Open positions — the current market value of your open positions. |
| account.netChangePercent | The percentage change in your account value, usually compared with a previous/reference value. |
| account.netLiquidationValuePercent | Net Liquidation Value expressed as a percentage, usually relative to a reference value. |
| account.noMultiplierPositionMargin | Position margin before applying the contract multiplier. Useful for seeing the underlying margin calculation. |
| account.openTradeLossUnrealizedLoss | The current unrealized loss from open trades. The loss isn't final until the position is closed. |
| account.oteUpl | Open Trade Equity / Unrealized P&L — the current profit or loss from positions that are still open. |
| account.oteUplAndPl | Unrealized P&L + realized P&L. Combines open-trade results with profit/loss from completed trades. |
| account.positionMargin | The margin required for your current positions. This is collateral tied up to support the trades. |
| account.profitLoss | Your profit or loss. Positive means profit; negative means loss. |
| account.purchasingPower | The amount you can potentially use to open new positions, based on your available funds and leverage. |
| account.shortOpenPositionsQty | The total quantity of short positions currently open — trades where you expect the price to fall. |
| account.totalFilledQty | The total quantity of orders that have been successfully executed/filled. |
| account.upl | Unrealized Profit/Loss — the current profit or loss on positions that are still open. |
| account.yesterdayBalance | Your account balance at the end of the previous trading day. |
| account.yesterdayCollateral | The collateral held or required yesterday to support your trading positions. |
| account.yesterdayMvo | Market Value of Open positions yesterday — the value of your open positions at the previous day's reference point. |
| account.yesterdayNetLiquidationValue | Your Net Liquidation Value yesterday — approximately what your account was worth if positions were closed at that time. |
| account.yesterdayOldestMarginCallAgeDays | How many days old your oldest outstanding margin call was as of yesterday. |
| account.yesterdayOte | Yesterday's Open Trade Equity — the unrealized profit/loss on positions that were open at that time. |
| account.yesterdayTotalOutstandingMarginCalls | The outstanding margin calls from yesterday. A margin call means additional funds/collateral may have been required. |
AI was used for this table.