英文:
Request.Security repainting the screener result when referring higher timeframe
问题
我正在尝试使用Request.Security获取前一天的最高价和最低价。
以下是我的代码:
dh_func(sym) =>
sema = ta.ema(close, ema_len)
//////////
/// 获取当日最高价///
[h1,h2,l1,l2] = request.security(sym, 'D', [high[0],high[1],low[0],low[1]])
//[h1,h2,l1,l2] = rp_security(sym, 'D')
dh = (ta.cross(sema,math.max(h1,h2)) and isToday) or (ta.cross(close,math.max(h1,h2)) and isToday)
dl = (ta.cross(sema,math.min(l1,l2)) and isToday) or (ta.cross(close,math.min(l1,l2)) and isToday)
[dh,dl]
它可以正常工作,但当蜡烛在较低的时间框架内关闭时,筛选器的结果会变成空白。
请帮我解决这个问题。
备注:我也尝试过使用f_security(),但它也不起作用。
英文:
I am trying to get the Previous Day High and Low using Request.Security.
Here is my Code.
dh_func(sym) =>
sema = ta.ema(close, ema_len)
//////////
/// Get Days High///
[h1,h2,l1,l2] = request.security(sym, 'D', [high[0],high[1],low[0],low[1]])
//[h1,h2,l1,l2] = rp_security(sym, 'D')
dh = (ta.cross(sema,math.max(h1,h2)) and isToday) or (ta.cross(close,math.max(h1,h2)) and isToday)
dl = (ta.cross(sema,math.min(l1,l2)) and isToday) or (ta.cross(close,math.min(l1,l2)) and isToday)
[dh,dl]
It is working fine, but when the candle closed in lower timeframe, the screener results are getting blank.
Please help me to solve the issue.
Note: I have also tried using f_security() it didn't work either.
答案1
得分: 0
终于解决了,f_security() 起作用了,问题与 ta.cross() 有关
现在我只检查
dh = close[1] > h1 and isToday
它有效。
英文:
Finally it is resolved, f_security() worked, issue was related to ta.cross()
now I am checking only
dh = close[1] > h1 and isToday
it worked.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论