我正在尝试绘制 low_mark 和 open 以及 high_mark 和 open 之间的差异,当前代码将行放在上面而不是中间。
//@version=4
study("My Final Version", overlay=true, max_bars_back=500)
maxBarsBack = 500
previousRange = open[1] - close[1]
line bullEngulfOpen = na
line bullEngulfLow = na
line bullEngulfMid = na
line bearEngulfOpen = na
line bearEngulfHigh = na
line bearEngulfMid = na
isBullEngulf = previousRange > 0 and close > open[1]
isBearEngulf = previousRange < 0 and close < open[1]
...我想在low_mark(红线)和high_mark(绿线)之间绘制mid_mark(黄线)。它把这条线放在上面是因为我认为它看错了蜡烛。
low_mark = nz(min(low, low[1]), low)
high_mark = nz(max(high, high[1]), high)
mid_mark= (nz(min(low, low[1]), low) + nz(max(high, high[1]), high)) /2
X_ = bar_index -1
if isBullEngulf
bullEngulfOpen := line.new(X_, open[1], bar_index, open[1], extend=extend.right, color=color.green)
bullEngulfLow := line.new(X_, low_mark, bar_index, low_mark, extend=extend.right, color=color.red)
bullEngulfMid := line.new(X_, mid_mark, bar_index, mid_mark, extend=extend.right, color=color.yellow)
buy_message_1 = "Buy 1(Open) = " + tostring(open[1]) + " Buy 2(Mid) = " + tostring(mid_mark) + " Buy 3(Low) = " + tostring(low_mark)
alert(message=buy_message_1)
if isBearEngulf
bearEngulfOpen := line.new(X_, open[1], bar_index, open[1], extend=extend.right, color=color.green)
bearEngulfHigh := line.new(X_, high_mark, bar_index, high_mark, extend=extend.right, color=color.red)
bearEngulfMid := line.new(X_, mid_mark, bar_index, mid_mark, extend=extend.right, color=color.yellow)
//sell_message_1 = "Sell Price 1 (Open) = " + tostring(open[1]) + " Sell Price 2 (High) " + tostring(high_mark)
sell_message_1 = "Sell 1(Open) = " + tostring(open[1]) + " Sell 2(Mid) " + tostring(mid_mark) + " Sell 3(High) " + tostring(high_mark)
//alert(message= sell_message_1)
// ALERTS