问题是它应该显示价格值(坐标),该线来自价格刻度,而不是图表!怎么解决?

问题描述 投票:0回答:1

图表上的指标显示多个高/低价格指标,即使资产价格只是简单地突破它。价格值显示为图表上的注释,但它们需要显示为价格刻度上的价格坐标,其中显示当前价格! 我还不能添加相对于价格的水平指标 - 仅显示低于当前价格的支撑位(绿色)和高于当前价格的阻力位 - 这应该有助于消除图表中的噪音 - 但问题是它无法计算价格(坐标)水平,因为它们没有显示在价格坐标刻度上。

 //@version=5
indicator('LVLES', shorttitle='S/R Lines with Price Labels', overlay=true)

var float supportPrice = na
var line supportLine = na
var bool greenCandleSupport = na

var float monthlyHigh = na
var line resistanceLine = na
var bool redCandleResistance = na

if close < open
supportPrice := low
greenCandleSupport := false
greenCandleSupport

if not na(supportLine) and not greenCandleSupport
line.delete(supportLine)

if not na(close[1]) and close[1] < open[1]
greenCandleSupport := true
supportLine := line.new(x1=bar_index[1], y1=supportPrice, x2=bar_index, y2=supportPrice,         color=color.green, width=1, extend=extend.right)
supportLine

if month != month[1] and close > open
monthlyHigh := high
redCandleResistance := false
redCandleResistance

if not na(resistanceLine) and not redCandleResistance
line.delete(resistanceLine)

if not na(close[1]) and close[1] > open[1]
redCandleResistance := true
resistanceLine := line.new(x1=bar_index[1], y1=monthlyHigh, x2=bar_index, y2=monthlyHigh,     color=color.red, width=1, extend=extend.right)
resistanceLine


label.new(x=bar_index, y=supportPrice, text=str.tostring(supportPrice), color=color.green,     style=label.style_label_down, yloc=yloc.belowbar)


label.new(x=bar_index, y=monthlyHigh, text=str.tostring(monthlyHigh), color=color.red, style=label.style_label_up, yloc=yloc.abovebar)

该指标暗示了自动构建支撑位和阻力位的策略!规则是,如果下一根蜡烛是或将是红色的,则阻力线建立在绿色蜡烛的高点处;如果下一根蜡烛是或将是绿色的,则支撑线建立在红色蜡烛的低点处!我尝试通过以下方式显示这些级别的指标: label.new(x=bar_index, y=supportPrice, text=str.tostring(supportPrice), color=color.green, style=label.style_label_down, yloc=yloc.belowbar)

label.new(x=bar_index, y=monthlyHigh, text=str.tostring(monthlyHigh), color=color.red, style=label.style_label_up, yloc=yloc.abovebar)

但价格出现在图表上,我无法将其转移到价格坐标刻度

pine-script price strategy-pattern indicator levels
1个回答
0
投票

您无法直接操纵价格范围。

如果您可以绘制您的线条,您可以在价格刻度上看到它的值和绘图的名称。

//@version=5
indicator("My script", overlay=true)

daily_high = request.security(syminfo.tickerid, "D", high)

plot(daily_high, "Daily High")

© www.soinside.com 2019 - 2024. All rights reserved.