我知道具有较高时间范围的安全请求的原理,但在两个请求上遇到了困难。 打开/关闭和 HA 的标准非常完美:
[m_open_conf,m_open_real,m_close_conf,m_close_real] = request.security(syminfo.tickerid, "M", [open[1],open,close[1],close], lookahead = barmerge.lookahead_on)
[m_ha_open_conf,m_ha_open_real,m_ha_close_conf,m_ha_close_real] = request.security(ha_ticker, "M", [open[1],open,close[1],close], lookahead = barmerge.lookahead_on)
对于以下两种情况我该如何做到这一点?我已经尝试了很多可能性,但没有一个起作用。
1)
curve = ta.wma(ta.roc(source, longRoCLength) + ta.roc(source, shortRoCLength), wmaLength)
esma(source, length)=>
s = ta.sma(source, length))
e = ta.ema(source, length))
po_exp ? e : s
我已经尝试过这两种情况:
m_po_short_conf = ta.sma(m_close_conf, 5)
m_po_long_conf = ta.sma(m_close_conf, 25)
m_curve_real = ta.wma(ta.roc(m_close_real, longRoCLength) + ta.roc(m_close_real, shortRoCLength), wmaLength)
m_curve_conf = ta.wma(ta.roc(m_close_conf, longRoCLength) + ta.roc(m_close_conf, shortRoCLength), wmaLength)
提前致谢
尝试将 request.security 与任何 function 一起使用,如下所示:
m_po_short_conf = request.security(syminfo.tickerid, "M",
ta.sma(close, 5)[1],
lookahead = barmerge.lookahead_on) //No repaint