What kind
Originally Posted by DisplayName
In the end I want to have a call function which loads the external data and this should called only once and not in every run.

What exactly is this data? Is it price data? Is it just an indicator? Is it saved to disk? Is it a timeseries? Do you simply need the latest value in the timeseries relative to the timestamp of the current bar?

The answers to these questions will affect my recommendation. There's a 90% chance your approach is sub-optimal in the first place.