Replies: 2 comments
-
Hi @qniesz, my advice is to collect at least basic knowledge of Python and pandas prior to using vectorbt. For example, rsi is often a multi-dimensional array, where rsi[-1] will select the last element of this array - comparing it with other elements means looking into the future. If you want to compare the current value with the previous value, you need to shift the RSI array forward such that each timestamp contains the value from the previous timestamp, and then perform your comparison operation on both arrays: rsi.vbt.fshift(1) > rsi. |
Beta Was this translation helpful? Give feedback.
-
Thank you @polakowo. As well think you for where I need to go to learn. |
Beta Was this translation helpful? Give feedback.
-
Sorry I am new to this.
I am also new to python.
I have build a strat in Tradingview and trying to convert.
Basically it checked the previous frame for RSI if it is higher or lower for a purchase or sell.
My first attempt at this looks like this:
entries = (rsi_int.rsi[-1] ) > (rsi_int.rsi)
This appears to work but then I get nothing when trying to add another like this:
entries = (rsi_int.rsi[-2 )> (rsi_int.rsi[-1]) & (rsi_int.rsi[-1] )> (rsi_int.rsi)
I am sure it is a syntax error.
Any ideas?
My idea will be to run this through the hyperparameter, but I need to get the base working first.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions