contains_cross_under#
API documentation for tradeexecutor.utils.crossover.contains_cross_under Python function.
- contains_cross_under(series1, series2, lookback_period=2, must_return_index=False)[source]#
Detect if the first series has crossed under the second. To be used in decide_trades()
- Parameters:
- Lookback_period:
The number of periods to look back to detect a crossover.
- Return type:
- bool. True if the series has crossed under the other series in the latest iteration, False otherwise.
If must_return_index is True, also returns the index of the crossover. Note the index is a negative index e.g. -1 is the latest index, -2 is the second latest etc.