添加新的动能理论

This commit is contained in:
jackyu66git
2025-08-02 03:16:57 +08:00
parent f03cae91f7
commit 8f22306766
4 changed files with 413 additions and 6 deletions
+5 -5
View File
@@ -255,8 +255,8 @@ def get_a_stock_kl_data(symbol, timeframe, limit=1000, start_time=None, end_time
return None
def add_indicators(df):
fast = 12
slow = 26
fast = 24
slow = 52
period = 9
macd = ta.MACD(df, fastperiod=fast, slowperiod=slow, signalperiod=period)
@@ -312,10 +312,10 @@ def add_indicators(df):
def calculate_macd(df):
"""计算MACD指标"""
exp1 = df['close'].ewm(span=10, adjust=False).mean()
exp2 = df['close'].ewm(span=26, adjust=False).mean()
exp1 = df['close'].ewm(span=24, adjust=False).mean()
exp2 = df['close'].ewm(span=52, adjust=False).mean()
macd = exp1 - exp2
signal = macd.ewm(span=9, adjust=False).mean()
signal = macd.ewm(span=18, adjust=False).mean()
histogram = macd - signal
return {