0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

特定の日時にマーカーをつける

Last updated at Posted at 2023-05-10

//@version=5
indicator('plot date', overlay=true)

p(t) => 
    if time < timestamp(t) + 60*60*18*1000 and timestamp(t) + 60*60*18*1000 < time + 60*60*24*1000
        label.new(bar_index, high, "", color=color.new(color.white, 90))

p("2023-05-02")
p("2023-05-03")
  • マウスカーソルをのせたときにツールチップを表示する場合
//@version=5
indicator('plot date', overlay=true)

p(t, tooltip) => 
    if time < timestamp(t) + 60*60*18*1000 and timestamp(t) + 60*60*18*1000 < time + 60*60*24*1000
        label.new(bar_index, high, "", color=color.new(color.white, 90), tooltip = tooltip)

p("2023-05-08", "ツールチップ1")
p("2023-05-03", "")
  • 矢印の形を変える
indicator('plot date', overlay=true)

p(t, buysell, hovermessage) => 
    if time < timestamp(t) + 60*60*18*1000 and timestamp(t) + 60*60*18*1000 < time + 60*60*24*1000
        if buysell == "L"
            label.new(bar_index, low, buysell, color=color.new(color.lime, 80), textcolor=color.new(color.white,90), tooltip = hovermessage, yloc=yloc.belowbar, style=label.style_arrowup)
        else
            label.new(bar_index, high, buysell, color=color.new(color.red, 80), textcolor=color.new(color.white,90), tooltip = hovermessage, yloc=yloc.abovebar, style=label.style_arrowdown)

p("2023-05-08", "L", "ロングの根拠")
p("2023-05-03", "S", "ショートの根拠")

配列を使う場合

//@version=5
indicator('plot date', overlay=true)

t(my_array) => 
    for i = 0 to array.size(my_array)-1 by 1
        if time < array.get(my_array,i) and array.get(my_array,i) < time + 60*60*24*1000
            label.new(bar_index, high, '', color=color.new(color.white, 95))

my_array = array.new_int(10, timestamp("2023-05-02"))
array.push(my_array, timestamp("2023-05-03"))
array.push(my_array, timestamp("2023-04-03"))
array.push(my_array, timestamp("2023-05-01"))

t(my_array)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?