添加新的识别
This commit is contained in:
@@ -40,6 +40,19 @@ weightVolume = input.float(20, "成交量权重 %", minval=0, maxval=100,
|
||||
weightRecency = input.float(10, "时效性权重 %", minval=0, maxval=100, group=strengthGroup)
|
||||
reactionBars = input.int(5, "反应检测K线数", minval=1, maxval=20, group=strengthGroup, tooltip="检测触碰后多少根K线的价格反应")
|
||||
|
||||
// EMA设置
|
||||
emaGroup = "EMA线"
|
||||
showEMA = input.bool(true, "显示EMA", group=emaGroup)
|
||||
ema6 = input.int(6, "EMA周期1", minval=1, group=emaGroup)
|
||||
ema12 = input.int(12, "EMA周期2", minval=1, group=emaGroup)
|
||||
ema24 = input.int(24, "EMA周期3", minval=1, group=emaGroup)
|
||||
ema52 = input.int(52, "EMA周期4", minval=1, group=emaGroup)
|
||||
emaWidth = input.int(2, "EMA线宽", minval=1, maxval=5, group=emaGroup)
|
||||
color6 = input.color(#FF6B9D, "EMA6色", group=emaGroup)
|
||||
color12 = input.color(#C44569, "EMA12色", group=emaGroup)
|
||||
color24 = input.color(#FFA502, "EMA24色", group=emaGroup)
|
||||
color52 = input.color(#26A69A, "EMA52色", group=emaGroup)
|
||||
|
||||
// 显示设置
|
||||
displayGroup = "显示设置"
|
||||
maxVisibleLevels = input.int(12, "最多显示水平数", minval=1, maxval=50, group=displayGroup)
|
||||
@@ -87,6 +100,12 @@ atrValue = ta.atr(atrLength)
|
||||
clusterTolerance = atrValue * clusterTolATR
|
||||
avgVolume = ta.sma(volume, 50)
|
||||
|
||||
// 计算EMA线
|
||||
ema6Value = showEMA ? ta.ema(close, ema6) : na
|
||||
ema12Value = showEMA ? ta.ema(close, ema12) : na
|
||||
ema24Value = showEMA ? ta.ema(close, ema24) : na
|
||||
ema52Value = showEMA ? ta.ema(close, ema52) : na
|
||||
|
||||
// ========== 辅助函数 ========== //
|
||||
|
||||
// 标签大小转换
|
||||
@@ -460,6 +479,13 @@ if not na(pivotLow)
|
||||
f_cleanup_old_levels()
|
||||
f_draw_levels()
|
||||
|
||||
// 绘制EMA线
|
||||
plot(showEMA ? ema6Value : na, "EMA6", color=color6, linewidth=emaWidth, style=plot.style_line)
|
||||
plot(showEMA ? ema12Value : na, "EMA12", color=color12, linewidth=emaWidth, style=plot.style_line)
|
||||
plot(showEMA ? ema24Value : na, "EMA24", color=color24, linewidth=emaWidth, style=plot.style_line)
|
||||
plot(showEMA ? ema52Value : na, "EMA52", color=color52, linewidth=emaWidth, style=plot.style_line)
|
||||
|
||||
|
||||
// 计算最近的支撑和压力
|
||||
var float nearestSupport = na
|
||||
var float nearestResistance = na
|
||||
|
||||
Reference in New Issue
Block a user