Perform calculations in an interactive programming environment.
The Calculator is a scratchpad for writing and executing HHLang code with immediate results — like a REPL or interactive notebook. Variables you define persist across lines within the same session, making it easy to build up complex calculations step by step.
AAPL.close().last()) and press Enter.The code editor is the main input area for writing HHLang code. Press Ctrl+E to focus the editor from anywhere in the window.
The results panel shows calculation results in a scrolling list. Each executed expression displays its result inline, updating in real-time as you type.
This panel displays all variables currently in scope with their live values. It is useful for debugging — you can inspect intermediate values without adding print statements.
The log panel shows execution logs, warnings, and errors. Error messages are highlighted for easy identification. Check this panel when an expression produces unexpected results.
The "value on date" setting controls what date time-sensitive metrics use when computing values. Adjust this in the ribbon to evaluate expressions as of a specific date.
| Shortcut | Action |
|---|---|
| Ctrl+E | Focus the code editor. |
| Ctrl+G | Clear all code and results. |
| Enter | Execute the current expression. |
// Look up an instrument's closing price
TimeSeries price = AAPL.close()
// Get the most recent value
Double lastPrice = price.last()
// Compute a 20-day simple moving average
TimeSeries sma = price.sma(20)
// Check if price is above the moving average
Boolean aboveSma = lastPrice > sma.last()
// Calculate daily returns
TimeSeries returns = (price - price.lag(1)) / price.lag(1)