最好用财富阶梯主图指标公式源码
发布日期: 2025-08-13 | 阅读量:49
前EMA14:REF(EMA(C,14),1);
动量值:=(EMA(C,10) - 前EMA14) / 前EMA14 * 100;
多头线:=IF(动量值>=0, REF(EMA(C,10), BARSLAST(CROSS(动量值,0))+1), DRAWNULL);
空头线:=IF(动量值<0, REF(EMA(C,10), BARSLAST(CROSS(0,动量值))+1), DRAWNULL);
STICKLINE(动量值>=0, 多头线, 前EMA14, 10, 0), COLOR000099;
STICKLINE(动量值<0, 空头线, 前EMA14, 10, 0), COLOR00CC66;
平滑均价:=SMA(SMA(SMA(MA(C,1),2,1),2,1),2,1);
趋势均线:=MA(平滑均价,3);
支撑线:IF(LLV(MA(平滑均价,8),3)<平滑均价, LLV(MA(平滑均价,8),3), 平滑均价), LINETHICK2, COLORWHITE;
上升趋势:IF(平滑均价>趋势均线, 平滑均价, DRAWNULL), LINETHICK5, COLORRED;
下降趋势:IF(平滑均价<趋势均线, 平滑均价, DRAWNULL), LINETHICK5, COLORGREEN;
压力线:HHV(MA(平滑均价,1),13), LINETHICK2, COLORYELLOW;
六十日均线:MA(C,60), POINTDOT, LINETHICK2, COLORWHITE;
涨停限制:=IF(INBLOCK('科创板'), 0.2, IF(INBLOCK('ST板块'), 0.05, 0.1));
是否涨停:=C>=ZTPRICE(REF(C,1),涨停限制) AND C>=H;
是否跌停:=C<=DTPRICE(REF(C,1),涨停限制) AND C<=L;
{ 绘制K线实体与影线 }
STICKLINE(C=O, H, L, 0, 0), COLORF1F1F1;
STICKLINE(C=O, O, C, -1, 0), COLORF1F1F1;
STICKLINE(C>O, H, L, 0, 0), COLOR0000DD;
STICKLINE(C>O, O, C, -1, 0), COLOR000055;
STICKLINE(C>O, O, C, 2.8, 0), COLOR000066;
STICKLINE(C>O, O, C, 2.5, 0), COLOR000077;
STICKLINE(C>O, O, C, 2.1, 0), COLOR000088;
STICKLINE(C>O, O, C, 1.7, 0), COLOR000099;
STICKLINE(C>O, O, C, 1.2, 0), COLOR0000AA;
STICKLINE(C>O, O, C, 0.7, 0), COLOR0000CC;
STICKLINE(C>O, O, C, 0.2, 0), COLOR0000FF;
STICKLINE(C<O, H, L, 0, 0), COLORDDDD00;
STICKLINE(C<O, O, C, -1, 0), COLOR555500;
STICKLINE(C<O, O, C, 2.8, 0), COLOR666600;
STICKLINE(C<O, O, C, 2.5, 0), COLOR777700;
STICKLINE(C<O, O, C, 2.1, 0), COLOR888800;
STICKLINE(C<O, O, C, 1.7, 0), COLOR999900;
STICKLINE(C<O, O, C, 1.2, 0), COLORAAAA00;
STICKLINE(C<O, O, C, 0.7, 0), COLORCCCC00;
STICKLINE(C<O, O, C, 0.2, 0), COLORFFFF00;
{ 涨停K线高亮 }
STICKLINE(是否涨停, O, C, -1, 0), COLOR0055AA;
STICKLINE(是否涨停, O, C, 2.8, 0), COLOR0066BB;
STICKLINE(是否涨停, O, C, 2.5, 0), COLOR0077CC;
STICKLINE(是否涨停, O, C, 2.1, 0), COLOR0088DD;
STICKLINE(是否涨停, O, C, 1.7, 0), COLOR0099EE;
STICKLINE(是否涨停, O, C, 1.2, 0), COLOR00AAFF;
STICKLINE(是否涨停, O, C, 0.7, 0), COLOR00CCFF;
STICKLINE(是否涨停, O, C, 0.2, 0), COLOR00FFFF;
{ 跌停K线高亮 }
STICKLINE(是否跌停, O, C, -1, 0), COLOR005500;
STICKLINE(是否跌停, O, C, 2.8, 0), COLOR006600;
STICKLINE(是否跌停, O, C, 2.5, 0), COLOR007700;
STICKLINE(是否跌停, O, C, 2.1, 0), COLOR008800;
STICKLINE(是否跌停, O, C, 1.7, 0), COLOR009900;
STICKLINE(是否跌停, O, C, 1.2, 0), COLOR00AA00;
STICKLINE(是否跌停, O, C, 0.7, 0), COLOR00CC00;
STICKLINE(是否跌停, O, C, 0.2, 0), COLOR00FF00;
动量值:=(EMA(C,10) - 前EMA14) / 前EMA14 * 100;
多头线:=IF(动量值>=0, REF(EMA(C,10), BARSLAST(CROSS(动量值,0))+1), DRAWNULL);
空头线:=IF(动量值<0, REF(EMA(C,10), BARSLAST(CROSS(0,动量值))+1), DRAWNULL);
STICKLINE(动量值>=0, 多头线, 前EMA14, 10, 0), COLOR000099;
STICKLINE(动量值<0, 空头线, 前EMA14, 10, 0), COLOR00CC66;
平滑均价:=SMA(SMA(SMA(MA(C,1),2,1),2,1),2,1);
趋势均线:=MA(平滑均价,3);
支撑线:IF(LLV(MA(平滑均价,8),3)<平滑均价, LLV(MA(平滑均价,8),3), 平滑均价), LINETHICK2, COLORWHITE;
上升趋势:IF(平滑均价>趋势均线, 平滑均价, DRAWNULL), LINETHICK5, COLORRED;
下降趋势:IF(平滑均价<趋势均线, 平滑均价, DRAWNULL), LINETHICK5, COLORGREEN;
压力线:HHV(MA(平滑均价,1),13), LINETHICK2, COLORYELLOW;
六十日均线:MA(C,60), POINTDOT, LINETHICK2, COLORWHITE;
涨停限制:=IF(INBLOCK('科创板'), 0.2, IF(INBLOCK('ST板块'), 0.05, 0.1));
是否涨停:=C>=ZTPRICE(REF(C,1),涨停限制) AND C>=H;
是否跌停:=C<=DTPRICE(REF(C,1),涨停限制) AND C<=L;
{ 绘制K线实体与影线 }
STICKLINE(C=O, H, L, 0, 0), COLORF1F1F1;
STICKLINE(C=O, O, C, -1, 0), COLORF1F1F1;
STICKLINE(C>O, H, L, 0, 0), COLOR0000DD;
STICKLINE(C>O, O, C, -1, 0), COLOR000055;
STICKLINE(C>O, O, C, 2.8, 0), COLOR000066;
STICKLINE(C>O, O, C, 2.5, 0), COLOR000077;
STICKLINE(C>O, O, C, 2.1, 0), COLOR000088;
STICKLINE(C>O, O, C, 1.7, 0), COLOR000099;
STICKLINE(C>O, O, C, 1.2, 0), COLOR0000AA;
STICKLINE(C>O, O, C, 0.7, 0), COLOR0000CC;
STICKLINE(C>O, O, C, 0.2, 0), COLOR0000FF;
STICKLINE(C<O, H, L, 0, 0), COLORDDDD00;
STICKLINE(C<O, O, C, -1, 0), COLOR555500;
STICKLINE(C<O, O, C, 2.8, 0), COLOR666600;
STICKLINE(C<O, O, C, 2.5, 0), COLOR777700;
STICKLINE(C<O, O, C, 2.1, 0), COLOR888800;
STICKLINE(C<O, O, C, 1.7, 0), COLOR999900;
STICKLINE(C<O, O, C, 1.2, 0), COLORAAAA00;
STICKLINE(C<O, O, C, 0.7, 0), COLORCCCC00;
STICKLINE(C<O, O, C, 0.2, 0), COLORFFFF00;
{ 涨停K线高亮 }
STICKLINE(是否涨停, O, C, -1, 0), COLOR0055AA;
STICKLINE(是否涨停, O, C, 2.8, 0), COLOR0066BB;
STICKLINE(是否涨停, O, C, 2.5, 0), COLOR0077CC;
STICKLINE(是否涨停, O, C, 2.1, 0), COLOR0088DD;
STICKLINE(是否涨停, O, C, 1.7, 0), COLOR0099EE;
STICKLINE(是否涨停, O, C, 1.2, 0), COLOR00AAFF;
STICKLINE(是否涨停, O, C, 0.7, 0), COLOR00CCFF;
STICKLINE(是否涨停, O, C, 0.2, 0), COLOR00FFFF;
{ 跌停K线高亮 }
STICKLINE(是否跌停, O, C, -1, 0), COLOR005500;
STICKLINE(是否跌停, O, C, 2.8, 0), COLOR006600;
STICKLINE(是否跌停, O, C, 2.5, 0), COLOR007700;
STICKLINE(是否跌停, O, C, 2.1, 0), COLOR008800;
STICKLINE(是否跌停, O, C, 1.7, 0), COLOR009900;
STICKLINE(是否跌停, O, C, 1.2, 0), COLOR00AA00;
STICKLINE(是否跌停, O, C, 0.7, 0), COLOR00CC00;
STICKLINE(是否跌停, O, C, 0.2, 0), COLOR00FF00;

指标公式逻辑介绍
模块 功能
动量值 衡量短期EMA(10)相对于前一日EMA(14)的偏离程度(动量强度)
多头线 / 空头线 标记动量转正或转负时的起始EMA位置,形成彩色背景柱
平滑均价 & 趋势均线 三重平滑后的趋势线,用于判断主趋势方向
支撑线 / 压力线 动态支撑与13日高点压力
上升/下降趋势 用红绿粗线显示当前趋势方向
是否涨停 / 是否跌停 自动识别不同板块涨跌停限制(普板、ST、科创板)
彩色K线 区分阳线、阴线、十字星,并对涨停/跌停进行高亮渲染
✅ 优势亮点:
✅ 智能识别板块涨跌幅限制(科创板20%,ST 5%,其他10%);
✅ 动量趋势可视化:通过背景柱判断多空延续;
✅ K线美化:阳线渐变蓝、阴线渐变黄、涨停亮色突出;
✅ 趋势判断清晰:红线上升,绿线下降,一目了然。