self.first_iteration

property Strategy.first_iteration

Returns True if this is the first iteration of the strategy (is True if the lifecycle method on_trading_iteration is being excuted for the first time).

Returns

first_iteration – True if this is the first iteration of the strategy.

Return type

bool

Example

>>> # Check if this is the first iteration
>>> if self.first_iteration:
>>>     self.log_message("This is the first iteration")