File tree Expand file tree Collapse file tree
csharp/equity-atr-volatility-stop
python/equity-atr-volatility-stop Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,10 +72,15 @@ public override void Initialize()
7272 SetStartDate ( 2022 , 1 , 1 ) ;
7373 SetEndDate ( 2024 , 12 , 31 ) ;
7474 SetCash ( 100000 ) ;
75+ // AutomaticIndicatorWarmUp only supports automatic indicators, not manual indicators.
7576 Settings . AutomaticIndicatorWarmUp = true ;
7677
7778 _spy = AddEquity ( "SPY" , Resolution . Minute ) ;
7879 _atr = ATR ( _spy . Symbol , 14 ) ;
80+ // Alternatively, use a manual indicator.
81+ // _atr = new AverageTrueRange(14);
82+ // WarmUpIndicator(_spy.Symbol, _atr);
83+ // RegisterIndicator(_spy.Symbol, _atr);
7984 _trailingHigh = 0m ;
8085 _waitingToReenter = false ;
8186
Original file line number Diff line number Diff line change @@ -7,10 +7,15 @@ def initialize(self) -> None:
77 self .set_start_date (2022 , 1 , 1 )
88 self .set_end_date (2024 , 12 , 31 )
99 self .set_cash (100000 )
10+ # automatic_indicator_warm_up only supports automatic indicators, not manual indicators.
1011 self .settings .automatic_indicator_warm_up = True
1112
1213 self ._spy = self .add_equity ("SPY" , Resolution .MINUTE )
1314 self ._atr = self .atr (self ._spy .symbol , 14 )
15+ # Alternatively, use a manual indicator.
16+ # self._atr = AverageTrueRange(14)
17+ # self.warm_up_indicator(self._spy, self._atr)
18+ # self.register_indicator(self._spy, self._atr)
1419 self ._trailing_high : float = 0.0
1520 self ._waiting_to_reenter = False
1621
You can’t perform that action at this time.
0 commit comments