← Todos los ejemplos
Ejemplo 28
Trigger time report
the script of a Time Trigger Line: when the market clock reaches the
- Categoría
- Espacio de trabajo: lee o cambia gráficos y paneles
- Permisos
- workspace.read
- Antes de ejecutarlo
- set as the script of a Time Trigger Line, with
- Qué hace
- none (read-only)
- Cómo ejecutarlo
- place a Time Trigger Line, open its properties, Trigger page:
- Lenguaje
>=0.1.1, <0.2.0- Host
>=0.1.5, <0.2.0- Necesita
- workspace >=0.1.1, <0.2.0event >=0.1.0, <0.2.0
Código
// Purpose: the script of a Time Trigger Line: when the market clock reaches the // line, report the workspace — what it is looking at when that time comes. // Category: workspace // Permissions: workspace.read // Preconditions: set as the script of a Time Trigger Line, with // workspace.read ticked on its Trigger page // Side effects: none (read-only) // Run: place a Time Trigger Line, open its properties, Trigger page: // Choose… this file, tick workspace.read, and set it to fire in Replay or // Both to watch it arrive in a replay. lang ">=0.1.1, <0.2.0"; host "ttt" ">=0.1.5, <0.2.0"; requires "workspace" ">=0.1.1, <0.2.0"; requires "event" ">=0.1.0, <0.2.0"; fn main() { let e = event.current(); print("the clock reached the line (" + e.kind + ") at " + to_string(e.time)); match e.price { Some(p) => print("the price then: " + to_string(p)), None => print("no price was known"), } for c in workspace.charts() { print(c.symbol + " " + c.timeframe); } }