本文へ移動
← すべてのサンプル

サンプル 28

Trigger time report

the script of a Time Trigger Line: when the market clock reaches the

カテゴリ
Workspace:チャートやパネルを読む・変更する
権限
workspace.read
実行する前に
set as the script of a Time Trigger Line, with
何をするか
none (read-only)
実行方法
place a Time Trigger Line, open its properties, Trigger page:
言語
>=0.1.1, <0.2.0
ホスト
>=0.1.5, <0.2.0
必要なもの
workspace >=0.1.1, <0.2.0event >=0.1.0, <0.2.0

ソース

// 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);
    }
}