11 lines
400 B
Python
11 lines
400 B
Python
|
from pandas import DataFrame, Series
|
||
|
|
||
|
def signals(data: DataFrame) -> Series:
|
||
|
"""
|
||
|
Generate signals for entering a long trade when the market makes
|
||
|
a lower low for 2 consecutive days.
|
||
|
|
||
|
Returns a Series with 'L' for long signals and 'N' otherwise.
|
||
|
"""
|
||
|
lower_low = data['Low'].shift(1) > data['Low']
|
||
|
return (lower_low & lower_low.shift(1)).apply(lambda x: 'L' if x else 'N')
|