vectorbt icon indicating copy to clipboard operation
vectorbt copied to clipboard

Is it possible for Vectorbt to enter the market in batches?

Open shihyu opened this issue 1 year ago • 1 comments

Is it possible for Vectorbt to enter the market in batches?

For example, if the initial cash is $1,000, buy $500 when the stock price crosses MA5 for the first time, buy another $500 when the stock price falls to MA10, stop loss and exit when the stock price falls to MA20, and take profit and exit when there is a 20% profit.

Thank you.

shihyu avatar Feb 25 '23 14:02 shihyu

Everything is possible, you can either represent your strategy using signals and then pass those signals to from_signals (with accumulation enabled if you want to increase/decrease a position), or use from_order_func to place orders dynamically.

polakowo avatar Mar 04 '23 11:03 polakowo

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar Feb 28 '24 01:02 github-actions[bot]