diff --git a/3in1 copy.pine b/3in1 copy.pine index 53ab35e..bd69bdd 100644 --- a/3in1 copy.pine +++ b/3in1 copy.pine @@ -122,6 +122,14 @@ maType = input.string('Ema', 'Moving Average Type', options=['SMA', 'Hull', 'Ema smoothP = input.int(4, 'Smoothing Period', group='RSI') sig = input.int(6, 'Sigma for ALMA', group='RSI') +// ═════════ SRBR 参数 ════════ +srbrSet = input(false, '═════════ SRBR Parameter ════════') +srbr_lookback_period = input.int(20, "SRBR Lookback Period", minval=1, group='SRBR') +srbr_vol_len = input.int(2, "SRBR Delta Volume Filter Length", tooltip="Higher input, will filter low volume boxes", group='SRBR') +srbr_box_width = input.float(1, "SRBR Adjust Box Width", maxval=1000, minval=0, step=0.1, group='SRBR') +enable_srbr_filter = input.bool(true, title='启用SRBR过滤条件', group='SRBR') +show_srbr_debug = input.bool(false, title='显示SRBR调试信息', group='SRBR') + // ═════════ 多时间框架设置 ════════ mtfSet = input(false, '═════════ Multi-Timeframe Settings ════════') show_mtf_table = input.bool(true, title='显示多时间框架表格', group='MTF') @@ -172,7 +180,7 @@ get_min_volume_ratio() => => min_volume_ratio // ═════════ 成交量分析函数(改进版本) ════════ -// Delta Volume Function - 区分买卖成交量 +// Delta Volume Function - 区分买卖成交量(原版本保留用于成交量过滤) upAndDownVolume() => // 简化版本:根据K线颜色判断成交量性质 if close > open @@ -182,6 +190,25 @@ upAndDownVolume() => else 0.0 // 十字星,中性成交量 +// ═════════ SRBR专用成交量函数(完整保留原始逻辑) ════════ +// SRBR Delta Volume Function - 完全按照原始SRBR逻辑 +srbr_upAndDownVolume() => + posVol = 0.0 + negVol = 0.0 + + var isBuyVolume = true + + switch + close > open => isBuyVolume := true + close < open => isBuyVolume := false + + if isBuyVolume + posVol += volume + else + negVol -= volume + + posVol + negVol + // 成交量过滤函数(温和版本,只过滤明显假信号) get_volume_filter() => Vol = upAndDownVolume()