Add script for generating short-term lows strategy signals
This commit is contained in:
parent
f088539163
commit
11c1e7f06b
10
strategies/short_term_lows.py
Normal file
10
strategies/short_term_lows.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
from pandas import DataFrame, Series
|
||||||
|
|
||||||
|
def signals(data: DataFrame) -> Series:
|
||||||
|
"""
|
||||||
|
Generate signals for entering a long trade when the market makes a 10-day low.
|
||||||
|
|
||||||
|
Returns a series with 'L' for long signals and 'N' otherwise.
|
||||||
|
"""
|
||||||
|
ten_day_low = data['Low'] == data['Low'].rolling(window = 10, min_periods = 10).min()
|
||||||
|
return ten_day_low.apply(lambda x: 'L' if x else 'N')
|
Loading…
Reference in New Issue
Block a user