【最終更新日】2021年2月16日

plotshape()

チャート上に図形を描写するための関数。

図形と一緒にテキストを表示することも可能。インジケーターが発するシグナルを、視覚的に認識しやすくするために使ったりする。

サンプル

study('plotshape example 1', overlay=true)
data = close > open
plotshape(data, style=shape.xcross)

「plotshape()」は、study(overlay=true)と一緒に使う。

構文

plotshape(series, title, style, location, color, transp, offset, text, textcolor, editable, size, show_last, display)

戻り値

無し(void)

引数

series (series)

図形を描写するシリーズデータの指定。
シリーズは、location=location.absoluteを指定した場合を除いて、truefalseのブーリアン型として扱われる。

ブーリアン型のシリーズを渡すのが一般的で、trueの場合のみ図形を描写するといった使い方をする。

title (const string)

プロットのタイトル

style (input string)

描写する図形のタイプ指定。デフォルトはshape.xcross

  • shape.xcross
  • shape.cross
  • shape.triangleup
  • shape.triangledown
  • shape.flag
  • shape.circle
  • shape.arrowup
  • shape.arrowdown
  • shape.labelup
  • shape.labeldown
  • shape.square
  • shape.diamond

location (input string)

描写する図形の位置指定。デフォルトはlocation.abovebar

  • location.abovebar
  • location.belowbar
  • location.top(チャートの上限近く)
  • location.bottom(チャートの下限近く)
  • location.absolute

location.absoluteは、インジケーターの値の位置に図形を描写する指定。

color (color)

プロットする図形の色。指定方法は、color=color.redといった定数での指定だけでなく、条件式での指定も可能。

color = close >= open ? color.green : color.red

上記の例では、終値が始値以上であれば緑、それ以外は赤となる。

transp (input integer)

プロットする図形の透明度。指定可能な値は、0 (不透明) から100 (非表示)までの数値。

offset (integer)

描写する図形を指定したバーの数の分だけ左右にシフトできる。デフォルトは0

text (const string)

図形と一緒に表示する文字。複数行に渡るテキストの指定も可能で、その場合は改行コード\nを使う。

textcolor (color)

図形とともに描写するテキストの色。図形自体の色の指定と同様に、条件式での指定も可能。

editable (const bool)

描写する図形をインジケーターの設定から変更できるようにする。
デフォルトはtrue

show_last (input integer)

描写する図形の数に上限を設ける。これは直近のバーからの数なので、指定すると過去の図形が描写されなくなる。

size (const string)

描写する図形のサイズ指定。デフォルトはsize.auto

  • size.auto
  • size.tiny
  • size.small
  • size.normal
  • size.large
  • size.huge

display (const integer)

プロットするかしないかの指定。デフォルトはdisplay.all

  • display.none
  • display.all

PAGE TOP