-
-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADVSTEX with limit entry orders? #64
Comments
The ADVSTEX generator a strict exit generator and has no logic to manipulate entries - those have to be prepared and provided by the user. There are several options you can go: the first one is creation of a custom entry & exit generator (as you did apparently) with a custom entry function that does some basic order management and ADVSTEX exit function, the second one is filtering entries beforehand using signals accessor (but this assumes that your entries do not depend upon previous exits). If you can elaborate more on limit entry orders (are those stop entry orders that are canceled once a stop is reached or simple buy stops?) and provide me with an example on how you currently handle them, I can help integrating a more general version of it into the package. |
Sorry for the delayed response. I wanted to work on this issue as soon as your reply but was caught up in other aspects. To answer your question, this issue relates to simple limit buy orders. Implementing a limit buy order has a few considerations:
I wrote a simple example to implement in my system that fulfils the above considerations by running the assumption (on point 3) that consecutive signals belong to the same "signal session", and therefore unfilled limit orders are stale and should be canceled if they are left unfilled when the signal changes. It seems though that a time-based expiry setting for limit orders are the convention so you may factor that into your development. "Signal session" style works for me, with the side benefit that the possibility of overtrading of the same signal won't happen in this style.
On a side note, I saw that shorting function has been added to portfolio. Hope that ADVSTEX (and signals modules) will include support for it! |
Buy limit orders can be done in multiple ways in vectorbt, but all of them involve setting relative stops in percentage terms because vectorbt puts focus on hyperparameter optimization. For example, 1% stop: entry_signals = bt_df['Signal'].astype(bool)\
.vbt.signals.first()\
.vbt.signals.generate_stop_exits(bt_df['Close'], -0.01, exit_wait=0) Here we use A better approach in your case would involve working directly with |
I do use relative stops in percentages so that isn't a problem for me. That's a novel solution to generate entries (using Regarding |
The only drawback of Regarding |
Great package, been trying it for about a month and I've found it to be very flexible!
I've been using ADVSTEX and there doesn't seem to be an obvious way to define limit entry orders, and subsequently, filled entries. The class seems to assume that entries are filled order entries or market bought.
The entries I have built for ADVSTEX are signal based entries, but I would like to move towards the above direction or being able to reflect limit order entries that are filled or canceled (time-based).
Briefly, I think I can rudimentarily get around this by running the entries through a custom indicator to reflect only filled entry order, but that may not easily account for orders that are never filled. It seems that this package can benefit from an integrated function within ADVSTEX itself. Would like to hear your thoughts on this.
The text was updated successfully, but these errors were encountered: