修改了macd数值
This commit is contained in:
@@ -158,3 +158,5 @@ cython_debug/
|
|||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
.DS_Store
|
||||||
|
.DS_Store
|
||||||
|
|||||||
+3
-3
@@ -325,10 +325,10 @@ def add_indicators(df):
|
|||||||
|
|
||||||
def calculate_macd(df):
|
def calculate_macd(df):
|
||||||
"""计算MACD指标"""
|
"""计算MACD指标"""
|
||||||
exp1 = df['close'].ewm(span=24, adjust=False).mean()
|
exp1 = df['close'].ewm(span=12, adjust=False).mean()
|
||||||
exp2 = df['close'].ewm(span=52, adjust=False).mean()
|
exp2 = df['close'].ewm(span=26, adjust=False).mean()
|
||||||
macd = exp1 - exp2
|
macd = exp1 - exp2
|
||||||
signal = macd.ewm(span=18, adjust=False).mean()
|
signal = macd.ewm(span=9, adjust=False).mean()
|
||||||
histogram = macd - signal
|
histogram = macd - signal
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user