查找前一天开仓和平仓没有安全功能
Finding previous day open and close without security function
我想在不使用安全功能的情况下查找前一天的开盘和收盘。我该怎么做?
//@version=5
indicator("Previous open and close", overlay = true)
new_day = ta.change(dayofweek) != 0
eod = time_close == time_close("D") and barstate.isconfirmed
var float daily_open = na
var float daily_close = na
if new_day
daily_open := open
if eod
daily_close := close
bgcolor(new_day ? color.new(color.green, 90) : na)
bgcolor(eod ? color.new(color.red, 90) : na)
prev_open = ta.valuewhen(new_day, daily_open[1], 0)
prev_close = ta.valuewhen(new_day, daily_close[1], 0)
plot(prev_open, color = color.lime)
plot(prev_close, color = color.red)
我想在不使用安全功能的情况下查找前一天的开盘和收盘。我该怎么做?
//@version=5
indicator("Previous open and close", overlay = true)
new_day = ta.change(dayofweek) != 0
eod = time_close == time_close("D") and barstate.isconfirmed
var float daily_open = na
var float daily_close = na
if new_day
daily_open := open
if eod
daily_close := close
bgcolor(new_day ? color.new(color.green, 90) : na)
bgcolor(eod ? color.new(color.red, 90) : na)
prev_open = ta.valuewhen(new_day, daily_open[1], 0)
prev_close = ta.valuewhen(new_day, daily_close[1], 0)
plot(prev_open, color = color.lime)
plot(prev_close, color = color.red)