//@version=6 indicator('Mean Reversion Channel - 带价格标签 -ma200', shorttitle = 'MRC2ma200', overlay = true, format = format.inherit) //************************************************************************************************************ // Parameter //************************************************************************************************************ indiSet = input(false, '═════════ MRC Parameter ════════') source = input(hlc3, title = 'Price Source') type = input.string('SuperSmoother', title = 'Filter Type', options = ['SuperSmoother', 'Ehlers EMA', 'Gaussian', 'Butterworth', 'BandStop', 'SMA', 'EMA', 'RMA']) length = input.int(200, title = 'Lookback Period', minval = 1) innermult = input.float(1.0, title = 'Inner Channel Size Multiplier', minval = 0.1) outermult = input.float(2.415, title = 'Outer Channel Size Multiplier', minval = 0.1) // ————————————— MA200 参数 ————————————— maSet = input(false, '═════════ MA200 Parameter ════════') exponential = input.bool(true, title='使用指数移动平均线 (EMA)') show_ma_lines = input.bool(true, title='显示MA线条') show_ma_labels = input.bool(true, title='显示MA价格标签') ChartSet = input(false, '═════════ Chart Setting ════════') drawchannel = input(true, title = 'Draw Channel') displayzone = input(true, title = 'Draw Zone (With Channel)') zonetransp = input.int(60, title = 'Zone Transparency', minval = 0, maxval = 100) displayline = input(true, title = 'Display Line Extension') MTFSet = input(false, '═════════ MTF Setting ════════') enable_mtf = input(true, title = 'Enable Multiple TimeFrame Analysis') mtf_disp_typ = input.string('On Hover', title = 'MTF Display Type', options = ['Always Display', 'On Hover']) mtf_typ = input.string('Auto', title = 'Multiple TimeFrame Type', options = ['Auto', 'Custom']) mtf_lvl1 = input.timeframe('D', title = 'Custom MTF Level 1') mtf_lvl2 = input.timeframe('W', title = 'Custom MTF Level 2') //************************************************************************************************************ // Functions Start { //************************************************************************************************************ var pi = 2 * math.asin(1) var mult = pi * innermult var mult2 = pi * outermult var gradsize = 0.5 var gradtransp = zonetransp //----------------------- // Ehler SwissArmyKnife Function //----------------------- SAK_smoothing(_type, _src, _length) => c0 = 1.0 c1 = 0.0 b0 = 1.0 b1 = 0.0 b2 = 0.0 a1 = 0.0 a2 = 0.0 alpha = 0.0 beta = 0.0 gamma = 0.0 cycle = 2 * pi / _length if _type == 'Ehlers EMA' alpha := (math.cos(cycle) + math.sin(cycle) - 1) / math.cos(cycle) b0 := alpha a1 := 1 - alpha a1 if _type == 'Gaussian' beta := 2.415 * (1 - math.cos(cycle)) alpha := -beta + math.sqrt(beta * beta + 2 * beta) c0 := alpha * alpha a1 := 2 * (1 - alpha) a2 := -(1 - alpha) * (1 - alpha) a2 if _type == 'Butterworth' beta := 2.415 * (1 - math.cos(cycle)) alpha := -beta + math.sqrt(beta * beta + 2 * beta) c0 := alpha * alpha / 4 b1 := 2 b2 := 1 a1 := 2 * (1 - alpha) a2 := -(1 - alpha) * (1 - alpha) a2 if _type == 'BandStop' beta := math.cos(cycle) gamma := 1 / math.cos(cycle * 2 * 0.1) // delta default to 0.1. Acceptable delta -- 0.05 s_a1 = math.exp(-math.sqrt(2) * pi / _length) s_b1 = 2 * s_a1 * math.cos(math.sqrt(2) * pi / _length) s_c3 = -math.pow(s_a1, 2) s_c2 = s_b1 s_c1 = 1 - s_c2 - s_c3 ss = 0.0 ss := s_c1 * _src + s_c2 * nz(ss[1], _src[1]) + s_c3 * nz(ss[2], _src[2]) ss //----------------------- // Auto TimeFrame Function //----------------------- // ————— Converts current chart resolution into a float minutes value. f_resInMinutes() => _resInMinutes = timeframe.multiplier * (timeframe.isseconds ? 1. / 60 : timeframe.isminutes ? 1. : timeframe.isdaily ? 60. * 24 : timeframe.isweekly ? 60. * 24 * 7 : timeframe.ismonthly ? 60. * 24 * 30.4375 : na) _resInMinutes get_tf(_lvl) => y = f_resInMinutes() z = timeframe.period if mtf_typ == 'Auto' if y < 1 z := _lvl == 1 ? '1' : _lvl == 2 ? '5' : z z else if y <= 3 z := _lvl == 1 ? '5' : _lvl == 2 ? '15' : z z else if y <= 10 z := _lvl == 1 ? '15' : _lvl == 2 ? '60' : z z else if y <= 30 z := _lvl == 1 ? '60' : _lvl == 2 ? '240' : z z else if y <= 120 z := _lvl == 1 ? '240' : _lvl == 2 ? 'D' : z z else if y <= 240 z := _lvl == 1 ? 'D' : _lvl == 2 ? 'W' : z z else if y <= 1440 z := _lvl == 1 ? 'W' : _lvl == 2 ? 'M' : z z else if y <= 10080 z := _lvl == 1 ? 'M' : z z else z := z z else z := _lvl == 1 ? mtf_lvl1 : _lvl == 2 ? mtf_lvl2 : z z z //----------------------- // Mean Reversion Channel Function //----------------------- get_mrc() => v_condition = 0 v_meanline = source v_meanrange = supersmoother(ta.tr, length) //-- Get Line value if type == 'SuperSmoother' v_meanline := supersmoother(source, length) v_meanline if type != 'SuperSmoother' v_meanline := SAK_smoothing(type, source, length) v_meanline v_upband1 = v_meanline + v_meanrange * mult v_loband1 = v_meanline - v_meanrange * mult v_upband2 = v_meanline + v_meanrange * mult2 v_loband2 = v_meanline - v_meanrange * mult2 //-- Check Condition if close > v_meanline v_upband2_1 = v_upband2 + v_meanrange * gradsize * 4 v_upband2_9 = v_upband2 + v_meanrange * gradsize * -4 if high >= v_upband2_9 and high < v_upband2 v_condition := 1 v_condition else if high >= v_upband2 and high < v_upband2_1 v_condition := 2 v_condition else if high >= v_upband2_1 v_condition := 3 v_condition else if close <= v_meanline + v_meanrange v_condition := 4 v_condition else v_condition := 5 v_condition if close < v_meanline v_loband2_1 = v_loband2 - v_meanrange * gradsize * 4 v_loband2_9 = v_loband2 - v_meanrange * gradsize * -4 if low <= v_loband2_9 and low > v_loband2 v_condition := -1 v_condition else if low <= v_loband2 and low > v_loband2_1 v_condition := -2 v_condition else if low <= v_loband2_1 v_condition := -3 v_condition else if close >= v_meanline + v_meanrange v_condition := -4 v_condition else v_condition := -5 v_condition [v_meanline, v_meanrange, v_upband1, v_loband1, v_upband2, v_loband2, v_condition] //----------------------- // MTF Analysis //----------------------- get_stat(_cond) => ret = 'Price at Mean Line\n' if _cond == 1 ret := 'Overbought (Weak)\n' ret else if _cond == 2 ret := 'Overbought\n' ret else if _cond == 3 ret := 'Overbought (Strong)\n' ret else if _cond == 4 ret := 'Price Near Mean\n' ret else if _cond == 5 ret := 'Price Above Mean\n' ret else if _cond == -1 ret := 'Oversold (Weak)\n' ret else if _cond == -2 ret := 'Oversold\n' ret else if _cond == -3 ret := 'Oversold (Strong)\n' ret else if _cond == -4 ret := 'Price Near Mean\n' ret else if _cond == -5 ret := 'Price Below Mean\n' ret ret //----------------------- // Chart Drawing Function //----------------------- format_price(x) => y = str.tostring(x, '0.00000') if x > 10 y := str.tostring(x, '0.000') y if x > 1000 y := str.tostring(x, '0.00') y y f_PriceLine(_ref, linecol) => line.new(x1 = bar_index, x2 = bar_index - 1, y1 = _ref, y2 = _ref, extend = extend.left, color = linecol) f_MTFLabel(_txt, _yloc) => label.new(x = time + math.round(ta.change(time) * 20), y = _yloc, xloc = xloc.bar_time, text = mtf_disp_typ == 'Always Display' ? _txt : 'Check MTF', tooltip = mtf_disp_typ == 'Always Display' ? '' : _txt, color = color.black, textcolor = color.white, size = size.normal, style = mtf_disp_typ == 'On Hover' and displayline ? label.style_label_lower_left : label.style_label_left, textalign = text.align_left) //} Function End //************************************************************************************************************ // Calculate MA200, MA100, MA50 //************************************************************************************************************ // ————————————— 计算移动平均线 ————————————— src = close ma50 = exponential ? ta.ema(src, 50) : ta.sma(src, 50) ma100 = exponential ? ta.ema(src, 100) : ta.sma(src, 100) ma200 = exponential ? ta.ema(src, 200) : ta.sma(src, 200) // ————————————— 移动平均线颜色函数 ————————————— maColor(ma, ref) => ma > ref ? color.lime : color.red //************************************************************************************************************ // Calculate Channel //************************************************************************************************************ var tf_0 = timeframe.period var tf_1 = get_tf(1) var tf_2 = get_tf(2) [meanline, meanrange, upband1, loband1, upband2, loband2, condition] = get_mrc() [mtf1_meanline, mtf1_meanrange, mtf1_upband1, mtf1_loband1, mtf1_upband2, mtf1_loband2, mtf1_condition] = request.security(syminfo.tickerid, tf_1, get_mrc()) [mtf2_meanline, mtf2_meanrange, mtf2_upband1, mtf2_loband1, mtf2_upband2, mtf2_loband2, mtf2_condition] = request.security(syminfo.tickerid, tf_2, get_mrc()) //************************************************************************************************************ // Drawing Start { //************************************************************************************************************ float p_meanline = drawchannel ? meanline : na float p_upband1 = drawchannel ? upband1 : na float p_loband1 = drawchannel ? loband1 : na float p_upband2 = drawchannel ? upband2 : na float p_loband2 = drawchannel ? loband2 : na // 保留 MEAN、R1、S1 的绘制用于警报,注释掉 R2、S2 z = plot(p_meanline, color = color.new(color.black, 0), style = plot.style_line, title = ' Mean', linewidth = 2) x1 = plot(p_upband1, color = color.new(color.black, 0), style = plot.style_line, title = ' R1', linewidth = 2) x2 = plot(p_loband1, color = color.new(color.black, 0), style = plot.style_line, title = ' S1', linewidth = 2) // 注释掉 R2、S2 的绘制以减少线条数量 // y1 = plot(p_upband2, color = color.new(color.red, 50), style = plot.style_line, title = ' R2', linewidth = 1) // y2 = plot(p_loband2, color = color.new(color.red, 50), style = plot.style_line, title = ' S2', linewidth = 1) // ————————————— 绘制 MA50/MA100/MA200 ————————————— plot(show_ma_lines ? ma50 : na, color=maColor(ma50, ma100), linewidth=2, title='MA50', display=display.all) plot(show_ma_lines ? ma100 : na, color=maColor(ma100, ma200), linewidth=2, title='MA100', display=display.all) plot(show_ma_lines ? ma200 : na, color=color.rgb(25, 58, 243), linewidth=4, title='MA200', display=display.all) //----------------------- // Draw zone //----------------------- //--- var color1 = #FF0000 var color2 = #FF4200 var color3 = #FF5D00 var color4 = #FF7400 var color5 = #FF9700 var color6 = #FFAE00 var color7 = #FFC500 var color8 = #FFCD00 //--- float upband2_1 = drawchannel and displayzone ? upband2 + meanrange * gradsize * 4 : na float loband2_1 = drawchannel and displayzone ? loband2 - meanrange * gradsize * 4 : na float upband2_2 = drawchannel and displayzone ? upband2 + meanrange * gradsize * 3 : na float loband2_2 = drawchannel and displayzone ? loband2 - meanrange * gradsize * 3 : na float upband2_3 = drawchannel and displayzone ? upband2 + meanrange * gradsize * 2 : na float loband2_3 = drawchannel and displayzone ? loband2 - meanrange * gradsize * 2 : na float upband2_4 = drawchannel and displayzone ? upband2 + meanrange * gradsize * 1 : na float loband2_4 = drawchannel and displayzone ? loband2 - meanrange * gradsize * 1 : na float upband2_5 = drawchannel and displayzone ? upband2 + meanrange * gradsize * 0 : na float loband2_5 = drawchannel and displayzone ? loband2 - meanrange * gradsize * 0 : na float upband2_6 = drawchannel and displayzone ? upband2 + meanrange * gradsize * -1 : na float loband2_6 = drawchannel and displayzone ? loband2 - meanrange * gradsize * -1 : na float upband2_7 = drawchannel and displayzone ? upband2 + meanrange * gradsize * -2 : na float loband2_7 = drawchannel and displayzone ? loband2 - meanrange * gradsize * -2 : na float upband2_8 = drawchannel and displayzone ? upband2 + meanrange * gradsize * -3 : na float loband2_8 = drawchannel and displayzone ? loband2 - meanrange * gradsize * -3 : na float upband2_9 = drawchannel and displayzone ? upband2 + meanrange * gradsize * -4 : na float loband2_9 = drawchannel and displayzone ? loband2 - meanrange * gradsize * -4 : na //--- // 注释掉扩展区域的 plot 以减少线条数量,避免超过 TradingView 64条线限制 // 保留计算但不绘制,警报仍可使用这些值 // plot_upband2_1 = plot(upband2_1, color = na, title = 'R2_1') // plot_loband2_1 = plot(loband2_1, color = na, title = 'S2_1') // 注释掉其他隐藏的 plot // plot_upband2_2 = plot(upband2_2, color = na, display = display.none) // plot_loband2_2 = plot(loband2_2, color = na, display = display.none) // plot_upband2_3 = plot(upband2_3, color = na, display = display.none) // plot_loband2_3 = plot(loband2_3, color = na, display = display.none) // plot_upband2_4 = plot(upband2_4, color = na, display = display.none) // plot_loband2_4 = plot(loband2_4, color = na, display = display.none) // plot_upband2_5 = plot(upband2_5, color = na, display = display.none) // plot_loband2_5 = plot(loband2_5, color = na, display = display.none) // plot_upband2_6 = plot(upband2_6, color = na, display = display.none) // plot_loband2_6 = plot(loband2_6, color = na, display = display.none) // plot_upband2_7 = plot(upband2_7, color = na, display = display.none) // plot_loband2_7 = plot(loband2_7, color = na, display = display.none) // plot_upband2_8 = plot(upband2_8, color = na, display = display.none) // plot_loband2_8 = plot(loband2_8, color = na, display = display.none) // 注释掉 R2_9 和 S2_9 的 plot // plot_upband2_9 = plot(upband2_9, color = na, title = 'R2_9') // plot_loband2_9 = plot(loband2_9, color = na, title = 'S2_9') //--- // 注释掉扩展区域的填充,减少绘制元素 // fill(plot_upband2_1, plot_upband2_2, color = color1) // fill(plot_loband2_1, plot_loband2_2, color = color1) // fill(plot_upband2_2, plot_upband2_3, color = color2) // fill(plot_loband2_2, plot_loband2_3, color = color2) // fill(plot_upband2_3, plot_upband2_4, color = color3) // fill(plot_loband2_3, plot_loband2_4, color = color3) // fill(plot_upband2_4, plot_upband2_5, color = color4) // fill(plot_loband2_4, plot_loband2_5, color = color4) // fill(plot_upband2_5, plot_upband2_6, color = color5) // fill(plot_loband2_5, plot_loband2_6, color = color5) // fill(plot_upband2_6, plot_upband2_7, color = color6) // fill(plot_loband2_6, plot_loband2_7, color = color6) // fill(plot_upband2_7, plot_upband2_8, color = color7) // fill(plot_loband2_7, plot_loband2_8, color = color7) // fill(plot_upband2_8, plot_upband2_9, color = color8) // fill(plot_loband2_8, plot_loband2_9, color = color8) //----------------------- // Plot Extension //----------------------- if displayline and enable_mtf and mtf_disp_typ == 'Always Display' displayline := false displayline var line mean = na line.delete(mean) mean := displayline ? f_PriceLine(meanline, #FFCD00) : na var line res1 = na line.delete(res1) res1 := displayline ? f_PriceLine(upband1, color.green) : na var line sup1 = na line.delete(sup1) sup1 := displayline ? f_PriceLine(loband1, color.green) : na var line res2 = na line.delete(res2) res2 := displayline ? f_PriceLine(upband2, color.red) : na var line sup2 = na line.delete(sup2) sup2 := displayline ? f_PriceLine(loband2, color.red) : na //-------------- // Prep MTF Label //-------------- var brl = '\n--------------------------------------' dist_0 = 'Distance from Mean: ' + str.tostring((close - meanline) / close * 100, '#.##') + ' %' dist_1 = 'Distance from Mean: ' + str.tostring((close - mtf1_meanline) / close * 100, '#.##') + ' %' dist_2 = 'Distance from Mean: ' + str.tostring((close - mtf2_meanline) / close * 100, '#.##') + ' %' var title = 'Mean Reversion Channel\nMultiple TimeFrame Analysis' + brl tf0 = '\n\nTimeframe: ' + tf_0 + ' (Current)\n\nStatus: ' + get_stat(condition) + dist_0 + brl tf1 = not timeframe.ismonthly ? '\n\nTimeframe: ' + tf_1 + '\n\nStatus: ' + get_stat(mtf1_condition) + dist_1 + brl : '' tf2 = not timeframe.isweekly and not timeframe.ismonthly ? '\n\nTimeframe: ' + tf_2 + '\n\nStatus: ' + get_stat(mtf2_condition) + dist_2 + brl : '' mtf_lbl = title + tf0 + tf1 + tf2 var label label_mtf = na label.delete(label_mtf) label_mtf := enable_mtf ? f_MTFLabel(mtf_lbl, meanline) : na //************************************************************************************************************ // Real-time Price Labels for Extended Lines (Placed on the right side of the last candle) //************************************************************************************************************ // Define persistent label variables so that they update rather than create new labels each bar var label mean_label = na var label res1_label = na var label sup1_label = na var label res2_label = na var label sup2_label = na var label res2_9_label = na // Label for upband2_9 var label sup2_9_label = na // Label for loband2_9 var label res2_1_label = na // New label for upband2_1 var label sup2_1_label = na // New label for loband2_1 if displayline and barstate.islast // MEAN label if na(mean_label) mean_label := label.new(bar_index, meanline, "MEAN: " + format_price(meanline), xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.black, 0), textcolor = color.white) else label.set_xy(mean_label, bar_index, meanline) label.set_text(mean_label, "MEAN: " + format_price(meanline)) // R1 label if na(res1_label) res1_label := label.new(bar_index, upband1, "R1: " + format_price(upband1), xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.green, 0), textcolor = color.white) else label.set_xy(res1_label, bar_index, upband1) label.set_text(res1_label, "R1: " + format_price(upband1)) // S1 label if na(sup1_label) sup1_label := label.new(bar_index, loband1, "S1: " + format_price(loband1), xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.green, 0), textcolor = color.white) else label.set_xy(sup1_label, bar_index, loband1) label.set_text(sup1_label, "S1: " + format_price(loband1)) // R2 label if na(res2_label) res2_label := label.new(bar_index, upband2, "R2: " + format_price(upband2), xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.red, 0), textcolor = color.white) else label.set_xy(res2_label, bar_index, upband2) label.set_text(res2_label, "R2: " + format_price(upband2)) // S2 label if na(sup2_label) sup2_label := label.new(bar_index, loband2, "S2: " + format_price(loband2), xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.red, 0), textcolor = color.white) else label.set_xy(sup2_label, bar_index, loband2) label.set_text(sup2_label, "S2: " + format_price(loband2)) // R2_9 label (for upband2_9) if na(res2_9_label) res2_9_label := label.new(bar_index, upband2_9, "R2_9: " + format_price(upband2_9), xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.red, 50), textcolor = color.white) else label.set_xy(res2_9_label, bar_index, upband2_9) label.set_text(res2_9_label, "R2_9: " + format_price(upband2_9)) // S2_9 label (for loband2_9) if na(sup2_9_label) sup2_9_label := label.new(bar_index, loband2_9, "S2_9: " + format_price(loband2_9), xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.red, 50), textcolor = color.white) else label.set_xy(sup2_9_label, bar_index, loband2_9) label.set_text(sup2_9_label, "S2_9: " + format_price(loband2_9)) // R2_1 label (New for upband2_1) if na(res2_1_label) res2_1_label := label.new(bar_index, upband2_1, "R2_1: " + format_price(upband2_1), xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.red, 50), textcolor = color.white) else label.set_xy(res2_1_label, bar_index, upband2_1) label.set_text(res2_1_label, "R2_1: " + format_price(upband2_1)) // S2_1 label (New for loband2_1) if na(sup2_1_label) sup2_1_label := label.new(bar_index, loband2_1, "S2_1: " + format_price(loband2_1), xloc = xloc.bar_index, style = label.style_label_left, color = color.new(color.red, 50), textcolor = color.white) else label.set_xy(sup2_1_label, bar_index, loband2_1) label.set_text(sup2_1_label, "S2_1: " + format_price(loband2_1)) //************************************************************************************************************ // MA Price Labels (Placed on the right side of the last candle) //************************************************************************************************************ // ————————————— MA价格标签(单行 label.new) ————————————— var label lbl50 = na var label lbl100 = na var label lbl200 = na if show_ma_labels and barstate.islast if na(lbl50) lbl50 := label.new(x=time, y=ma50, text='MA50: ' + str.tostring(ma50, '#.####'), xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.lime, textcolor=color.white) else label.set_xy(lbl50, x=time, y=ma50), label.set_text(lbl50, 'MA50: ' + str.tostring(ma50, '#.####')) if na(lbl100) lbl100 := label.new(x=time, y=ma100, text='MA100: ' + str.tostring(ma100, '#.####'), xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.white, textcolor=color.black) else label.set_xy(lbl100, x=time, y=ma100), label.set_text(lbl100, 'MA100: ' + str.tostring(ma100, '#.####')) if na(lbl200) lbl200 := label.new(x=time, y=ma200, text='MA200: ' + str.tostring(ma200, '#.####'), xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_left, color=color.white, textcolor=color.black) else label.set_xy(lbl200, x=time, y=ma200), label.set_text(lbl200, 'MA200: ' + str.tostring(ma200, '#.####')) //************************************************************************************************************ // ===== 统一警报系统 ===== // 统一警报系统 - 只需添加一次警报即可捕获所有信号 //************************************************************************************************************ // 警报频率限制 - 每分钟只触发一次 var int last_alert_r1_breakout_up = 0 var int last_alert_s1_breakout_down = 0 var int last_alert_range_r1_s1 = 0 var int last_alert_above_r1 = 0 var int last_alert_below_s1 = 0 var int last_alert_above_mean = 0 var int last_alert_below_mean = 0 var int last_alert_mean_above_ma200 = 0 var int last_alert_mean_below_ma200 = 0 var int last_alert_mean_above_ma50 = 0 var int last_alert_mean_below_ma50 = 0 var int last_alert_mean_above_ma100 = 0 var int last_alert_mean_below_ma100 = 0 // 获取当前时间(分钟级别) current_minute = math.floor(timenow / 60000) // 检测所有警报条件并生成对应的JSON消息 alert_message = "" // 价格触碰关键位置警报 // if ta.cross(close, meanline) // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow, "yyyy-MM-dd HH:mm:ss") + '","时间":"' + str.tostring(time, "yyyy-MM-dd HH:mm:ss") + '","事件":"碰到MEAN","位置":"MEAN","信号":"mean_touch"}' // alert(alert_message, alert.freq_once_per_bar_close) // if ta.cross(close, upband1) // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow, "yyyy-MM-dd HH:mm:ss") + '","时间":"' + str.tostring(time, "yyyy-MM-dd HH:mm:ss") + '","事件":"碰到R1","位置":"R1","信号":"r1_touch"}' // alert(alert_message, alert.freq_once_per_bar_close) // if ta.cross(close, loband1) // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow, "yyyy-MM-dd HH:mm:ss") + '","时间":"' + str.tostring(time, "yyyy-MM-dd HH:mm:ss") + '","事件":"碰到S1","位置":"S1","信号":"s1_touch"}' // alert(alert_message, alert.freq_once_per_bar_close) // if ta.cross(close, upband2) // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow, "yyyy-MM-dd HH:mm:ss") + '","时间":"' + str.tostring(time, "yyyy-MM-dd HH:mm:ss") + '","事件":"碰到R2","位置":"R2","信号":"r2_touch"}' // alert(alert_message, alert.freq_once_per_bar_close) // if ta.cross(close, loband2) // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow, "yyyy-MM-dd HH:mm:ss") + '","时间":"' + str.tostring(time, "yyyy-MM-dd HH:mm:ss") + '","事件":"碰到S2","位置":"S2","信号":"s2_touch"}' // alert(alert_message, alert.freq_once_per_bar_close) // 价格区间警报 // if close > meanline and close < upband1 // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格处于MEAN和R1之间","位置":"MEAN-R1","信号":"range_mean_r1"}' // alert(alert_message, alert.freq_once_per_bar) // if close < meanline and close > loband1 // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格处于MEAN和S1之间","位置":"MEAN-S1","信号":"range_mean_s1"}' // alert(alert_message, alert.freq_once_per_bar) // if close > upband1 and close < upband2 // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格处于R1和R2之间","位置":"R1-R2","信号":"range_r1_r2"}' // alert(alert_message, alert.freq_once_per_bar) // if close < loband1 and close > loband2 // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格处于S1和S2之间","位置":"S1-S2","信号":"range_s1_s2"}' // alert(alert_message, alert.freq_once_per_bar) // if close > upband1 and close < upband2_9 // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格处于R1和R2_9之间","位置":"R1-R2_9","信号":"range_r1_r2_9"}' // alert(alert_message, alert.freq_once_per_bar) // if close > upband2_9 and close < upband2_1 // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格处于R2_9和R2_1之间","位置":"R2_9-R2_1","信号":"range_r2_9_r2_1"}' // alert(alert_message, alert.freq_once_per_bar) // if close < loband1 and close > loband2_9 // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格处于S1和S2_9之间","位置":"S1-S2_9","信号":"range_s1_s2_9"}' // alert(alert_message, alert.freq_once_per_bar) // if close < loband2_9 and close > loband2_1 // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格处于S2_9和S2_1之间","位置":"S2_9-S2_1","信号":"range_s2_9_s2_1"}' // alert(alert_message, alert.freq_once_per_bar) // // 价格穿越警报 - 每分钟限制 // if ta.crossover(close, upband1) and current_minute > last_alert_r1_breakout_up // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格上穿R1","位置":"R1","信号":"r1_breakout_up"}' // alert(alert_message, alert.freq_once_per_bar_close) // last_alert_r1_breakout_up := current_minute // if ta.crossunder(close, upband1) // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格下穿R1","位置":"R1","信号":"r1_breakout_down"}' // alert(alert_message, alert.freq_once_per_bar_close) // if ta.crossunder(close, loband1) and current_minute > last_alert_s1_breakout_down // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格下穿S1","位置":"S1","信号":"s1_breakout_down"}' // alert(alert_message, alert.freq_once_per_bar_close) // last_alert_s1_breakout_down := current_minute // if ta.crossover(close, loband1) // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格上穿S1","位置":"S1","信号":"s1_breakout_up"}' // alert(alert_message, alert.freq_once_per_bar_close) // if ta.crossover(close, meanline) // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格上穿MEAN","位置":"MEAN","信号":"mean_breakout_up"}' // alert(alert_message, alert.freq_once_per_bar_close) // if ta.crossunder(close, meanline) // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格下穿MEAN","位置":"MEAN","信号":"mean_breakout_down"}' // alert(alert_message, alert.freq_once_per_bar_close) // if ta.crossover(close, loband2_9) // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格上穿S2_9","位置":"S2_9","信号":"s2_9_breakout_up"}' // alert(alert_message, alert.freq_once_per_bar_close) // if ta.crossunder(close, loband2_9) // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格下穿S2_9","位置":"S2_9","信号":"s2_9_breakout_down"}' // alert(alert_message, alert.freq_once_per_bar_close) // if ta.crossover(close, upband2_9) // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格上穿R2_9","位置":"R2_9","信号":"r2_9_breakout_up"}' // alert(alert_message, alert.freq_once_per_bar_close) // if ta.crossunder(close, upband2_9) // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格下穿R2_9","位置":"R2_9","信号":"r2_9_breakout_down"}' // alert(alert_message, alert.freq_once_per_bar_close) // ===== 新增的5个警报条件 - 每分钟限制 ===== // 1. 价格处于R1和S1之间时 // if close <= upband1 and close >= loband1 and current_minute > last_alert_range_r1_s1 // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格处于R1和S1之间","位置":"R1-S1区间","信号":"range_r1_s1"}' // alert(alert_message, alert.freq_once_per_bar) // last_alert_range_r1_s1 := current_minute // // 2. 价格处于R1以上时 // if close > upband1 and current_minute > last_alert_above_r1 // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格处于R1以上","位置":"R1以上","信号":"above_r1"}' // alert(alert_message, alert.freq_once_per_bar) // last_alert_above_r1 := current_minute // // 3. 价格处于S1以下时 // if close < loband1 and current_minute > last_alert_below_s1 // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格处于S1以下","位置":"S1以下","信号":"below_s1"}' // alert(alert_message, alert.freq_once_per_bar) // last_alert_below_s1 := current_minute // // 4. 价格处于MEAN以上时 // if close > meanline and current_minute > last_alert_above_mean // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格处于MEAN以上","位置":"MEAN以上","信号":"above_mean"}' // alert(alert_message, alert.freq_once_per_bar) // last_alert_above_mean := current_minute // // 5. 价格处于MEAN以下时 // if close < meanline and current_minute > last_alert_below_mean // alert_message := '{"指标名称":"MRC","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","R1":"' + str.tostring(upband1, '#.####') + '","S1":"' + str.tostring(loband1, '#.####') + '","R2":"' + str.tostring(upband2, '#.####') + '","S2":"' + str.tostring(loband2, '#.####') + '","R2_9":"' + str.tostring(upband2_9, '#.####') + '","S2_9":"' + str.tostring(loband2_9, '#.####') + '","R2_1":"' + str.tostring(upband2_1, '#.####') + '","S2_1":"' + str.tostring(loband2_1, '#.####') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"价格处于MEAN以下","位置":"MEAN以下","信号":"below_mean"}' // alert(alert_message, alert.freq_once_per_bar) // last_alert_below_mean := current_minute // ===== 新增的MA相关警报条件 - 每分钟限制 ===== // 计算MEAN线与各MA的距离 mean_ma200_distance = math.abs(meanline - ma200) mean_ma50_distance = math.abs(meanline - ma50) mean_ma100_distance = math.abs(meanline - ma100) // 6. MEAN线价格处于MA200以上时 if meanline > ma200 and current_minute > last_alert_mean_above_ma200 alert_message := '{"指标名称":"MA200","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","MA50":"' + str.tostring(ma50, '#.####') + '","MA100":"' + str.tostring(ma100, '#.####') + '","MA200":"' + str.tostring(ma200, '#.####') + '","距离(美元)":"' + str.tostring(mean_ma200_distance, '#.##') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"MEAN线处于MA200以上","位置":"MA200以上"}' alert(alert_message, alert.freq_once_per_bar) last_alert_mean_above_ma200 := current_minute // 7. MEAN线价格处于MA200以下时 if meanline < ma200 and current_minute > last_alert_mean_below_ma200 alert_message := '{"指标名称":"MA200","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","MA50":"' + str.tostring(ma50, '#.####') + '","MA100":"' + str.tostring(ma100, '#.####') + '","MA200":"' + str.tostring(ma200, '#.####') + '","距离(美元)":"' + str.tostring(mean_ma200_distance, '#.##') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"MEAN线处于MA200以下","位置":"MA200以下"}' alert(alert_message, alert.freq_once_per_bar) last_alert_mean_below_ma200 := current_minute // 8. MEAN线价格处于MA50以上时 if meanline > ma50 and current_minute > last_alert_mean_above_ma50 alert_message := '{"指标名称":"MA200","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","MA50":"' + str.tostring(ma50, '#.####') + '","MA100":"' + str.tostring(ma100, '#.####') + '","MA200":"' + str.tostring(ma200, '#.####') + '","距离(美元)":"' + str.tostring(mean_ma50_distance, '#.##') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"MEAN线处于MA50以上","位置":"MA50以上"}' alert(alert_message, alert.freq_once_per_bar) last_alert_mean_above_ma50 := current_minute // 9. MEAN线价格处于MA50以下时 if meanline < ma50 and current_minute > last_alert_mean_below_ma50 alert_message := '{"指标名称":"MA200","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","MA50":"' + str.tostring(ma50, '#.####') + '","MA100":"' + str.tostring(ma100, '#.####') + '","MA200":"' + str.tostring(ma200, '#.####') + '","距离(美元)":"' + str.tostring(mean_ma50_distance, '#.##') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"MEAN线处于MA50以下","位置":"MA50以下"}' alert(alert_message, alert.freq_once_per_bar) last_alert_mean_below_ma50 := current_minute // 10. MEAN线价格处于MA100以上时 if meanline > ma100 and current_minute > last_alert_mean_above_ma100 alert_message := '{"指标名称":"MA200","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","MA50":"' + str.tostring(ma50, '#.####') + '","MA100":"' + str.tostring(ma100, '#.####') + '","MA200":"' + str.tostring(ma200, '#.####') + '","距离(美元)":"' + str.tostring(mean_ma100_distance, '#.##') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"MEAN线处于MA100以上","位置":"MA100以上"}' alert(alert_message, alert.freq_once_per_bar) last_alert_mean_above_ma100 := current_minute // 11. MEAN线价格处于MA100以下时 if meanline < ma100 and current_minute > last_alert_mean_below_ma100 alert_message := '{"指标名称":"MA200","交易对":"' + syminfo.ticker + '","周期":"' + timeframe.period + '","MEAN":"' + str.tostring(meanline, '#.####') + '","MA50":"' + str.tostring(ma50, '#.####') + '","MA100":"' + str.tostring(ma100, '#.####') + '","MA200":"' + str.tostring(ma200, '#.####') + '","距离(美元)":"' + str.tostring(mean_ma100_distance, '#.##') + '","开盘价":"' + str.tostring(open, '#.####') + '","收盘价":"' + str.tostring(close, '#.####') + '","最高价":"' + str.tostring(high, '#.####') + '","最低价":"' + str.tostring(low, '#.####') + '","触发时间":"' + str.tostring(timenow) + '","时间":"' + str.tostring(time) + '","事件":"MEAN线处于MA100以下","位置":"MA100以下"}' alert(alert_message, alert.freq_once_per_bar) last_alert_mean_below_ma100 := current_minute // ===== 传统警报条件(保留兼容性)===== // 注意:使用统一警报系统时,建议只使用上面的alert()函数 // 以下alertcondition保留用于需要单独设置警报的情况 // 创建用于警报的plot变量 plot(ma50, title = 'MA50值', display = display.none) plot(ma100, title = 'MA100值', display = display.none) plot(ma200, title = 'MA200值', display = display.none) plot(mean_ma200_distance, title = 'MEAN距离MA200', display = display.none) plot(mean_ma50_distance, title = 'MEAN距离MA50', display = display.none) plot(mean_ma100_distance, title = 'MEAN距离MA100', display = display.none) // 为传统警报创建隐藏的plot变量(不显示但支持警报引用) plot(upband2, title = ' R2', display = display.none) // R2 隐藏绘制用于警报 plot(loband2, title = ' S2', display = display.none) // S2 隐藏绘制用于警报 plot(upband2_1, title = 'R2_1', display = display.none) plot(loband2_1, title = 'S2_1', display = display.none) plot(upband2_9, title = 'R2_9', display = display.none) plot(loband2_9, title = 'S2_9', display = display.none) // 价格穿越警报 alertcondition(ta.crossover(close, upband1), title = '价格上穿R1', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格上穿R1","位置":"R1","信号":"r1_breakout_up"}') alertcondition(ta.crossunder(close, upband1), title = '价格下穿R1', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格下穿R1","位置":"R1","信号":"r1_breakout_down"}') alertcondition(ta.crossunder(close, loband1), title = '价格下穿S1', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格下穿S1","位置":"S1","信号":"s1_breakout_down"}') alertcondition(ta.crossover(close, loband1), title = '价格上穿S1', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格上穿S1","位置":"S1","信号":"s1_breakout_up"}') alertcondition(ta.crossover(close, meanline), title = '价格上穿MEAN', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格上穿MEAN","位置":"MEAN","信号":"mean_breakout_up"}') alertcondition(ta.crossunder(close, meanline), title = '价格下穿MEAN', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格下穿MEAN","位置":"MEAN","信号":"mean_breakout_down"}') // R2和S2穿越警报 alertcondition(ta.crossover(close, upband2), title = '价格上穿R2', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格上穿R2","位置":"R2","信号":"r2_breakout_up"}') alertcondition(ta.crossunder(close, upband2), title = '价格下穿R2', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格下穿R2","位置":"R2","信号":"r2_breakout_down"}') alertcondition(ta.crossunder(close, loband2), title = '价格下穿S2', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格下穿S2","位置":"S2","信号":"s2_breakout_down"}') alertcondition(ta.crossover(close, loband2), title = '价格上穿S2', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格上穿S2","位置":"S2","信号":"s2_breakout_up"}') // 扩展区域穿越警报 alertcondition(ta.crossover(close, upband2_9), title = '价格上穿R2_9', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格上穿R2_9","位置":"R2_9","信号":"r2_9_breakout_up"}') alertcondition(ta.crossunder(close, upband2_9), title = '价格下穿R2_9', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格下穿R2_9","位置":"R2_9","信号":"r2_9_breakout_down"}') alertcondition(ta.crossunder(close, loband2_9), title = '价格下穿S2_9', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格下穿S2_9","位置":"S2_9","信号":"s2_9_breakout_down"}') alertcondition(ta.crossover(close, loband2_9), title = '价格上穿S2_9', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格上穿S2_9","位置":"S2_9","信号":"s2_9_breakout_up"}') alertcondition(ta.crossover(close, upband2_1), title = '价格上穿R2_1', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格上穿R2_1","位置":"R2_1","信号":"r2_1_breakout_up"}') alertcondition(ta.crossunder(close, upband2_1), title = '价格下穿R2_1', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格下穿R2_1","位置":"R2_1","信号":"r2_1_breakout_down"}') alertcondition(ta.crossunder(close, loband2_1), title = '价格下穿S2_1', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格下穿S2_1","位置":"S2_1","信号":"s2_1_breakout_down"}') alertcondition(ta.crossover(close, loband2_1), title = '价格上穿S2_1', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格上穿S2_1","位置":"S2_1","信号":"s2_1_breakout_up"}') // 价格区间状态警报 alertcondition(close <= upband1 and close >= loband1, title = '价格处于R1和S1之间', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格处于R1和S1之间","位置":"R1-S1区间","信号":"range_r1_s1"}') alertcondition(close > upband1, title = '价格处于R1以上', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格处于R1以上","位置":"R1以上","信号":"above_r1"}') alertcondition(close < loband1, title = '价格处于S1以下', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格处于S1以下","位置":"S1以下","信号":"below_s1"}') alertcondition(close > meanline, title = '价格处于MEAN以上', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格处于MEAN以上","位置":"MEAN以上","信号":"above_mean"}') alertcondition(close < meanline, title = '价格处于MEAN以下', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格处于MEAN以下","位置":"MEAN以下","信号":"below_mean"}') // 区间范围警报 alertcondition(close > upband1 and close < upband2, title = '价格处于R1和R2之间', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格处于R1和R2之间","位置":"R1-R2","信号":"range_r1_r2"}') alertcondition(close < loband1 and close > loband2, title = '价格处于S1和S2之间', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格处于S1和S2之间","位置":"S1-S2","信号":"range_s1_s2"}') alertcondition(close > upband2 and close < upband2_1, title = '价格处于R2和R2_1之间', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格处于R2和R2_1之间","位置":"R2-R2_1","信号":"range_r2_r2_1"}') alertcondition(close < loband2 and close > loband2_1, title = '价格处于S2和S2_1之间', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格处于S2和S2_1之间","位置":"S2-S2_1","信号":"range_s2_s2_1"}') // 极端区域警报 alertcondition(close > upband2_1, title = '价格处于R2_1以上', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格处于R2_1以上","位置":"R2_1以上","信号":"above_r2_1"}') alertcondition(close < loband2_1, title = '价格处于S2_1以下', message = '{"指标名称":"MRC","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","R1":"{{plot(" R1")}}","S1":"{{plot(" S1")}}","R2":"{{plot(" R2")}}","S2":"{{plot(" S2")}}","R2_9":"{{plot("R2_9")}}","S2_9":"{{plot("S2_9")}}","R2_1":"{{plot("R2_1")}}","S2_1":"{{plot("S2_1")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"价格处于S2_1以下","位置":"S2_1以下","信号":"below_s2_1"}') // ===== 新增的MA200相关传统警报条件 ===== // MEAN线与MA200关系警报 alertcondition(meanline > ma200, title = 'MEAN线处于MA200以上', message = '{"指标名称":"MA200","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","MA50":"{{plot("MA50值")}}","MA100":"{{plot("MA100值")}}","MA200":"{{plot("MA200值")}}","距离(美元)":"{{plot("MEAN距离MA200")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"MEAN线处于MA200以上","位置":"MA200以上","信号":"mean_above_ma200"}') alertcondition(meanline < ma200, title = 'MEAN线处于MA200以下', message = '{"指标名称":"MA200","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","MA50":"{{plot("MA50值")}}","MA100":"{{plot("MA100值")}}","MA200":"{{plot("MA200值")}}","距离(美元)":"{{plot("MEAN距离MA200")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"MEAN线处于MA200以下","位置":"MA200以下","信号":"mean_below_ma200"}') // MEAN线与MA50关系警报 alertcondition(meanline > ma50, title = 'MEAN线处于MA50以上', message = '{"指标名称":"MA200","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","MA50":"{{plot("MA50值")}}","MA100":"{{plot("MA100值")}}","MA200":"{{plot("MA200值")}}","距离(美元)":"{{plot("MEAN距离MA50")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"MEAN线处于MA50以上","位置":"MA50以上","信号":"mean_above_ma50"}') alertcondition(meanline < ma50, title = 'MEAN线处于MA50以下', message = '{"指标名称":"MA200","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","MA50":"{{plot("MA50值")}}","MA100":"{{plot("MA100值")}}","MA200":"{{plot("MA200值")}}","距离(美元)":"{{plot("MEAN距离MA50")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"MEAN线处于MA50以下","位置":"MA50以下","信号":"mean_below_ma50"}') // MEAN线与MA100关系警报 alertcondition(meanline > ma100, title = 'MEAN线处于MA100以上', message = '{"指标名称":"MA200","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","MA50":"{{plot("MA50值")}}","MA100":"{{plot("MA100值")}}","MA200":"{{plot("MA200值")}}","距离(美元)":"{{plot("MEAN距离MA100")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"MEAN线处于MA100以上","位置":"MA100以上","信号":"mean_above_ma100"}') alertcondition(meanline < ma100, title = 'MEAN线处于MA100以下', message = '{"指标名称":"MA200","交易对":"{{ticker}}","周期":"{{interval}}","MEAN":"{{plot(" Mean")}}","MA50":"{{plot("MA50值")}}","MA100":"{{plot("MA100值")}}","MA200":"{{plot("MA200值")}}","距离(美元)":"{{plot("MEAN距离MA100")}}","开盘价":"{{open}}","收盘价":"{{close}}","最高价":"{{high}}","最低价":"{{low}}","触发时间":"{{timenow}}","时间":"{{time}}","事件":"MEAN线处于MA100以下","位置":"MA100以下","信号":"mean_below_ma100"}')