Indicator Series vs Increments #216
Replies: 5 comments 5 replies
This comment has been hidden.
This comment has been hidden.
-
I have a crazy idea that I've tried to supress from my mind, but it goes like this: I want to to get a "series" of some sort (RSI, MACD, etc) with a based on a certain resolution (24h, 1h...). Let me explain: Given I have 300 samples of 24h end-of-day. During the current day I want to "increment" 1h samples to my series and based on the previous day the library will try to predict the current bucket. This way I might be able to get a "peek" of the future at the end of the day if I work with 24/1Day indicators. Maybe to crazy.. but you have to think out of the box sometimes |
Beta Was this translation helpful? Give feedback.
-
In thinking about this a bit, I'm thinking the using Skender.Stock.Indicators;
[..] // prerequisite: get baseline quote history from your own source
// initialize the series
IncrementalResults results = Indicator.GetSmaIncrement(history,20); Then you'd handle event based updates:
Where public class IncrementalResults
{
// indicator results and data needed for next period calcs
public Guid Id { get; set; }
public IEnumerable<IResult> IndicatorValues {get; set;}. // e.g. IEnumerable<SmaResult>
internal IEnumerable<IQuote> History {get; set;}
internal string IntermediateValuesJson { get; set; }
} There's still a lot of thinking to do on this one to optimize it for both performance and resource consumption. |
Beta Was this translation helpful? Give feedback.
-
I’m working up a preview in #824 to test this out, and will release it for comment |
Beta Was this translation helpful? Give feedback.
-
Follow or continue this conversation in our discussion on streaming indicators for progress and information about pre-release package versions to support live and incremental quote sources. |
Beta Was this translation helpful? Give feedback.
-
I’ve noticed that some users are supplying a minimum amount of historical quotes to produce indicators. I suspect they are attempting to calculate a single incremental value, rather than a whole series is historical indicator results. The current intended use case is to produce a whole series in one call.
For many indicator types, like EMA and RSI, this incremental approach can be problematic because they require a warmup period where accuracy improves through numerical convergence. This is why we often recommend 100-250 preceding historical quotes in those cases and not just the bare minimum.
With that said, I’m considering adding parallel implementations of methods, such as
GetEmaSeries
andGetEmaIncrement
in version 2.0, to better address those different use cases. I can see the increment approach as being useful in streaming models where you're adding one period quote at a time to an existing dataset.Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions