修改bb取值
This commit is contained in:
+1
-1
@@ -270,7 +270,7 @@ def add_indicators(df):
|
||||
df['rsi'] = ta.RSI(df, timeperiod=14)
|
||||
|
||||
# 计算布林带 (当前周期 - 20周期,2标准差)
|
||||
bb = ta.BBANDS(df, timeperiod=20, nbdevup=2.0, nbdevdn=2.0, matype=0)
|
||||
bb = ta.BBANDS(df, timeperiod=365, nbdevup=3.0, nbdevdn=3.0, matype=0)
|
||||
df['bb_upper'] = bb['upperband'].fillna(0)
|
||||
df['bb_middle'] = bb['middleband'].fillna(0)
|
||||
df['bb_lower'] = bb['lowerband'].fillna(0)
|
||||
|
||||
@@ -3740,7 +3740,7 @@
|
||||
if (fx.fx_strength < 1.0){ // 调整小周期阈值
|
||||
displayText = fx.fx_strength >= 0.6 ? '' : '' // 0.6以上显示点
|
||||
}
|
||||
displayText = fx.fx_type.replace("TOP", "").replace("BOTTOM", "").replace("1", "").replace("2", "").replace("30", "");
|
||||
displayText = fx.fx_type.replace("TOP", "").replace("BOTTOM", "").replace("11", "").replace("21", "").replace("3", "");
|
||||
// 小周期分型标记配置
|
||||
const markerConfig = {
|
||||
time: timestamp,
|
||||
@@ -7003,12 +7003,13 @@
|
||||
.reduce((sum, val) => sum + val, 0) / length;
|
||||
break;
|
||||
case 'EMA':
|
||||
if (i === length - 1) {
|
||||
// 第一个EMA值使用SMA
|
||||
value = sourceData.slice(0, length)
|
||||
const multiplier = 2 / (length + 1);
|
||||
if (result.length === 0) {
|
||||
// 第一个EMA值使用SMA作为种子值
|
||||
value = sourceData.slice(i - length + 1, i + 1)
|
||||
.reduce((sum, val) => sum + val, 0) / length;
|
||||
} else {
|
||||
const multiplier = 2 / (length + 1);
|
||||
// 后续EMA值使用标准公式
|
||||
value = sourceData[i] * multiplier + result[result.length - 1].value * (1 - multiplier);
|
||||
}
|
||||
break;
|
||||
@@ -7052,11 +7053,13 @@
|
||||
.reduce((sum, item) => sum + item.value, 0) / smoothLength;
|
||||
break;
|
||||
case 'EMA':
|
||||
if (i === smoothLength - 1) {
|
||||
value = maData.slice(0, smoothLength)
|
||||
const multiplier = 2 / (smoothLength + 1);
|
||||
if (result.length === 0) {
|
||||
// 第一个EMA值使用SMA作为种子值
|
||||
value = maData.slice(i - smoothLength + 1, i + 1)
|
||||
.reduce((sum, item) => sum + item.value, 0) / smoothLength;
|
||||
} else {
|
||||
const multiplier = 2 / (smoothLength + 1);
|
||||
// 后续EMA值使用标准公式
|
||||
value = maData[i].value * multiplier + result[result.length - 1].value * (1 - multiplier);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user