Request.Security 在引用更高时间框架时重新绘制筛选结果。

huangapple go评论43阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年7月10日 13:01:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76650766.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定