我正在尝试使用以下代码存储多种货币的 21:00:00 每日收盘价:
study("Currency", precision=2)
dol1 = security("BMFBOVESPA:DOL1!", "1", close)
e1 = security("FX_IDC:EURBRL", "1", close)
z1 = security("FX_IDC:ZARBRL", "1",close)
m1 = security("FX_IDC:MXNBRL", "1",close)
g1 = security("FX_IDC:GBPBRL", "1",close)
r1 = security("FX_IDC:RUBBRL", "1",close)
j1 = security("FX_IDC:JPYBRL", "1",close)
c1 = security("FX_IDC:CADBRL", "1",close)
t1 = security("FX_IDC:CNYBRL", "1",close)
emb1 = 1/security("CME:6LN2021", "1", close)
closingHour = input(21)
closingMinute = input(00)
sessionCloseTime = timestamp(year, month, dayofmonth, closingHour, closingMinute)
bool isLastBarDay = false
if timeframe.isintraday and dayofweek != dayofweek.sunday
lastBarTime = sessionCloseTime - timeframe.multiplier * 60
isLastBarDay := time >= lastBarTime
float dol0 = na
float eur0 = na
float zar0 = na
float mxn0 = na
float gbp0 = na
float rub0 = na
float jpy0 = na
float cad0 = na
float try0 = na
float emb0 = na
if barstate.isconfirmed and isLastBarDay
dol0 := dol1
eur0 := e1
zar0 := z1
mxn0 := m1
gbp0 := g1
rub0 := r1
jpy0 := j1
cad0 := c1
try0 := t1
emb0 := emb1
else
dol0 := dol1[1]
eur0 := e1[1]
zar0 := z1[1]
mxn0 := m1[1]
gbp0 := g1[1]
rub0 := r1[1]
jpy0 := j1[1]
cad0 := c1[1]
try0 := t1[1]
emb0 := emb1[1]
plot(dol0)
//(...) others plots
在日内时间范围内,收盘价不正确,我无法弄清楚为什么会发生这种情况。
有谁知道在给定时间内记录多种货币的每日收盘价的方法。