Add script for generating Large Moves Down strategy signals
This commit is contained in:
parent
5ba183d06e
commit
5dfd1337ce
10
strategies/large_moves_down.py
Normal file
10
strategies/large_moves_down.py
Normal 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')
|
Loading…
Reference in New Issue
Block a user