Combining/weighing indicator values #330
Replies: 2 comments 5 replies
-
@andreas-vester the simplest way (let's say with moving averages): |
Beta Was this translation helpful? Give feedback.
-
Here's a more robust solution that takes into account, that the user should be able to provide a range of different formats with respect to lookback periods and weightings. The following cases will be covered:
I also performed some unit tests:
I still need some help in order to make this code numba-compiled. Would be highly appreciated. |
Beta Was this translation helpful? Give feedback.
-
What would be the way to go in order to combine multiple indicator values of the same indicator type into one new indicator? Sounds weird? Here's an example ;-)
Let's say I want to compute a regular "rate-of-change" indicator. I am going to compute it twice. First with a lockback window size of 50, and second with a window size of 100. Now, I want to be able to weigh both indicator results by, let's say, 25% and 75%. I am finally interested in the weighted indicator values. That is
sum(0.25 * win(50)-indicator-values, 0.75 * win(100)-indicator-values)
.Now, for me there's the question of how to compute it? Should I make the calculation function of the actual indicator capable of weighing directly? In that case and with respect to params, I'm probably looking for
window
andweights
to be of typeUnion[int, List[int]]
andOptional[Union[int, List[int]]]=1
, respectively. If simply providingwindow=100
, this would compute the regular 100 period rate-of-change. Providingwindow=[50, 100], weights=[0.25, 0.75]
should then weigh the individual indicator values.The alternative would be to keep the actual calculation function as simple as possible and let it solely compute the regular rate-of-change indicator. The weighting could then occur after computing multiple instances of the roc-indicator. However, when following this route, I am wondering how to preserve all the class methods of the actual indicator?
Beta Was this translation helpful? Give feedback.
All reactions