Replies: 1 comment
|
1 and 2. I would make the signal a custom data type with the customdataclass decorator, not an indicator. Live, an actor updates the indicator on each bar and publishes signal N with bar N's timestamps. In the backtest there is no actor, you add the precomputed signals as data.
|
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
I’m trying to understand the recommended NautilusTrader pattern for a strategy that uses a computationally expensive indicator/signal, where:
For example, suppose the strategy consumes bars:
In live trading, I understand that registering an indicator with the relevant bar type allows NautilusTrader to update the indicator before on_bar() is invoked.
My question is how to implement the equivalent pattern when the indicator has been precomputed as historical data.
Ideally I would have something conceptually like:
The important requirement is that the strategy must never observe bar[N] before the corresponding signal for N is available, and conversely the signal must not accidentally be one event behind.
So, my questions are:
For example, if the signal is derived from bar N, how can I guarantee that the precomputed signal for N is available before on_bar(bar_N) executes?
where self.signal is fed incrementally in live trading but sourced from precomputed historical values during backtesting?
5. More generally, what is considered the idiomatic NautilusTrader architecture for maintaining backtest/live parity when a computation is too expensive to perform repeatedly during a large backtest?
Thanks in advance!
All reactions