程序化指标多周期趋势指标公式
发布日期: 2025-08-19 | 阅读量:43
实时量 := IF(CURRBARSCOUNT = 1, VOL * 240 / FROMOPEN, VOL);
量比 := 实时量 * 10000 / FINANCE(7);
压力线 := IF(CURRBARSCOUNT = 1, REF(C,1)*1.1, DRAWNULL);
支撑线 := IF(CURRBARSCOUNT = 1, REF(C,1)*0.9, DRAWNULL);
量峰位置 := BARSLAST(量比 = HHV(量比,180));
量峰均价 := IF(CURRBARSCOUNT <= 量峰位置 + 1, REF((C+O+H+L)/4, 量峰位置), DRAWNULL);
多空线: VALUEWHEN(ISLASTBAR, 量峰均价), COLORYELLOW;
DRAWTEXT(ISLASTBAR, 多空线, '4'), COLORYELLOW;
MA5 := MA(C,5);
MA6 := MA(C,6);
MA7 := MA(C,7);
MA8 := MA(C,8);
MA9 := MA(C,9);
MA10 := MA(C,10);
MA11 := MA(C,11);
MA12 := MA(C,12);
MA13 := MA(C,13);
MA14 := MA(C,14);
MA15 := MA(C,15);
MA16 := MA(C,16);
MA17 := MA(C,17);
MA18 := MA(C,18);
MA19 := MA(C,19);
MA20 := MA(C,20);
MA21 := MA(C,21);
MA22 := MA(C,22);
MA23 := MA(C,23);
MA24 := MA(C,24);
MA25 := MA(C,25);
MA26 := MA(C,26);
MA27 := MA(C,27);
MA28 := MA(C,28);
MA29 := MA(C,29);
MA30 := MA(C,30);
MA31 := MA(C,31);
组1 := MAX(MAX(MAX(MAX(MA5,MA6),MA7),MA8),MA9);
组2 := MAX(MAX(MAX(MAX(MA10,MA11),MA12),MA13),MA14);
组3 := MAX(MAX(MAX(MAX(MA15,MA16),MA17),MA18),MA19);
组4 := MAX(MAX(MAX(MAX(MA20,MA21),MA22),MA23),MA24);
组5 := MAX(MAX(MAX(MAX(MA25,MA26),MA27),MA28),MAX(MA29,MAX(MA30,MA31)));
最高均线 := MAX(MAX(MAX(MAX(组1,组2),组3),组4),组5);
主周期 :=
IF(最高均线 = MA31, 31,
IF(最高均线 = MA30, 30,
IF(最高均线 = MA29, 29,
IF(最高均线 = MA28, 28,
IF(最高均线 = MA27, 27,
IF(最高均线 = MA26, 26,
IF(最高均线 = MA25, 25,
IF(最高均线 = MA24, 24,
IF(最高均线 = MA23, 23,
IF(最高均线 = MA22, 22,
IF(最高均线 = MA21, 21,
IF(最高均线 = MA20, 20,
IF(最高均线 = MA19, 19,
IF(最高均线 = MA18, 18,
IF(最高均线 = MA17, 17,
IF(最高均线 = MA16, 16,
IF(最高均线 = MA15, 15,
IF(最高均线 = MA14, 14,
IF(最高均线 = MA13, 13,
IF(最高均线 = MA12, 12,
IF(最高均线 = MA11, 11,
IF(最高均线 = MA10, 10,
IF(最高均线 = MA9, 9,
IF(最高均线 = MA8, 8,
IF(最高均线 = MA7, 7,
IF(最高均线 = MA6, 6,
IF(最高均线 = MA5, 5, 31)))))))))))))))))))))))))));
变线: IF(BARSCOUNT(C) >= 31, (最高均线*3 + MA31)/4, MAX(MA5, MA(C,BARSCOUNT(C)))), COLORWHITE;
量能峰值 := 实时量 = HHV(实时量, 主周期);
放量阴线 := O/C = HHV(O/C, 主周期) AND C < O;
放量阳线 := C/O = HHV(C/O, 主周期);
强阳确认 := 放量阳线 AND 量能峰值;
STICKLINE(放量阴线, O, C, 2, 0), COLORGREEN;
STICKLINE(放量阳线, O, C, 2, 0), COLORRED;
STICKLINE(强阳确认, O, C, 2, 0), COLORYELLOW;
潜伏信号 :=放量阴线
AND 实时量 > MA(实时量, 主周期)
AND C > 变线*1.05
AND 实时量 > MA(实时量,5)
AND C < O
AND C < REF(C,1)
AND H/变线 = HHV(H/变线,5);
STICKLINE(潜伏信号, O, C, 2, 0), COLORBLUE;
高点回溯7 := REF(HHV((H+C+L+H)/4, 7), BARSLAST(CROSS(MA10, MA5)));
低点回溯10 := REF(LLV(MIN(O,C),10), BARSLAST(CROSS(MA5, MA10)));
高点回溯5 := REF(HHV(MAX(C,O),7), BARSLAST(CROSS(MA10, MA5)));
低点回溯10B := REF(LLV(MIN(C,O),10), BARSLAST(CROSS(MA5, MA10)));
箱顶线 := IF(C > 500, 高点回溯5, 高点回溯7);
箱底线 := IF(C > 500, 低点回溯10B, 低点回溯10);
箱顶: IF(箱顶线 = CONST(箱顶线), CONST(箱顶线), DRAWNULL), COLORBROWN, LINETHICK3;
箱底: IF(箱底线 = CONST(箱底线), 箱底线, DRAWNULL), COLORBLUE, LINETHICK3;
DRAWTEXT(ISLASTBAR, 箱顶, '5'), COLORBROWN;
DRAWTEXT(ISLASTBAR, 箱底, '6'), COLORBLUE;
止盈线 := IF(CURRBARSCOUNT <= 5, CONST(REF(箱顶线,1)), DRAWNULL);
DRAWTEXT(ISLASTBAR, 止盈线, '7'), COLORMAGENTA;
止赢: 止盈线, DOTLINE, COLORMAGENTA;
止损线 := IF(ISLASTBAR, MIN(REF(LOW, 量峰位置), REF(HIGH, 量峰位置+1)), DRAWNULL);
止损: IF(止损线 = CONST(止损线), 止损线, IF(ISLASTBAR, 止损线, DRAWNULL)), DOTLINE, COLORGREEN;
DRAWTEXT(ISLASTBAR, 止损线, '8'), COLORGREEN;
跑赢大盘 := EVERY(C/REF(C,1) > INDEXC/REF(INDEXC,1), 5) OR COUNT(C/REF(C,1) > INDEXC/REF(INDEXC,1), 9) = 8;
量价共振 := COUNT(跑赢大盘, 2) AND DYNAINFO(4) > 0 AND IF(C < O, 实时量 < REF(VOL,1), 1);
STICKLINE(量价共振, 多空线, 多空线, 5, 0), COLORMAGENTA;
小涨板 := ABS(L-O) < ABS(O-C) AND C/REF(C,1) > 1.033 AND REF(C,1)/REF(C,2) < 1.093 AND COUNT(C/REF(C,1) > 1.093, 20) < 3;
大涨板 := ABS(L-O) < ABS(O-C) AND C/REF(C,1) > 1.093 AND REF(C,1)/REF(C,2) < 1.093;
突破信号 := 小涨板 OR 大涨板;
动量 := CLOSE - REF(CLOSE,1);
RSI动量 := 100 * EMA(EMA(动量,9),9) / EMA(EMA(ABS(动量),9),9);
RSI均线 := MA(RSI动量,5);
超卖区 := RSI动量 < 0 AND RSI均线 < 0;
暴跌 := (REF(C,3) - C)/REF(C,3)*100 > 5;
暴跌信号 := FILTER(暴跌, 10);
回溯天数 := BARSLAST(暴跌信号);
反弹高点 := MAX(MAX(REF(H,回溯天数+2), REF(H,回溯天数+1)), REF(H,回溯天数));
反弹确认 := (C - REF(C,1))/REF(C,1)*100 > 5
AND 回溯天数 < 150
AND (O - 反弹高点)/反弹高点*100 < 30
AND (C - LLV(L,回溯天数))/LLV(L,回溯天数)*100 < 50
AND (C - REF(O,5))/REF(O,5)*100 < 30
AND VOL/MA(VOL,5) < 3.5
AND (C - REF(C,89))/REF(C,89)*100 < 80;
反弹信号 := FILTER(反弹确认, 15);
条件A := (C - MA(C,54))/MA(C,54) < 0.1;
条件B := (C - MA(C,10))/MA(C,10) < 0.3;
背离初现 := 条件A AND 条件B;
背离确认 := REF(背离初现,1) AND COUNT(背离初现=0,10)=10;
趋势背离 := 背离确认;
主升信号 := 反弹信号 OR 趋势背离;
强量突破 := C/REF(C,1) > 1.033 AND (VOL/REF(VOL,1) > 1.2 AND COUNT(C>O,1) OR (L>REF(H,1) AND VOL/REF(VOL,1)>1.2));
超级买点 := 主升信号 AND C/REF(C,1) > 1.033 AND 强量突破 AND C/O > 1.033;
买点A:=超卖区 AND 超级买点 AND 小涨板, COLORBLUE;
买点B:=超卖区 AND 超级买点 AND 大涨板, COLORRED;
DRAWICON(买点A, L, 24);
DRAWICON(买点B, L, 25);
趋势延续 := 变线 > 箱顶线 AND COUNT(C > 变线, 5);
IF(趋势延续, 变线, DRAWNULL), COLOR0045FF;
IF(变线 < 箱底线, 变线, DRAWNULL), COLORCYAN;
涨家数: ROUND(INDEXADV/(INDEXADV+INDEXDEC)*100), NODRAW, COLORRED;
流通市值: FINANCE(40)/100000000, NODRAW, COLORRED;
STICKLINE(CURRBARSCOUNT=1, 支撑线, MIN(O,C), -1, -1), COLORBLUE;
STICKLINE(CURRBARSCOUNT=1, 压力线, MAX(O,C), -1, -1), COLORGRAY;
DRAWKLINE(H,O,L,C);
量比 := 实时量 * 10000 / FINANCE(7);
压力线 := IF(CURRBARSCOUNT = 1, REF(C,1)*1.1, DRAWNULL);
支撑线 := IF(CURRBARSCOUNT = 1, REF(C,1)*0.9, DRAWNULL);
量峰位置 := BARSLAST(量比 = HHV(量比,180));
量峰均价 := IF(CURRBARSCOUNT <= 量峰位置 + 1, REF((C+O+H+L)/4, 量峰位置), DRAWNULL);
多空线: VALUEWHEN(ISLASTBAR, 量峰均价), COLORYELLOW;
DRAWTEXT(ISLASTBAR, 多空线, '4'), COLORYELLOW;
MA5 := MA(C,5);
MA6 := MA(C,6);
MA7 := MA(C,7);
MA8 := MA(C,8);
MA9 := MA(C,9);
MA10 := MA(C,10);
MA11 := MA(C,11);
MA12 := MA(C,12);
MA13 := MA(C,13);
MA14 := MA(C,14);
MA15 := MA(C,15);
MA16 := MA(C,16);
MA17 := MA(C,17);
MA18 := MA(C,18);
MA19 := MA(C,19);
MA20 := MA(C,20);
MA21 := MA(C,21);
MA22 := MA(C,22);
MA23 := MA(C,23);
MA24 := MA(C,24);
MA25 := MA(C,25);
MA26 := MA(C,26);
MA27 := MA(C,27);
MA28 := MA(C,28);
MA29 := MA(C,29);
MA30 := MA(C,30);
MA31 := MA(C,31);
组1 := MAX(MAX(MAX(MAX(MA5,MA6),MA7),MA8),MA9);
组2 := MAX(MAX(MAX(MAX(MA10,MA11),MA12),MA13),MA14);
组3 := MAX(MAX(MAX(MAX(MA15,MA16),MA17),MA18),MA19);
组4 := MAX(MAX(MAX(MAX(MA20,MA21),MA22),MA23),MA24);
组5 := MAX(MAX(MAX(MAX(MA25,MA26),MA27),MA28),MAX(MA29,MAX(MA30,MA31)));
最高均线 := MAX(MAX(MAX(MAX(组1,组2),组3),组4),组5);
主周期 :=
IF(最高均线 = MA31, 31,
IF(最高均线 = MA30, 30,
IF(最高均线 = MA29, 29,
IF(最高均线 = MA28, 28,
IF(最高均线 = MA27, 27,
IF(最高均线 = MA26, 26,
IF(最高均线 = MA25, 25,
IF(最高均线 = MA24, 24,
IF(最高均线 = MA23, 23,
IF(最高均线 = MA22, 22,
IF(最高均线 = MA21, 21,
IF(最高均线 = MA20, 20,
IF(最高均线 = MA19, 19,
IF(最高均线 = MA18, 18,
IF(最高均线 = MA17, 17,
IF(最高均线 = MA16, 16,
IF(最高均线 = MA15, 15,
IF(最高均线 = MA14, 14,
IF(最高均线 = MA13, 13,
IF(最高均线 = MA12, 12,
IF(最高均线 = MA11, 11,
IF(最高均线 = MA10, 10,
IF(最高均线 = MA9, 9,
IF(最高均线 = MA8, 8,
IF(最高均线 = MA7, 7,
IF(最高均线 = MA6, 6,
IF(最高均线 = MA5, 5, 31)))))))))))))))))))))))))));
变线: IF(BARSCOUNT(C) >= 31, (最高均线*3 + MA31)/4, MAX(MA5, MA(C,BARSCOUNT(C)))), COLORWHITE;
量能峰值 := 实时量 = HHV(实时量, 主周期);
放量阴线 := O/C = HHV(O/C, 主周期) AND C < O;
放量阳线 := C/O = HHV(C/O, 主周期);
强阳确认 := 放量阳线 AND 量能峰值;
STICKLINE(放量阴线, O, C, 2, 0), COLORGREEN;
STICKLINE(放量阳线, O, C, 2, 0), COLORRED;
STICKLINE(强阳确认, O, C, 2, 0), COLORYELLOW;
潜伏信号 :=放量阴线
AND 实时量 > MA(实时量, 主周期)
AND C > 变线*1.05
AND 实时量 > MA(实时量,5)
AND C < O
AND C < REF(C,1)
AND H/变线 = HHV(H/变线,5);
STICKLINE(潜伏信号, O, C, 2, 0), COLORBLUE;
高点回溯7 := REF(HHV((H+C+L+H)/4, 7), BARSLAST(CROSS(MA10, MA5)));
低点回溯10 := REF(LLV(MIN(O,C),10), BARSLAST(CROSS(MA5, MA10)));
高点回溯5 := REF(HHV(MAX(C,O),7), BARSLAST(CROSS(MA10, MA5)));
低点回溯10B := REF(LLV(MIN(C,O),10), BARSLAST(CROSS(MA5, MA10)));
箱顶线 := IF(C > 500, 高点回溯5, 高点回溯7);
箱底线 := IF(C > 500, 低点回溯10B, 低点回溯10);
箱顶: IF(箱顶线 = CONST(箱顶线), CONST(箱顶线), DRAWNULL), COLORBROWN, LINETHICK3;
箱底: IF(箱底线 = CONST(箱底线), 箱底线, DRAWNULL), COLORBLUE, LINETHICK3;
DRAWTEXT(ISLASTBAR, 箱顶, '5'), COLORBROWN;
DRAWTEXT(ISLASTBAR, 箱底, '6'), COLORBLUE;
止盈线 := IF(CURRBARSCOUNT <= 5, CONST(REF(箱顶线,1)), DRAWNULL);
DRAWTEXT(ISLASTBAR, 止盈线, '7'), COLORMAGENTA;
止赢: 止盈线, DOTLINE, COLORMAGENTA;
止损线 := IF(ISLASTBAR, MIN(REF(LOW, 量峰位置), REF(HIGH, 量峰位置+1)), DRAWNULL);
止损: IF(止损线 = CONST(止损线), 止损线, IF(ISLASTBAR, 止损线, DRAWNULL)), DOTLINE, COLORGREEN;
DRAWTEXT(ISLASTBAR, 止损线, '8'), COLORGREEN;
跑赢大盘 := EVERY(C/REF(C,1) > INDEXC/REF(INDEXC,1), 5) OR COUNT(C/REF(C,1) > INDEXC/REF(INDEXC,1), 9) = 8;
量价共振 := COUNT(跑赢大盘, 2) AND DYNAINFO(4) > 0 AND IF(C < O, 实时量 < REF(VOL,1), 1);
STICKLINE(量价共振, 多空线, 多空线, 5, 0), COLORMAGENTA;
小涨板 := ABS(L-O) < ABS(O-C) AND C/REF(C,1) > 1.033 AND REF(C,1)/REF(C,2) < 1.093 AND COUNT(C/REF(C,1) > 1.093, 20) < 3;
大涨板 := ABS(L-O) < ABS(O-C) AND C/REF(C,1) > 1.093 AND REF(C,1)/REF(C,2) < 1.093;
突破信号 := 小涨板 OR 大涨板;
动量 := CLOSE - REF(CLOSE,1);
RSI动量 := 100 * EMA(EMA(动量,9),9) / EMA(EMA(ABS(动量),9),9);
RSI均线 := MA(RSI动量,5);
超卖区 := RSI动量 < 0 AND RSI均线 < 0;
暴跌 := (REF(C,3) - C)/REF(C,3)*100 > 5;
暴跌信号 := FILTER(暴跌, 10);
回溯天数 := BARSLAST(暴跌信号);
反弹高点 := MAX(MAX(REF(H,回溯天数+2), REF(H,回溯天数+1)), REF(H,回溯天数));
反弹确认 := (C - REF(C,1))/REF(C,1)*100 > 5
AND 回溯天数 < 150
AND (O - 反弹高点)/反弹高点*100 < 30
AND (C - LLV(L,回溯天数))/LLV(L,回溯天数)*100 < 50
AND (C - REF(O,5))/REF(O,5)*100 < 30
AND VOL/MA(VOL,5) < 3.5
AND (C - REF(C,89))/REF(C,89)*100 < 80;
反弹信号 := FILTER(反弹确认, 15);
条件A := (C - MA(C,54))/MA(C,54) < 0.1;
条件B := (C - MA(C,10))/MA(C,10) < 0.3;
背离初现 := 条件A AND 条件B;
背离确认 := REF(背离初现,1) AND COUNT(背离初现=0,10)=10;
趋势背离 := 背离确认;
主升信号 := 反弹信号 OR 趋势背离;
强量突破 := C/REF(C,1) > 1.033 AND (VOL/REF(VOL,1) > 1.2 AND COUNT(C>O,1) OR (L>REF(H,1) AND VOL/REF(VOL,1)>1.2));
超级买点 := 主升信号 AND C/REF(C,1) > 1.033 AND 强量突破 AND C/O > 1.033;
买点A:=超卖区 AND 超级买点 AND 小涨板, COLORBLUE;
买点B:=超卖区 AND 超级买点 AND 大涨板, COLORRED;
DRAWICON(买点A, L, 24);
DRAWICON(买点B, L, 25);
趋势延续 := 变线 > 箱顶线 AND COUNT(C > 变线, 5);
IF(趋势延续, 变线, DRAWNULL), COLOR0045FF;
IF(变线 < 箱底线, 变线, DRAWNULL), COLORCYAN;
涨家数: ROUND(INDEXADV/(INDEXADV+INDEXDEC)*100), NODRAW, COLORRED;
流通市值: FINANCE(40)/100000000, NODRAW, COLORRED;
STICKLINE(CURRBARSCOUNT=1, 支撑线, MIN(O,C), -1, -1), COLORBLUE;
STICKLINE(CURRBARSCOUNT=1, 压力线, MAX(O,C), -1, -1), COLORGRAY;
DRAWKLINE(H,O,L,C);
