I kinda thought this was coming. I know I’m sharing a lot of state, but I think it’ll be OK, because only one thing (the ChartSubject) is mutating the Charts. Everything else just reads from the Charts.
If you go over to talipp, you’ll see that their indicators have an add and update method. In OnlineTechnicalIndicators.jl, fit! is the equivalent of add, but (as far as I know), there is no equivalent of update. If I want accurate values, I have to wait for candle close before I feed data to it. I’m OK with waiting for candle close, but it’s something to be aware of when using this library.
Everything else aside, my personal preference for organizing indicators is to group them by timeframe.
- Their source data is going to be the same.
- They’re often used together, so it’s convenient that they’re close to each other.
I like to do multi-timeframe analysis.
I get where you’re coming from. What I’m doing may not seem to be in the Erlang spirit of actors not sharing memory and sending messages to each other. However, the only thing I’m sharing is the chart data. Everything else in the async pipeline passes little messages back and forth. Just being able to manage communication between a lot of async processes has been a huge benefit for me.
(As an aside, are actors not allowed to access databases? That’s shared state too. What’s the guiding principle in what can and cannot be shared?)
It might not be as bad as you think. Or maybe it’s worse. We’ll see in a few months. I’m still in a very experimental and exploratory stage, so I’m letting myself make mistakes.