AlertaScript / ドキュメント
ユーザー定義型とメソッド
関連するデータと操作をまとめる。
仕組み
type はフィールドを定義し、コンストラクターがインスタンスを作成します。メソッドの最初の型付き引数が受け手です。
実践
価格帯や取引状態に利用できます。chart.point は組み込み型であり、価格系列変数ではありません。
コード例
AlertaScript
indicator("Price range", overlay=false)type PriceRange float hi float lomethod width(PriceRange this) => this.hi - this.lorange = PriceRange.new(high, low)plot(range.width(), "Range")