From 5dfd1337ceec02fd3c966e92839692773f5a9a7b Mon Sep 17 00:00:00 2001 From: moshferatu Date: Sun, 17 Nov 2024 00:48:19 -0800 Subject: [PATCH] Add script for generating Large Moves Down strategy signals --- strategies/large_moves_down.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 strategies/large_moves_down.py diff --git a/strategies/large_moves_down.py b/strategies/large_moves_down.py new file mode 100644 index 0000000..b378a58 --- /dev/null +++ b/strategies/large_moves_down.py @@ -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') \ No newline at end of file