@@ -9,13 +9,26 @@ def initialize(self) -> None:
99 self .set_start_date (2024 , 9 , 1 )
1010 self .set_end_date (2024 , 12 , 31 )
1111 self .set_cash (100000 )
12+ # automatic_indicator_warm_up only supports automatic indicators, not manual indicators.
1213 self .settings .automatic_indicator_warm_up = True
1314 self ._spy = self .add_equity ("SPY" )
1415 self ._trend = IndicatorExtensions .minus (
15- self .ema (self ._spy , 50 , Resolution .DAILY ),
16+ self .ema (self ._spy , 50 , Resolution .DAILY ),
1617 self .ema (self ._spy , 200 , Resolution .DAILY )
1718 )
19+ # Alternatively, use a manual indicator.
20+ # self._ema_fast = ExponentialMovingAverage(50)
21+ # self.warm_up_indicator(self._spy, self._ema_fast, Resolution.DAILY)
22+ # self.register_indicator(self._spy, self._ema_fast, Resolution.DAILY)
23+ # self._ema_slow = ExponentialMovingAverage(200)
24+ # self.warm_up_indicator(self._spy, self._ema_slow, Resolution.DAILY)
25+ # self.register_indicator(self._spy, self._ema_slow, Resolution.DAILY)
26+ # self._trend = IndicatorExtensions.minus(self._ema_fast, self._ema_slow)
1827 self ._adx = self .adx (self ._spy , 14 , Resolution .DAILY )
28+ # Alternatively, use a manual indicator.
29+ # self._adx = AverageDirectionalIndex(14)
30+ # self.warm_up_indicator(self._spy, self._adx, Resolution.DAILY)
31+ # self.register_indicator(self._spy, self._adx, Resolution.DAILY)
1932 self .plot_indicator ("Trend" , self ._trend )
2033 self .plot_indicator ("ADX" , self ._adx )
2134 self .schedule .on (
0 commit comments