找到本周内的第一个柱
Find the first bar within the current week
正在尝试为本周内的第一个日线创建表达式。每周一组蜡烛中的第一个柱应该是正确的,但我目前所掌握的是不正确的。
注意我不能使用此处指定的内置日期函数https://www.pinecoders.com/faq_and_code/#time-dates-and-sessions
thisweek = security(syminfo.tickerid, "W", barstate.islast, lookahead = barmerge.lookahead_on)
firstday = security(syminfo.tickerid, "D", barstate.isfirst, lookahead = barmerge.lookahead_on)
is_monday = thisweek and firstday
is_newbar(res) =>
t = time(res)
change(t) != 0 ? 1 : 0
firstcandle=is_newbar("D") and is_newbar("W")
var countD = 0
countD := is_newbar("W") ? 1 : is_newbar("D") ? countD + 1 : countD
is_monday = countD==1
正在尝试为本周内的第一个日线创建表达式。每周一组蜡烛中的第一个柱应该是正确的,但我目前所掌握的是不正确的。
注意我不能使用此处指定的内置日期函数https://www.pinecoders.com/faq_and_code/#time-dates-and-sessions
thisweek = security(syminfo.tickerid, "W", barstate.islast, lookahead = barmerge.lookahead_on)
firstday = security(syminfo.tickerid, "D", barstate.isfirst, lookahead = barmerge.lookahead_on)
is_monday = thisweek and firstday
is_newbar(res) =>
t = time(res)
change(t) != 0 ? 1 : 0
firstcandle=is_newbar("D") and is_newbar("W")
var countD = 0
countD := is_newbar("W") ? 1 : is_newbar("D") ? countD + 1 : countD
is_monday = countD==1