Stoploss hit on same day as entry #188
Unanswered
BravoDeltaBD
asked this question in
Q&A
Replies: 1 comment 1 reply
-
@BravoDeltaBD, unfortunately, vectorbt doesn't allow two orders at the same tick. But I'm already thinking of ways to make it possible, for example, by calling Please elaborate more on what issues arise with the drawdown. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, I have a question on how to solve a problem I am encountering. Let me give some context first:
I am using a custom njit order_function. As order_func_args I pass in arrays of ohlcv-values, exit signals, entry signals, and predetermined stoploss prices. I am able to create orders for stoplosses (and take-profits) that are hit during any bar that comes after the bar where a new position is opened. E.g. for longs, I do this by checking if the low on the current bar is lower than the stoploss price, and if so, I create an order to sell off the current position with the stoploss price as order price.
But sometimes when a new position is created, the low-price gets below the stoploss price during that same first bar. I need to somehow simulate opening a position and then closing it at a loss (or at a profit for TP's). The net size difference is 0, but the amount of cash in the portfolio should be decreased or increased by a certain amount.
Do you have any ideas on how to approach this? In addition, it would be great if the portfolio-statistics, like the drawdown, would still be properly calculated as if the order was actually placed.
Beta Was this translation helpful? Give feedback.
All reactions