Add script for generating swing trading signals based on Lower Lows strategy
This commit is contained in:
parent
4046a4b12c
commit
8de56aae8e
11
strategies/lower_lows.py
Normal file
11
strategies/lower_lows.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
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')
|
Loading…
Reference in New Issue
Block a user