self.initialize

strategies.strategy.Strategy.initialize(self, parameters=None)

Initialize the strategy. Use this lifecycle method to initialize parameters.

This method is called once before the first time the strategy is run.

Returns

Return type

None

Example

>>> # Initialize the strategy
>>> def initialize(self):
>>>   self.sleeptime = 5
>>>   self.ticker = "AAPL"
>>>   self.minutes_before_closing = 5
>>>   self.max_bars = 100
>>> # Initialize the strategy
>>> def initialize(self):
>>>   self.sleeptime = "2S"
>>>   self.count = 0