请高手写一个通达信的递归函数的例子

海贼西大(海米家族) 2024-12-23 11:28:02
最佳回答
通达信没有递归功能,只能自己做。我自己做的一个缠论副图公式,尚未完成,但基本功能包括k线包含,底分型,顶分型,都有了。你参考下。{每一天需要有几个参数:1、最高价,最低价,是否被前k线包含,所属走势类似(1=上升,2=下跌,3=顶分型,4=底分型,走势和分型都是最后一个k线确定,在顶底未定之前都是走势)}ma5:=ma(c,5);ma10:=ma(c,10);zb:currbarscount,nodraw;{为每根k线建立坐标}l1:= zb>1 and h<=ref(h,1) and l>=ref(l,1),nodraw;{1=当天是左包含关系}l2:= zb>2 and ref(l1,1) and h<=ref(h,2) and l>=ref(l,2),nodraw;{1=连续2天是左包含关系}l3:= zb>3 and ref(l2,1) and h<=ref(h,3) and l>=ref(l,3),nodraw;{1=连续3天是左包含关系}l4:= zb>4 and ref(l3,1) and h<=ref(h,4) and l>=ref(l,4),nodraw;{1=连续4天是左包含关系}l5:= zb>5 and ref(l4,1) and h<=ref(h,5) and l>=ref(l,5),nodraw;{1=连续5天是左包含关系}l6:= zb>6 and ref(l5,1) and h<=ref(h,6) and l>=ref(l,6),nodraw;{1=连续6天是左包含关系}l7:= zb>7 and ref(l6,1) and h<=ref(h,7) and l>=ref(l,7),nodraw;{1=连续7天是左包含关系}l8:= zb>8 and ref(l7,1) and h<=ref(h,8) and l>=ref(l,8),nodraw;{1=连续8天是左包含关系}l9:= zb>9 and ref(l8,1) and h<=ref(h,9) and l>=ref(l,9),nodraw;{1=连续9天是左包含关系}l10:= zb>10 and ref(l9,1) and h<=ref(h,10) and l>=ref(l,10),nodraw;{1=连续10天是左包含关系}lin: if(l1 or l2 or l3 or l4 or l5 or l6 or l7 or l8 or l9 or l10,1,0),nodraw; {左包含}lh: if(l10,ref(h,10),if(l9,ref(h,9),if(l8,ref(h,8),if(l7,ref(h,7),if(l6,ref(h,6),if(l5,ref(h,5),if(l4,ref(h,4),if(l3,ref(h,3),if(l2,ref(h,2),if(l1,ref(h,1),h)))))))))),nodraw;ll: if(l10,ref(l,10),if(l9,ref(l,9),if(l8,ref(l,8),if(l7,ref(l,7),if(l6,ref(l,6),if(l5,ref(l,5),if(l4,ref(l,4),if(l3,ref(l,3),if(l2,ref(l,2),if(l1,ref(l,1),l)))))))))),nodraw;r1:= if(**lastbar,0,zb>1 and h<=refx(h,1) and l>=refx(l,1)),nodraw;{1=当天是右包含关系}r2:= if(**lastbar,0,zb>2 and ref(r1,1) and h<=refx(h,1) and l>=refx(l,1)),nodraw;{1=连续2天是右包含关系}r3:= if(**lastbar,0,zb>3 and ref(r2,1) and h<=refx(h,1) and l>=refx(l,1)),nodraw;{1=连续3天是右包含关系}r4:= if(**lastbar,0,zb>4 and ref(r3,1) and h<=refx(h,1) and l>=refx(l,1)),nodraw;{1=连续4天是右包含关系}r5:= if(**lastbar,0,zb>5 and ref(r4,1) and h<=refx(h,1) and l>=refx(l,1)),nodraw;{1=连续5天是右包含关系}r6:= if(**lastbar,0,zb>6 and ref(r5,1) and h<=refx(h,1) and l>=refx(l,1)),nodraw;{1=连续6天是右包含关系}r7:= if(**lastbar,0,zb>7 and ref(r6,1) and h<=refx(h,1) and l>=refx(l,1)),nodraw;{1=连续7天是右包含关系}r8:= if(**lastbar,0,zb>8 and ref(r7,1) and h<=refx(h,1) and l>=refx(l,1)),nodraw;{1=连续8天是右包含关系}r9:= if(**lastbar,0,zb>9 and ref(r8,1) and h<=refx(h,1) and l>=refx(l,1)),nodraw;{1=连续9天是右包含关系}r10:=if(**lastbar,0,zb>10 and ref(r9,1) and h<=refx(h,1) and l>=refx(l,1)),nodraw;{1=连续10天是右包含关系}rin: if(r1 or r2 or r3 or r4 or r5 or r6 or r7 or r8 or r9 or r10,1,0),nodraw; {右包含}ld:= const(daytodate((datetoday(date)-finance(42))))+19000000,nodraw;{上市年月日}rh:= if(r10,refx(h,10),if(r9,refx(h,9),if(r8,refx(h,8),if(r7,refx(h,7),if(r6,refx(h,6),if(r5,refx(h,5),if(r4,refx(h,4),if(r3,refx(h,3),if(r2,refx(h,2),if(r1,refx(h,1),h)))))))))),nodraw;rl:= if(r10,refx(l,10),if(r9,refx(l,9),if(r8,refx(l,8),if(r7,refx(l,7),if(r6,refx(l,6),if(r5,refx(l,5),if(r4,refx(l,4),if(r3,refx(l,3),if(r2,refx(l,2),if(r1,refx(l,1),l)))))))))),nodraw;ck: not(lin or rin),nodraw;{当前k线是有效的缠论k线}ck0:=lin or rin,nodraw;cka1:= if(**lastbar,0,if(refx(ck,1),1,if(refx(ck,2),2,if(refx(ck,3),3,if(refx(ck,4),4,if(refx(ck,5),5,if(refx(ck,6),6,if(refx(ck,7),7,if(refx(ck,8),8,if(refx(ck,9),9,if(refx(ck,10),10,0))))))))))),nodraw;{后续第一根有效缠论k线到当前k线周期数} cka2:= if(**lastbar,0,cka1+refx(cka1,cka1)),nodraw;{后续第二根缠论k线到当前周期数}v1: ref(ck,1),nodraw;v2:= ref(ck0,1) and ref(ck,2),nodraw;v3:= ref(ck0,1) and ref(ck0,2) and ref(ck,3),nodraw;v4:= ref(ck0,1) and ref(ck0,2) and ref(ck0,3) and ref(ck,4),nodraw;v5:= ref(ck0,1) and ref(ck0,2) and ref(ck0,3) and ref(ck0,4) and ref(ck,5),nodraw;v6:= ref(ck0,1) and ref(ck0,2) and ref(ck0,3) and ref(ck0,4) and ref(ck0,5) and ref(ck,6),nodraw;v7:= ref(ck0,1) and ref(ck0,2) and ref(ck0,3) and ref(ck0,4) and ref(ck0,5) and ref(ck0,6) and ref(ck,7),nodraw;v8:= ref(ck0,1) and ref(ck0,2) and ref(ck0,3) and ref(ck0,4) and ref(ck0,5) and ref(ck0,6) and ref(ck0,7) and ref(ck,8),nodraw;v9:= ref(ck0,1) and ref(ck0,2) and ref(ck0,3) and ref(ck0,4) and ref(ck0,5) and ref(ck0,6) and ref(ck0,7) and ref(ck0,8) and ref(ck,9),nodraw;v10:=ref(ck0,1) and ref(ck0,2) and ref(ck0,3) and ref(ck0,4) and ref(ck0,5) and ref(ck0,6) and ref(ck0,7) and ref(ck0,8) and ref(ck0,9) and ref(ck,10),nodraw;ckb1: if(ck and v1,1,if(ck and v2,2,if(ck and v3,3,if(ck and v4,4,if(ck and v5,5,if(ck and v6,6,if(ck and v7,7,if(ck and v8,8,if(ck and v9,9,if(ck and v10,10,0)))))))))),nodraw;{前面一根有效缠论k线到当前k线周期数} ckb2:= ckb1+ref(ckb1,ckb1),nodraw;{前面第二根缠论k线到当前的周期数}upxbgn:= if(**lastbar,0,if(ck and lh<refx(lh,cka1) and refx(lh,cka1)> refx(lh,cka2),1,0)),nodraw;upxmid:= if(ck and ref(upxbgn,ckb1) and lh>ref(lh,ckb1) and lh>refx(lh,cka1),1,0),nodraw;upxend:= if(ck and ref(upxbgn,ckb2) and ref(upxmid,ckb1) and lh<ref(lh,ckb1) and ref(lh,ckb1) > ref(lh,ckb2),1,0),nodraw;dwxbgn: if(**lastbar,0,if(ck=1 and ll>refx(ll,cka1) and refx(ll,cka1)< refx(ll,cka2),1,0)),nodraw;dwxmid: if(ck and ref(dwxbgn,ckb1) and ref(ll,ckb1) >ll and ll< refx(ll,cka1),1,0),nodraw;dwxend:= if(ck and ref(dwxmid,ckb1) and ref(dwxbgn,ckb2) and ref(ll,ckb2) > ref(ll,ckb1) and ref(ll,ckb1) < ll,1,0),nodraw;upx0:= barssince(upxmid),nodraw;dwx0:= barssince(dwxmid),nodraw;x0: if(upx0>dwx0,1,0),nodraw;{x0表示该股第一次分型的类型,1表示顶分型,0表示底分型};szxbgn:= if(ck and **lastbar and h<=ref(h,1),0,if(ck and lh>ref(lh,ckb1),1,0)),nodraw;lastupx: ref(barslast(upxmid),1),nodraw;lastdwx: ref(barslast(dwxmid),1),nodraw;newupx: upxmid,nodraw;newdwx: dwxmid,nodraw;upx: ref(newupx,ckb1) and upxmid,nodraw;dwx: ref(newdwx,ckb1) and dwxmid,nodraw;stickline(lin or rin,h,l,0.8,1),colorgray;{stickline(not(lin or rin) and c>o,h,l,0.8,2),colorred;stickline(not(lin or rin) and c<o,h,l,0.8,2),colorcyan;stickline(not(lin or rin) and c=o,h,l,0.8,2),colorwhite;}stickline(not(lin or rin) ,h,l,0.8,2),colorwhite;stickline(upxmid,lh,ll,1,0),colorred;stickline(dwxmid,lh,ll,1,0),colorcyan;drawline(newupx,lh,dwxmid,ll,0),colorgreen,linethick1;drawline(newdwx,ll,upxmid,lh,0),colorgreen,linethick1; 20210311
汇率兑换计算器

类似问答
  • 请高手编写通达信指标
    • 2024-12-23 14:11:54
    • 提问者: 未知
    涨:=(c-ref(c,1))/ref(c,1)*100;昨:=ref(涨,1);前:=ref(昨,1);t20:ma(涨,20)*100;{20改为24的效果更好些} xg:if(t20,10,0);试试看
  • 求高手编写一个通达信的指标公式
    • 2024-12-23 22:03:14
    • 提问者: 未知
    这样写就行了:zcgs:ema(winner(c)*70,3)*c,linethick2,colorred;scgs:ema((winner(c*1.1)-winner(c*0.9))*70,3)*c,linethick1,colorgreen;drawnumber(cross(zcgs,scgs),scgs,c);这个好像准确率不高,在牛市用吧,熊市容易买在顶点。
  • 请高手编写个通达信选股公式
    • 2024-12-23 04:09:40
    • 提问者: 未知
    算了,无**式好不好先不说,我还是帮你做一个吧!难得你这么求成心切,说心里话这个三组合真的不是很好。股票公式不能说没有用,要看你怎么样操作。按照自己的操作习惯来做这样更好。我先帮你做吧!vma5:=ma(vv,5);vm410:=ma(vv,10);rsv:=(close-llv(low,9))/(hhv(high,9)-llv(low,9))*100;k:=sma(rsv,9,1);d:=sma...
  • 请高手写一个通达信的cci加均线ma的公式
    • 2024-12-23 05:30:21
    • 提问者: 未知
    ma1:ma(close,5);ma2:ma(close,10);a:=cci.cci;drawicon(cross(ma1,ma2) and a<-100,ma1,1);drawicon(cross(ma2,ma1) and a>100,ma1,2); 公式已测试通过!希望能够帮助你!效果图如下:
  • 如何编写一个简单的通达信时间函数
    • 2024-12-23 00:33:54
    • 提问者: 未知
    t1:=barslast( date=1070301);t2:=barslast( date=1070518);xg:between(a,t1,t2);a即介于两时间点之间的条件值。自定。
  • 请高手编写一个通达信选股程序?
    • 2024-12-23 21:36:27
    • 提问者: 未知
    名称:攻克半年线 参数:n=60 count(cross(h,ma(c,120)),n)>=2 and count(cross(h,ma(c,120)),n) and c>ma(c,120) and every(macd.macd>0,barssincen(cross(h,ma(c,120)),n));
  • 编写求x的n次方的递归函数?
    • 2024-12-23 11:38:22
    • 提问者: 未知
    main()中scanf(%f%d",&x,&n);printf("%f",m);你先把格式改好再试试。
  • 请高手编写一个通达信条件选股公式!
    • 2024-12-23 11:00:28
    • 提问者: 未知
    f1:=ma(c,120);f2:=ref(c,1)<f1;f3:=c>f1;f1 and f2 and f3【已经测试,含以上个股】祝你开开心心,事事如意! (*^__^*) 不明白的再问哟,请及时采纳,多谢!
  • 请高手帮忙编写一个通达信选股指标
    • 2024-12-23 13:07:43
    • 提问者: 未知
    lc:=ref(close,1);rsi1:=sma(max(close-lc,0),n1,1)/sma(abs(close-lc),n1,1)*100;rsi2:=sma(max(close-lc,0),n2,1)/sma(abs(close-lc),n2,1)*100;rsi3:=sma(max(close-lc,0),n3,1)/sma(abs(close-lc),n3,1)*100;rsi...
  • 请高手编写一个选股公式,通达信
    • 2024-12-23 18:56:10
    • 提问者: 未知
    ma5:=ma(c,5);t1:=h>ma5;t2:=c>ma5;xg:ref(c<ma5,1) and (t1 or t2);根据思路编写公式,修改公式。盘中预警,条件选股。公式解密,去除时间限制。鼠标点击下方 我 的 名 字 上,进入 可 订 公式。
汇率兑换计算器

热门推荐
热门问答
最新问答
推荐问答
新手帮助
常见问题
房贷计算器-九子财经 | 备案号: 桂ICP备19010581号-1 商务联系 企鹅:2790-680461

特别声明:本网为公益网站,人人都可发布,所有内容为会员自行上传发布",本站不承担任何法律责任,如内容有该作者著作权或违规内容,请联系我们清空删除。