Timezone convertion between tickers

后端 未结 1 1948
南方客
南方客 2021-01-26 10:00

I\'m attempting to color the background on ticker ES1! for those bars that fall within the trading session of ticker SPX.
We can use the time(resol

1条回答
  •  失恋的感觉
    2021-01-26 10:08

    You can use security to calculate the time:

    t1 = security("SPX", timeframe.period, time(timeframe.period, "0930-1600"))
    bgcolor(t1 ? color.yellow : na)
    

    UPDATE

    As Bjorn Mistiaen noticed in comments, the gaps parameter must be set to barmerge.gaps_on:

    t1 = security("SPX", timeframe.period, time(timeframe.period, "0930-1600"), gaps=barmerge.gaps_on)
    bgcolor(t1 ? color.yellow : na)
    

    0 讨论(0)
提交回复
热议问题