Add script for generating Large Moves Down strategy signals

This commit is contained in:
moshferatu 2024-11-17 00:48:19 -08:00
parent 5ba183d06e
commit 5dfd1337ce

View File

@ -0,0 +1,10 @@
from pandas import DataFrame, Series
def signals(data: DataFrame) -> Series:
"""
Generate swing trading signals based the Large Moves (Down) strategy.
Returns a Series with 'L' for long signals and 'N' otherwise.
"""
percent_change = (data['Open'] - data['Close']) / data['Open']
return percent_change.apply(lambda change: 'L' if change >= 0.01 else 'N')