Limit number of trades per day #400
Replies: 2 comments 3 replies
-
I feel live vbt is not the best tool for that particular case, from what I know there is no features in vbt that handles this directly. "Event-driven" systems might be better. The only option I see is to code yourself a function/class that builds the signals by going through all the data one by one and checks if 2 trades were already done that day. But doing that is almost like building your own event driven system. Such tools already exits in python, see Backtrader, PyalgoTrade, Zipline, Lean etc. But none of them comes even remotely close to vbt in terms of speed and thus capacity to process massive amount of data/ hyperparameter combinations. Cheers, |
Beta Was this translation helpful? Give feedback.
-
Great answer here @polakowo, how might I modify this to create a daily_take_profit limit or a daily_stop_loss limit? Would I need to modify your tp_stop and sl_stop functions or might I use something like what you have above? |
Beta Was this translation helpful? Give feedback.
-
Hello quants
How I can reject orders in vectorbt from signals if my system has already traded "x" times by the day?
OR limit the number trades taken by the day for a signal?
Eg: If I'm using a cross of moving average (2, 5) it will give multiple trades by the day.
I just want it to accept the first 'n' tradable signal.
limit_trades = 2
Time | Entry | Exit | Explanation
2022-02-25 09:00:00 | False | False |
2022-02-25 09:30:00 | True | False | Open trade (1)
2022-02-25 10:00:00 | True | False |
2022-02-25 10:30:00 | True | False |
2022-02-25 11:00:00 | False | True |
2022-02-25 11:30:00 | False | True | Closed trade (1)
2022-02-25 12:00:00 | False | True |
2022-02-25 12:30:00 | True | False | Open trade (2)
2022-02-25 13:00:00 | True | False |
2022-02-25 13:30:00 | True | False |
2022-02-25 14:00:00 | False | True | Closed trade (2)
2022-02-25 14:30:00 | False | True |
2022-02-25 15:00:00 | True | False | Reject trade (3), daily trading limit reach
2022-02-25 15:00:00 | True | False |
Beta Was this translation helpful? Give feedback.
All reactions