2021年6月26日

study()

TradingView用のインジケーターをPine Scriptで作成する場合、冒頭でstudy()を宣言します。

indicator()にしなかったのには、何か理由があるはず...

サンプル

study(title="My Original Indicator", shorttitle="MOI", overlay=true)

構文

study(title, shorttitle, overlay, format, precision, scale, max_bars_back, max_lines_count, max_labels_count, resolution)

戻り値

無し(void)

引数

title (const string)

インジケーターのタイトル(必須)

名前は3つある。

  • スクリプト(コード)のタイトル
  • インジケーターのタイトル
  • チャートに表示される省略形のタイトル

これは2番目のインジケーターのタイトルで、shorttitleが設定されていない場合は、この名前がチャートに表示される。

shorttitle (const string)

チャート左上に表示されるインジケーターの名前

overlay (const bool)

インジケーターの計算結果を出力できる場所は2つ。

  • ローソク足と同じパネル
  • チャート下段の別パネル

移動平均線などローソク足と一緒に表示させたい場合はtrue、 オシレーター系など別パネルに表示したい場合はfalseを指定する。

format (const string)

インジケーターを描写するとき、Y軸の基準をどこにするか。
デフォルトはformat.inherit

  • format.inherit(自動)
  • format.price(価格)
  • format.volume(取引量)

precision (const integer)

小数点以下の桁数(0~16)。

scale (const integer)

スケールをどこに合わせるか。scale.noneは、overlay=trueの時のみ使用できる。 省略された場合は、インジケーターのスケールがそのまま使用されます。

  • scale.right
  • scale.left
  • scale.none

max_bars_back (const integer)

スクリプトが参照可能なバー数を指定する。

linktoseries (const bool)

インジケーターのスケールを常にチャートと同じにするか。デフォルトはfalse

resolution (const string)

スクリプトが対象とする時間軸。

とりあえず、resolution=""をstudy()内に入れておくと、マルチタイムインジケーターとして使えるようになる。

max_lines_count (const integer)

インジケーターが描写できるラインの数。デフォルトは50で、最大値は500

max_labels_count (const integer)

インジケーターが描写できるラベルの数。デフォルトは50で、最大値は500


PAGE TOP