vectorbt icon indicating copy to clipboard operation
vectorbt copied to clipboard

multiple entry signals

Open VanBuren77 opened this issue 2 years ago • 6 comments

It looks like vectorbt auto cleans duplicate entry signals. There is no documentation on how to make multiple entries

I.e., buy a share on day X and then buy another share on day Y

vectorbt will see the day Y entry as a duplicate and clean it

Is it possible in vectorbt to do this?

VanBuren77 avatar Mar 29 '22 20:03 VanBuren77

For example, if I execute a strategy that buys 1 share every 5 days of the spy500

Then at the end, I have 150 shares and I sell them all, I get an incorrectly computed total return and trade pnl

initial cash = 10000000

image

image

image

VanBuren77 avatar Mar 29 '22 20:03 VanBuren77

@VanBuren77 it's documented: set accumulate to True in from_signals to allow accumulation of orders.

Return is calculated correctly: your large initial cash inflates the total portfolio value, thus total return seems small. Setting init_cash to "auto" will make both numbers match.

polakowo avatar Mar 29 '22 20:03 polakowo

Not sure this is going through

image

VanBuren77 avatar Mar 29 '22 20:03 VanBuren77

The default size is infinity, lower it.

polakowo avatar Mar 29 '22 21:03 polakowo

Perhaps I'm not understanding, I tried different values for init_cash and read the documentation on InitCashMode

I tried 0 & 10000. When init_cash is set to 0 it should be "auto" via the docs (correct me if i'm wrong) but I get the error:

"Attempt to go in long direction infinitely"

When I set it to a value like 10000 or 100000, then I get the same plot as I posted above, where no accumulation occurs

image image

VanBuren77 avatar Mar 29 '22 22:03 VanBuren77

@VanBuren77 I think polakowo is saying the order size , not cash size ?

eromoe avatar Jan 16 '23 04:01 eromoe