Pine脚本:公开会议周六和周日不出现



我正在TradingView中编写一个'Open Session'指标。我不知道为什么星期六和星期天的范围不显示。

谁能告诉我问题在哪里?


showHi = input(true, "Show highs")
showLo = input(true, "Show lows")
open_ranges_D1  = "D"
opd1_session_input       = input("2200-2000", type=input.session)
asia_session_input       = input("0000-2300", type=input.session)
fkft_session_input       = input("0700-2300", type=input.session)
nyse_session_input       = input("1330-2300", type=input.session)
// |--------------|
// | OPD1 SESSION |
// |--------------|
opd1_clr_D1 = color(#00ff0a)
// Check to see if we are in allowed hours.
opd1_newbar_opr_D1 = time(open_ranges_D1, opd1_session_input)
var float opd1_hi = 0
var float opd1_lo = 0
if opd1_newbar_opr_D1
// We are entering allowed hours; reset opd1_hi/opd1_lo.
if not opd1_newbar_opr_D1[1]
opd1_hi := high
opd1_lo := low
else
// We are in allowed hours; track opd1_hi/opd1_lo.
opd1_hi := max(opd1_hi, opd1_hi)   // originially : opd1_hi := max(srcHi, opd1_hi)
opd1_lo := min(opd1_lo, opd1_lo)   //               opd1_lo := min(srcLo, opd1_lo)
opd1_hi_plot = plot(showHi and not(noPlotOutside and not opd1_newbar_opr_D1)? opd1_hi : na, title="opd1_hi_D1", color=opd1_clr_D1, linewidth=1, style=plot.style_linebr, transp=50)
opd1_lo_plot = plot(showLo and not(noPlotOutside and not opd1_newbar_opr_D1)? opd1_lo : na, title="opd1_lo_D1", color=opd1_clr_D1, linewidth=1, style=plot.style_linebr, transp=50)
fill(opd1_hi_plot, opd1_lo_plot, color=opd1_clr_D1, transp=80) ```

将会话传递给time()时,还可以指定相应的星期。格式看起来像这样:"0000-0000:1234567",一周的天数从星期日开始。默认的日子是星期一至星期五":23456",这就是为什么你的脚本不工作在星期六和星期日。

这应该有帮助:

opd1_newbar_opr_D1 = time(open_ranges_D1, opd1_session_input + ":1234567")

相关内容

最新更新