通达信四季牛熊指标公式主图源码
TR1:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(TR1,10);
MEDIAN:= (HIGH + LOW ) / 2;
上证指数:=INBLOCK('上证A股');
{分析家公式网HTTP://WWW.70822.COM
深证成指:=INBLOCK('深证A股');
平均股价:=C;}
UP:=MEDIAN+ATR * IF(C=上证指数,2.1,2.2);
DN:=MEDIAN-ATR * IF(C=上证指数,2.1,2.2);
L1:=REF(UP,BARSLAST(UP<=REF(UP,1)));
L2:=LLV(UP,15);
LL:=IF(L2=REF(L2,1) AND L1<REF(L1,1),L1,IF(L1=L2,L1,L2));
S1:=BARSLAST(CROSS(0.5,UP=LL))+1 OR BARSLAST(CROSS(1.5,UP=LL))+1 OR BARSLAST(CROSS(2.5,UP=LL))+1 OR BARSLAST(CROSS(3.5,UP=LL))+1,NODRAW;
S2:=CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),0.5) OR CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),1.5) OR CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),2.5) OR CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),3.5) OR CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),4.5);
A6:=BARSLAST(S2);
B6:=BARSLAST(CROSS(HHV(DN,A6+1),C));
支撑:IF(B6>A6,HHV(DN,BARSLAST(CROSS(B6,A6))+1),DRAWNULL),COLORRED,LINETHICK2;
压力:IF(B6<A6,LLV(UP,BARSLAST(CROSS(A6,B6))+1),DRAWNULL),COLORGREEN,LINETHICK2;
AAA:=(3*C+H+L+O)/6;
VAR1:=EMA(AAA,35);
VAR2:=(HHV(VAR1,5)+HHV(VAR1,15)+HHV(VAR1,30))/3;
VAR3:=(LLV(VAR1,5)+LLV(VAR1,15)+LLV(VAR1,30))/3;
牛线:=(HHV(VAR2,5)+HHV(VAR2,15)+HHV(VAR2,30))/3;
熊线:=(LLV(VAR3,5)+LLV(VAR3,15)+LLV(VAR3,30))/3;
疯熊:=熊线*0.90;
SPRING:=B6>A6;
春:IF(SPRING,1,DRAWNULL),COLOR3D3DFF,NODRAW;
STICKLINE(SPRING AND C>O,O,C,8/3,1),COLOR3D3DFF;
STICKLINE(SPRING AND C>O,H,C,1,1),COLOR3D3DFF;
STICKLINE(SPRING AND C>O,O,L,1,1),COLOR3D3DFF;
STICKLINE(SPRING AND C<O,O,C,8/3,0),COLOR3D3DFF;
STICKLINE(SPRING AND C<O,H,C,1,0),COLOR3D3DFF;
STICKLINE(SPRING AND C<O,O,L,1,0),COLOR3D3DFF;
STICKLINE(SPRING AND C=O,O,C,8/3,0),COLOR3D3DFF;
STICKLINE(SPRING AND C=O,H,C,1,0),COLOR3D3DFF;
STICKLINE(SPRING AND C=O,O,L,1,0),COLOR3D3DFF;
SUMMER:=NOT(AAA<熊线 AND AAA>=疯熊 AND B6<A6) AND NOT(AAA<疯熊) AND NOT(B6>A6);
夏:IF(SUMMER,1,DRAWNULL),COLORYELLOW,NODRAW;
STICKLINE(SUMMER AND C>O,O,C,8/3,1),COLORYELLOW;
STICKLINE(SUMMER AND C>O,H,C,1,1),COLORYELLOW;
STICKLINE(SUMMER AND C>O,O,L,1,1),COLORYELLOW;
STICKLINE(SUMMER AND C<O,O,C,8/3,0),COLORYELLOW;
STICKLINE(SUMMER AND C<O,H,C,1,0),COLORYELLOW;
STICKLINE(SUMMER AND C<O,O,L,1,0),COLORYELLOW;
STICKLINE(SUMMER AND C=O,O,C,8/3,0),COLORYELLOW;
STICKLINE(SUMMER AND C=O,H,C,1,0),COLORYELLOW;
STICKLINE(SUMMER AND C=O,O,L,1,0),COLORYELLOW;
AUTUMN:=AAA<熊线 AND AAA>=疯熊 AND B6<A6;
秋:IF(AUTUMN,1,DRAWNULL),COLOR7DC739,NODRAW;
STICKLINE(AUTUMN AND C>O,O,C,8/3,1),COLOR7DC739;
STICKLINE(AUTUMN AND C>O,H,C,1,1),COLOR7DC739;
STICKLINE(AUTUMN AND C>O,O,L,1,1),COLOR7DC739;
STICKLINE(AUTUMN AND C<O,O,C,8/3,0),COLOR7DC739;
STICKLINE(AUTUMN AND C<O,H,C,1,0),COLOR7DC739;
STICKLINE(AUTUMN AND C<O,O,L,1,0),COLOR7DC739;
STICKLINE(AUTUMN AND C=O,O,C,8/3,0),COLOR7DC739;
STICKLINE(AUTUMN AND C=O,H,C,1,0),COLOR7DC739;
STICKLINE(AUTUMN AND C=O,O,L,1,0),COLOR7DC739;
WINTER:=AAA<疯熊;
冬:IF(WINTER,1,DRAWNULL),COLORFC9D53,NODRAW;
STICKLINE(WINTER AND C>O,O,C,8/3,1),COLORFC9D53;
STICKLINE(WINTER AND C>O,H,C,1,1),COLORFC9D53;
STICKLINE(WINTER AND C>O,O,L,1,1),COLORFC9D53;
STICKLINE(WINTER AND C<O,O,C,8/3,0),COLORFC9D53;
STICKLINE(WINTER AND C<O,H,C,1,0),COLORFC9D53;
STICKLINE(WINTER AND C<O,O,L,1,0),COLORFC9D53;
STICKLINE(WINTER AND C=O,O,C,8/3,0),COLORFC9D53;
STICKLINE(WINTER AND C=O,H,C,1,0),COLORFC9D53;
来函数检测结果如下:
该公式没有未来函数
解密、定制、编写股票指标请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
TR1赋值:MAX(MAX((最高价-最低价),1日前的收盘价-最高价的绝对值),ABS(1日前的收盘价-最低价))
ATR赋值:TR1的10日简单移动平均
MEDIAN赋值: (最高价 + 最低价 ) / 2
上证指数赋值:INBLOCK('上证A股')
{分析家公式网HTTP://WWW.70822.COM
深证成指:=INBLOCK('深证A股')
平均股价赋值:C
如果C=上证指数返回2.1否则返回2.2
如果C=上证指数返回2.1否则返回2.2
L1赋值:REF(UP,上次UP<=REF(UP,1距今天数))
L2赋值:15日内UP最低值
LL赋值:IF(L2=1日前的L2 AND L1<1日前的L1,L1,IF(L1=L2,L1,L2))
S1赋值:上次0.5上穿UP=LL距今天数+1 OR BARSLAST(1.5上穿UP=LL)+1 OR BARSLAST(2.5上穿UP=LL)+1 OR BARSLAST(3.5上穿UP=LL)+1,NODRAW
S2赋值:CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),0.5) OR CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),1.5) OR CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),2.5) OR CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),3.5) OR CROSS(COUNT((CROSS(C,LL)) AND UP>LL,S1),4.5)
A6赋值:上次S2距今天数
B6赋值:上次CROSS(A6+1日内DN最高值,C距今天数)
输出支撑:IF(B6>A6,HHV(DN,上次B6上穿A6距今天数+1),DRAWNULL),画红色, 线宽为2
输出压力:IF(B6
AAA赋值:(3*C+H+L+O)/6
VAR1赋值:AAA的35日指数移动平均
VAR2赋值:(5日内VAR1最高值+15日内VAR1最高值+30日内VAR1最高值)/3
VAR3赋值:(5日内VAR1最低值+15日内VAR1最低值+30日内VAR1最低值)/3
牛线赋值:(5日内VAR2最高值+15日内VAR2最高值+30日内VAR2最高值)/3
熊线赋值:(5日内VAR3最低值+15日内VAR3最低值+30日内VAR3最低值)/3
疯熊赋值:熊线*0.90
SPRING赋值:B6>A6
如果SPRING返回1否则返回DRAWNULL
当满足条件SPRING AND C>O时,在O和C之间画柱状线
当满足条件SPRING AND C>O时,在H和C之间画柱状线
当满足条件SPRING AND C>O时,在O和L之间画柱状线
当满足条件SPRING AND C当满足条件SPRING AND C当满足条件SPRING AND C当满足条件SPRING AND C=O时,在O和C之间画柱状线
当满足条件SPRING AND C=O时,在H和C之间画柱状线
当满足条件SPRING AND C=O时,在O和L之间画柱状线
SUMMER赋值:NOT(AAA<熊线 AND AAA>=疯熊 AND B6A6)
如果SUMMER返回1否则返回DRAWNULL
当满足条件SUMMER AND C>O时,在O和C之间画柱状线
当满足条件SUMMER AND C>O时,在H和C之间画柱状线
当满足条件SUMMER AND C>O时,在O和L之间画柱状线
当满足条件SUMMER AND C当满足条件SUMMER AND C当满足条件SUMMER AND C当满足条件SUMMER AND C=O时,在O和C之间画柱状线
当满足条件SUMMER AND C=O时,在H和C之间画柱状线
当满足条件SUMMER AND C=O时,在O和L之间画柱状线
AUTUMN赋值:AAA<熊线 AND AAA>=疯熊 AND B6如果AUTUMN返回1否则返回DRAWNULL
当满足条件AUTUMN AND C>O时,在O和C之间画柱状线
当满足条件AUTUMN AND C>O时,在H和C之间画柱状线
当满足条件AUTUMN AND C>O时,在O和L之间画柱状线
当满足条件AUTUMN AND C当满足条件AUTUMN AND C当满足条件AUTUMN AND C当满足条件AUTUMN AND C=O时,在O和C之间画柱状线
当满足条件AUTUMN AND C=O时,在H和C之间画柱状线
当满足条件AUTUMN AND C=O时,在O和L之间画柱状线
WINTER赋值:AAA<疯熊
如果WINTER返回1否则返回DRAWNULL
当满足条件WINTER AND C>O时,在O和C之间画柱状线
当满足条件WINTER AND C>O时,在H和C之间画柱状线
当满足条件WINTER AND C>O时,在O和L之间画柱状线
当满足条件WINTER AND C当满足条件WINTER AND C当满足条件WINTER AND C当满足条件WINTER AND C=O时,在O和C之间画柱状线
当满足条件WINTER AND C=O时,在H和C之间画柱状线
- QQ:88652583
- 邮箱:88652583@qq.com
- 工作时间:8:30-23:00
- 微信:88652583或扫描如下二维码
sitemap站点地图