-
|
Hey! First of all, thank you for this awesome project! I just started looking into vectorbt and trying to improve my understanding of how it works through a simple strategy example:
I am having trouble with calculating the exits via vbt. I tried to implement the sell rule via tp_stop as I've seen in an example, but the results are drastically different when compared to a "manual" calculation of the exits. The code below illustrated the 2 approaches. I did a bit of digging into the vbt trades and I feel I'm not understanding how tp_stop works. I observed the following behavior which I did not expect:
I have the following questions for you / the community and would greatly appreciate some help:
Thank you! Results: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Hi @davejonh, If you want to get a finer control, you can use SL/TP built into |
Beta Was this translation helpful? Give feedback.
Hi @davejonh,
OHLCSTXsearches for an exit between two entries. If there is no gap between two entries, there cannot be any exits in-between. Now, yourentriescontains a lot of True values that come one after another (= a sequence), and so the only entryOHLCSTXcan find exits for is the last entry of each sequence. To mimic real behavior, you should either useOHLCSTCX(note the 'C' letter in the name), which generates an exit for the first True value out of each sequence, or manually select the first True value out of each sequence usingentries = entries.vbt.signals.clean(). ThenOHLCSTXwill work as expected.If you want to get a finer control, you can use SL/TP built into
Portfolio.…