Replies: 1 comment
-
|
This is because your data contains gaps. Pass something like this to pf.plot (you can provide gaps manually, see https://community.plotly.com/t/how-to-use-rangebreaks-for-a-datetime-index-at-levels-smaller-than-1-hour/46073): xaxis=dict(rangebreaks=[
dict(bounds=["sat", "mon"]), # hide weekends
dict(values=["2015-12-25", "2016-01-01"]) # hide Christmas and New Year's
]) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am new to VectorBT.
I am probably missing something in the docs that is super obvious, but I can't seem to get around this issue.
When I try to do simple analysis of a MA crossover for a particular stock for an interval of 5 min, it returns a warped graph. But, if I do the same thing with an interval of 1 day or more, this effect disappears.
What am I doing wrong? :)
`import vectorbt as vbt
start = '2022-06-01 +0500'
end = '2022-06-06 +0500'
interval = '5m'
stock_prices = vbt.YFData.download('RCAT', start=start, end=end, interval=interval).get('Close')
print(stock_prices)
fast_ma = vbt.MA.run(stock_prices, 10, short_name='fast')
slow_ma = vbt.MA.run(stock_prices, 20, short_name='slow')
entries = fast_ma.ma_crossed_above(slow_ma)
exits = fast_ma.ma_crossed_below(slow_ma)
pf = vbt.Portfolio.from_signals(stock_prices, entries, exits, init_cash=10000, fees=.005)
pf.plot().show()`
Beta Was this translation helpful? Give feedback.
All reactions