Importing an indicator from Pandas_ta and setting entries and exits. #328
-
Hey! I am trying to import the VWAP indicator from pandas_ta and test a simple strategy utilizing it.
I am not sure if it works properly. When I run it it does not return any errors. Just a warning: "Converting to PeriodArray/Index representation will drop timezone information.". Can I plot it somehow? "vwap.plot().show()" returns an error. Assuming it works. How can I set an entry signal for when the closing price crosses above the VWAP line and exits for when it crosses below? I tried:
But when I plotted with:
There were no trades. I use ".load" to get the data from a file I downloaded and saved first. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@Krzysiek191 you can run |
Beta Was this translation helpful? Give feedback.
@Krzysiek191 you can run
vbt.pandas_ta('vwap').output_names
to see which arrays VWAP produces. For instance, for VWAP, there is only one arrayvwap_d
which can be accessed viavwap.vwap_d
. To generate crossover signals, dovwap.close_crossed_above(vwap.vwap_d)
. You can read more about indicators here: https://vectorbt.dev/api/indicators/factory/