Error with VP function in Mac environment

Create issue
Issue #25 new
Luís Cunha created an issue

Hello, I tried this function:

#VP
library(QuantTools)

timeframe = 60*30   # time interval
step      = 0.00001 # bar step
alpha     = 0.98 # decay coefficient
cut       = 100  # cut threshold
vp = roll_volume_profile(GU, timeframe, step, alpha, cut )

profiles = rbindlist( vp$profile )
# normalize profiles volume
profiles[, volume_norm := volume / max( volume ), by = time ]

# plot indicator values as heat vector
candles = to_candles( GU, timeframe )
plot_ts( candles )
profiles[, rect( 
  xleft   = t_to_x( time - timeframe ),
  xright  = t_to_x( time ),
  ybottom = price - step / 2,
  ytop    = price + step / 2,
  col     = rgb( 0.70, 0.13, 0.13, volume_norm ),
  border = NA
) ]

on Microsoft and everything worked well, but now running the code on Mac environment I get the following error on :

plot_ts( candles )
  • Error in seq.int(0, to0 - from, by) : wrong sign in 'by' argument 6.seq.POSIXt(round_POSIXct(t_from, 10, "min", floor), round_POSIXct(t_to, 10, "min", ceiling), as.difftime(10, units = "mins")) 5.seq(round_POSIXct(t_from, 10, "min", floor), round_POSIXct(t_to, 10, "min", ceiling), as.difftime(10, units = "mins")) 4.`[.data.table`(basis, , seq(round_POSIXct(t_from, 10, "min", floor), round_POSIXct(t_to, 10, "min", ceiling), as.difftime(10, units = "mins")), by = 1:nrow(basis)) 3.basis[, seq(round_POSIXct(t_from, 10, "min", floor), round_POSIXct(t_to, 10, "min", ceiling), as.difftime(10, units = "mins")), by = 1:nrow(basis)] 2.plot_ts_frame(xlim, ylim, resolution, log) 1.plot_ts(candles)

The dataset is the following :

           date     time     bid     ask   price volume  

15003678 2021-02-04 23:59:43 1.36718 1.36728 1.36718 0
15003679 2021-02-04 23:59:44 1.36717 1.36728 1.36717 0
15003680 2021-02-04 23:59:45 1.36718 1.36728 1.36718 0
15003681 2021-02-04 23:59:56 1.36719 1.36731 1.36719 0
15003682 2021-02-04 23:59:57 1.36720 1.36731 1.36720 0
15003683 2021-02-04 23:59:57 1.36719 1.36731 1.36719 0

Can someone explains me ? BTW I absolutely love this package

Thank you very much

Comments (1)

  1. Log in to comment