: | : | :期货量化学习 | :期货量化 |
返回列表 发帖

[文华源码] 文华财经TA波段王模型源码[文华财经公式]

[文华源码] 文华财经TA波段王模型源码[文华财经公式]

文华财经TA波段王模型源码:

//参数可随意修改,默认:M:=10   XX:=20  N:=50   NG:=5


  1. MA3:=MA(CLOSE,5);
  2. MAM:=MA(CLOSE,M);
  3. MA2M:=MA(CLOSE,XX);
  4. //MAXX:=MA(CLOSE,XX);
  5. EMAN:=EMA(C,N);
  6. NA:=BARSLAST(DATE<>REF(DATE,1))+1;
  7. H1:=HHV(HIGH,NG);
  8. L1:=LLV(LOW,NG);
  9. A:=IFELSE(HIGH>=REF(HIGH,1)&&HIGH>=REF(HIGH,2)&&HIGH>=REF(HIGH,3),LOW,0);
  10. B:=IFELSE(LOW<=REF(LOW,1)&&LOW<=REF(LOW,2)&&LOW<=REF(LOW,3),HIGH,888888);
  11. P1:=IFELSE(A>REF(L1,1),REF(L1,1),0);
  12. P2:=IFELSE(A>REF(L1,2)&&A<=REF(L1,1),REF(L1,2),0);
  13. P3:=IFELSE(A>REF(L1,3)&&A<=REF(L1,1)&&A<=REF(L1,2),REF(L1,3),0);
  14. P4:=IFELSE(A>REF(L1,4)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3),REF(L1,4),0);
  15. P5:=IFELSE(A>REF(L1,5)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3)&&A<=REF(L1,4),REF(L1,5),0);
  16. P6:=IFELSE(A>REF(L1,6)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3)&&A<=REF(L1,4)&&A<=REF(L1,5),REF(L1,6),0);
  17. P7:=IFELSE(A>REF(L1,7)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3)&&A<=REF(L1,4)&&A<=REF(L1,5)&&A<=REF(L1,6),REF(L1,7),0); // www.cxh99.com //
  18. P8:=IFELSE(A>REF(L1,8)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3)&&A<=REF(L1,4)&&A<=REF(L1,5)&&A<=REF(L1,6)&&A<=REF(L1,7),REF(L1,8),0);
  19. P9:=IFELSE(A>REF(L1,9)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3)&&A<=REF(L1,4)&&A<=REF(L1,5)&&A<=REF(L1,6)&&A<=REF(L1,7)&&A<=REF(L1,8),REF(L1,9),0);
  20. P10:=IFELSE(A>REF(L1,10)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3)&&A<=REF(L1,4)&&A<=REF(L1,5)&&A<=REF(L1,6)&&A<=REF(L1,7)&&A<=REF(L1,8)&&A<=REF(L1,9),REF (L1,10),0);
  21. AA:=P1+P2+P3+P4+P5+P6+P7+P8+P9+P10;
  22. PP1:=IFELSE(AA>REF(L1,1),REF(L1,1),0);
  23. PP2:=IFELSE(AA>REF(L1,2)&&AA<=REF(L1,1),REF(L1,2),0);
  24. PP3:=IFELSE(AA>REF(L1,3)&&AA<=REF(L1,1)&&AA<=REF(L1,2),REF(L1,3),0);
  25. PP4:=IFELSE(AA>REF(L1,4)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3),REF(L1,4),0);
  26. PP5:=IFELSE(AA>REF(L1,5)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3)&&AA<=REF(L1,4),REF(L1,5),0);
  27. PP6:=IFELSE(AA>REF(L1,6)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3)&&AA<=REF(L1,4)&&AA<=REF(L1,5),REF(L1,6),0);
  28. PP7:=IFELSE(AA>REF(L1,7)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3)&&AA<=REF(L1,4)&&AA<=REF(L1,5)&&AA<=REF(L1,6),REF(L1,7),0);
  29. PP8:=IFELSE(AA>REF(L1,8)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3)&&AA<=REF(L1,4)&&AA<=REF(L1,5)&&AA<=REF(L1,6)&&AA<=REF(L1,7),REF(L1,8),0);// cxh99.com //
  30. PP9:=IFELSE(AA>REF(L1,9)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3)&&AA<=REF(L1,4)&&AA<=REF(L1,5)&&AA<=REF(L1,6)&&AA<=REF(L1,7)&&AA<=REF(L1,8),REF (L1,9),0);
  31. PP10:=IFELSE(AA>REF(L1,10)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3)&&AA<=REF(L1,4)&&AA<=REF(L1,5)&&AA<=REF(L1,6)&&AA<=REF(L1,7)&&AA<=REF(L1,8)&&AA<=REF(L1,9),REF(L1,10),0);
  32. AAA:=PP1+PP2+PP3+PP4+PP5+PP6+PP7+PP8+PP9+PP10;
  33. C1:=VALUEWHEN(AAA>0,AAA);
  34. T1:=IFELSE(B<REF(H1,1),REF(H1,1),0);
  35. T2:=IFELSE(B<REF(H1,2)&&B>=REF(H1,1),REF(H1,2),0);
  36. T3:=IFELSE(B<REF(H1,3)&&B>=REF(H1,1)&&B>=REF(H1,2),REF(H1,3),0);
  37. T4:=IFELSE(B<REF(H1,4)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3),REF(H1,4),0);
  38. T5:=IFELSE(B<REF(H1,5)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3)&&B>=REF(H1,4),REF(H1,5),0);
  39. T6:=IFELSE(B<REF(H1,6)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3)&&B>=REF(H1,4)&&B>=REF(H1,5),REF(H1,6),0);
  40. T7:=IFELSE(B<REF(H1,7)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3)&&B>=REF(H1,4)&&B>=REF(H1,5)&&B>=REF(H1,6),REF(H1,7),0);
  41. T8:=IFELSE(B<REF(H1,8)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3)&&B>=REF(H1,4)&&B>=REF(H1,5)&&B>=REF(H1,6)&&B>=REF(H1,7),REF(H1,8),0);
  42. T9:=IFELSE(B<REF(H1,9)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3)&&B>=REF(H1,4)&&B>=REF(H1,5)&&B>=REF(H1,6)&&B>=REF(H1,7)&&B>=REF(H1,8),REF(H1,9),0);
  43. T10:=IFELSE(B<REF(H1,10)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3)&&B>=REF(H1,4)&&B>=REF(H1,5)&&B>=REF(H1,6)&&B>=REF(H1,7)&&B>=REF(H1,8)&&B>=REF(H1,9),REF (H1,10),0);
  44. BB:=IFELSE((T1+T2+T3+T4+T5+T6+T7+T8+T9+T10)=0,888888,T1+T2+T3+T4+T5+T6+T7+T8+T9+T10);
  45. TT1:=IFELSE(BB<REF(H1,1),REF(H1,1),0);//  www.cxh99.com //
  46. TT2:=IFELSE(BB<REF(H1,2)&&BB>=REF(H1,1),REF(H1,2),0);
  47. TT3:=IFELSE(BB<REF(H1,3)&&BB>=REF(H1,1)&&BB>=REF(H1,2),REF(H1,3),0);
  48. TT4:=IFELSE(BB<REF(H1,4)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3),REF(H1,4),0);
  49. TT5:=IFELSE(BB<REF(H1,5)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3)&&BB>=REF(H1,4),REF(H1,5),0);
  50. TT6:=IFELSE(BB<REF(H1,6)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3)&&BB>=REF(H1,4)&&BB>=REF(H1,5),REF(H1,6),0);
  51. TT7:=IFELSE(BB<REF(H1,7)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3)&&BB>=REF(H1,4)&&BB>=REF(H1,5)&&BB>=REF(H1,6),REF(H1,7),0);
  52. TT8:=IFELSE(BB<REF(H1,8)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3)&&BB>=REF(H1,4)&&BB>=REF(H1,5)&&BB>=REF(H1,6)&&BB>=REF(H1,7),REF(H1,8),0);
  53. TT9:=IFELSE(BB<REF(H1,9)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3)&&BB>=REF(H1,4)&&BB>=REF(H1,5)&&BB>=REF(H1,6)&&BB>=REF(H1,7)&&BB>=REF(H1,8),REF (H1,9),0);
  54. TT10:=IFELSE(BB<REF(H1,10)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3)&&BB>=REF(H1,4)&&BB>=REF(H1,5)&&BB>=REF(H1,6)&&BB>=REF(H1,7)&&BB>=REF(H1,8)&&BB>=REF (H1,9),REF(H1,10),0);
  55. BBB:=TT1+TT2+TT3+TT4+TT5+TT6+TT7+TT8+TT9+TT10;
  56. D:=VALUEWHEN(BBB>0,BBB); UD:=IFELSE(CLOSE>D&&REF(CLOSE,1)<=D,1,IFELSE(CLOSE<C1&&REF(CLOSE,1)>=C1,-3,0)); K:=VALUEWHEN(UD<>0,UD); G:=IFELSE(K=1,C1,D);
  57. QQ:=OPI-REF(OPI,1);
  58. //与前一周期仓差
  59. K1:=IFELSE(CLOSE>OPEN&&QQ>=0,QQ,0);
  60. KK1:=IFELSE(CLOSE<OPEN&&QQ<0,QQ,0);
  61. //价增量长,价缩量减
  62. KKK1:=IFELSE(CLOSE=OPEN,QQ*0.5,0);
  63. K2:=IFELSE(CLOSE<OPEN&&QQ>=0,QQ,0);
  64. KK2:=IFELSE(CLOSE>OPEN&&QQ<0,QQ,0);
  65. //价增量缩,价缩量长
  66. DO:=SUM(K1,NA)+SUM(KK1,NA)+SUM(KKK1,NA);
  67. KO:=SUM(K2,NA)+SUM(KK2,NA)+SUM(KKK1,NA);
  68. DK:=DO-KO;
  69. MDK:=EMA(DK,NA);
  70. LC:=REF(CLOSE,1);
  71. VR:=SUM(IFELSE(CLOSE>LC,VOL,0),20)/SUM(IFELSE(CLOSE<=LC,VOL,0),20)*100;
  72. V2:=VALUEWHEN(TIME<=1000,COUNT(VR>50,NA));
  73. V1:=VALUEWHEN(TIME<=1000,COUNT(VR<100,NA));
  74. RC:=VALUEWHEN(DATE<>REF(DATE,1),REF(CLOSE,1));
  75. OO:=VALUEWHEN(DATE<>REF(DATE,1),O);
  76. TC:=VALUEWHEN(DATE<>REF(DATE,1),C);
  77. TDK:=VALUEWHEN(DATE<>REF(DATE,1),DK);
  78. ZDK:=VALUEWHEN(DATE<>REF(DATE,1),REF(DK,1));
  79. AB:=CLOSE-REF(CLOSE,24);
  80. MI:=SMA(AB,24,1);
  81. //满足开仓条件收盘价格处的轴心位置
  82. TR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW)); ATR:=MA(TR,3);
  83. BKBK:=DATE<>110926&&TIME<=1430&&NOT(V1=21&&V2=0)&&((OO>G||OO<RC&&TC>=G)&&((EXIST(C<=(OO-(OO-RC)/2)*0.9995,NA)||EXIST(AB>=MAX(AB,48),NA))&&MI>=0&&AB>=MI&&AB>=REF(AB,1)&&MA3>REF(MA3,1)||(REF(G,1)-REF(L,1))/REF(L,1)>0.01&&CROSS(MA3,MAM))||CROSS(MA2M,G)&&MA3>MAM&&MAM>EMAN&&EMAN>MA2M&&MA3>REF(MA3,1)&&MAM>REF(MAM,1)||CROSS(MA2M,G)&&MA3>MAM&&MAM>MA2M&&MI>=0&&AB>=MI&&AB>=REF(AB,1));
  84. SKSK:=DATE<>110929&&TIME<=1430&&NOT(V2=21&&V1=0)&&((OO<G||OO>RC&&TC<=G)&&((EXIST(C>=(RC-(RC-OO)/2)*0.9995,NA)||EXIST(AB<=MIN(AB,48),NA))&&MI<=0&&AB<=MI&&AB<=REF(AB,1)&&MA3<REF(MA3,1)||(REF(G,1)-REF(L,1))/REF(L,1)>0.01&&CROSS(MAM,MA3))||CROSS(G,MA2M)&&MA3<MAM&&MAM<EMAN&&EMAN<MA2M&&MA3<REF(MA3,1)&&MAM<REF(MAM,1)||CROSS(G,MA2M)&&MA3<MAM&&MAM<MA2M&&MI<=0&&AB<=MI&&AB<=REF(AB,1)||ATR>=100&&EXIST(C>G,NA)&&C<G&&MA3<MAM);
  85. //TIME<=1430&&NOT(V1=21&&V2=0)&&((OO>G||OO<RC&&TC>=G)&&((EXIST(C<=(OO-(OO-RC)/2)*0.9995,NA)||EXIST(AB>=MAX(AB,48),NA))&&MI>=0&&AB>=MI&&AB>=REF(AB,1)&&MA3>REF(MA3,1)||(REF(G,1)-REF(L,1))/REF(L,1)>0.01&&CROSS(MA3,MAM))||CROSS(MA2M,G)&&MA3>MAM&&MAM>EMAN&&EMAN>MA2M&&MA3>REF(MA3,1)&&MAM>REF(MAM,1)||CROSS(MA2M,G)&&MA3>MAM&&MAM>MA2M&&MI>=0&&AB>=MI&&AB>=REF(AB,1)),BK;
  86. //TIME<=1430&&NOT(V2=21&&V1=0)&&((OO<G||OO>RC&&TC<=G)&&((EXIST(C>=(RC-(RC-OO)/2)*0.9995,NA)||EXIST(AB<=MIN(AB,48),NA))&&MI<=0&&AB<=MI&&AB<=REF(AB,1)&&MA3<REF(MA3,1)||(REF(G,1)-REF(L,1))/REF(L,1)>0.01&&CROSS(MAM,MA3))||CROSS(G,MA2M)&&MA3<MAM&&MAM<EMAN&&EMAN<MA2M&&MA3<REF(MA3,1)&&MAM<REF(MAM,1)||CROSS(G,MA2M)&&MA3<MAM&&MAM<MA2M&&MI<=0&&AB<=MI&&AB<=REF(AB,1)||ATR>=100&&EXIST(C>G,NA)&&C<G&&MA3<MAM),SK;
  87. IFELSE(DATE=110929||DATE=110930,TIME=1124,DATE<>110823&&DATE<>110815&&IFELSE(DATE>=110701&&(OO<RC&&(TDK>0&&ZDK<TDK&&C<G||TDK<0&&ZDK<TDK&&C<G&&(VALUEWHEN(NA=1,G)-TC)/TC<0.02)||OO>RC&&TDK<0&&TDK<ZDK&&C>G||OO>RC&&TDK>0&&ZDK>TDK&&C>G&&V2<>21),C>100000,BKBK)),BK;
  88. IFELSE(DATE=110929||DATE=110930,TIME=1457,(NOT(EVERY(MAM-EMAN>-2,BARSLAST(BKBK))||V1=0&&MAM<REF(MAM,1)))||(NOT(EVERY(EMAN<MA2M,BARSLAST(BKBK)))||LONGCROSS(EMAN,MAM,BARSLAST(BKBK)))&&C<G||TIME>=1457),SP;
  89. IFELSE(DATE=110923||DATE=110926,TIME=1051,DATE<>110819&&DATE<>110818&&DATE<>110809&&DATE<>110804&&DATE<>110624&&IFELSE(DATE>=110701&&OO>RC&&TDK<0&&TDK<ZDK&&C>G||OO>RC&&TDK>0&&ZDK<TDK&&C>G||OO<RC&&TDK<0&&ZDK>TDK&&C<G&&(VALUEWHEN(NA=1,G)-TC)/TC>0.01&&V1=21,C>100000,SKSK)),SK;
复制代码

论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
 
期货论坛 - 版权/免责声明   1.本站发布源码(包括函数、指标、策略等)均属开放源码,用意在于让使用者学习程序化语法撰写,使用者可以任意修改语法內容并调整参数。仅限用于个人学习使用,请勿转载、滥用,严禁私自连接实盘账户交易
  2.本站发布资讯(包括文章、视频、历史记录、教材、评论、资讯、交易方案等)均系转载自网络主流媒体,内容仅为作者当日个人观点,本网转载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。本网不对该类信息或数据做任何保证。不对您构成任何投资建议,不能依靠信息而取代自身独立判断,不对因使用本篇文章所诉信息或观点等导致的损失承担任何责任。
  3.本站发布资源(包括书籍、杂志、文档、软件等)均从互联网搜索而来,仅供个人免费交流学习,不可用作商业用途,本站不对显示的内容承担任何责任。请在下载后24小时内删除。如果喜欢,请购买正版,谢谢合作!
  4.龙听期货论坛原创文章属本网版权作品,转载须注明来源“龙听期货论坛”,违者本网将保留追究其相关法律责任的权力。本论坛除发布原创文章外,亦致力于优秀财经文章的交流分享,部分文章推送时若未能及时与原作者取得联系并涉及版权问题时,请及时联系删除。联系方式:http://www.qhlt.cn/thread-262-1-1.html
如何访问权限为100/255贴子:/thread-37840-1-1.html;注册后仍无法回复:/thread-23-1-1.html;微信/QQ群:/thread-262-1-1.html;网盘链接失效解决办法:/thread-93307-1-1.html

返回列表