在 tradingview 每日开盘时绘制水平射线
Plotting a horizontal ray at the daily open on tradingview
尝试在每日开盘时绘制水平射线,但出于某种原因我的代码没有绘制任何东西
//@version=4
study("Opens +", overlay=true)
higherTF1 = input("D", type=input.resolution)
dailyopen = security(syminfo.tickerid, higherTF1, open)
var line1 = line.new(bar_index, dailyopen,bar_index, dailyopen, xloc=xloc.bar_index, style=line.style_solid,extend=extend.right)
line.set_color(line1, color.black)
line.set_width(line1, 1)
// mrtuanvn
//@version=4
study("Open Ray to right", overlay=true)
higherTF1 = input("D", type=input.resolution)
dailyopen = security(syminfo.tickerid, higherTF1, open)
line1 = line.new(x1=bar_index-1, y1=dailyopen, x2=bar_index, y2=dailyopen, xloc=xloc.bar_index, style=line.style_solid,extend=extend.right, color=color.green)
line.delete(line1[1]) // remove the previous line when new bar appears
尝试用同样的方法标记月度高点,但没有用。假设 3 月的月度高点恰好发生在 3 月 14 日,希望从 3 月 14 日开始绘制的线向右延伸。它应该只绘制这条 14th March 线,而不是以前的线。以下是我尝试过但没有得到想要的结果
//@version=4
study(title="Previous Month High-PMH", overlay=true)
TF = input(title="MHL", type=input.string, defval="M")
PMH=security(syminfo.tickerid, TF, high[1])
line1 = line.new(x1=bar_index-1, y1=PMH, x2=bar_index, y2=PMH, xloc=xloc.bar_index, style=line.style_solid,extend=extend.right, color=color.green)
line.delete(line1[1])
尝试在每日开盘时绘制水平射线,但出于某种原因我的代码没有绘制任何东西
//@version=4
study("Opens +", overlay=true)
higherTF1 = input("D", type=input.resolution)
dailyopen = security(syminfo.tickerid, higherTF1, open)
var line1 = line.new(bar_index, dailyopen,bar_index, dailyopen, xloc=xloc.bar_index, style=line.style_solid,extend=extend.right)
line.set_color(line1, color.black)
line.set_width(line1, 1)
// mrtuanvn
//@version=4
study("Open Ray to right", overlay=true)
higherTF1 = input("D", type=input.resolution)
dailyopen = security(syminfo.tickerid, higherTF1, open)
line1 = line.new(x1=bar_index-1, y1=dailyopen, x2=bar_index, y2=dailyopen, xloc=xloc.bar_index, style=line.style_solid,extend=extend.right, color=color.green)
line.delete(line1[1]) // remove the previous line when new bar appears
尝试用同样的方法标记月度高点,但没有用。假设 3 月的月度高点恰好发生在 3 月 14 日,希望从 3 月 14 日开始绘制的线向右延伸。它应该只绘制这条 14th March 线,而不是以前的线。以下是我尝试过但没有得到想要的结果
//@version=4
study(title="Previous Month High-PMH", overlay=true)
TF = input(title="MHL", type=input.string, defval="M")
PMH=security(syminfo.tickerid, TF, high[1])
line1 = line.new(x1=bar_index-1, y1=PMH, x2=bar_index, y2=PMH, xloc=xloc.bar_index, style=line.style_solid,extend=extend.right, color=color.green)
line.delete(line1[1])