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

[文华源码] 蛟龙模型 日内交易模型[文华财经公式]

[文华源码] 蛟龙模型 日内交易模型[文华财经公式]

源码:
  1. //模型适用于 橡胶日内1—5分钟 模型的思路好不好,在这里供大家学习 交流!希望大家多多支持!



  2. MA3:=MA(CLOSE,3);
  3. MAM:=MA(CLOSE,M);
  4. MA2M:=MA(CLOSE,2*M);
  5. MAXX:=MA(CLOSE,XX);
  6. EMAN:=EMA(C,N);
  7. NA:=BARSLAST(DATE<>REF(DATE,1))+1;
  8. HHH:=HHV(HIGH,NA);
  9. LLL:=LLV(LOW,NA);
  10. CC1:=VALUEWHEN(DATE<>REF(DATE,1),REF(CLOSE,1));
  11. AA1:=VALUEWHEN(DATE<>REF(DATE,1),REF(HHH,1));
  12. BB1:=VALUEWHEN(DATE<>REF(DATE,1),REF(LLL,1));
  13. PT  := AA1-BB1;
  14. CDP :=(AA1 + BB1 + CC1)/3;
  15. AH  := CDP + PT;
  16. HH :=AH + PT;
  17. AL  : =CDP - PT;
  18. CDL:=CDP;
  19. NH  :=2*CDP-BB1;
  20. NL  :=2*CDP-AA1;
  21. LL:=AL - PT;
  22. H1:=HHV(HIGH,NG);
  23. L1:=LLV(LOW,NG);
  24. A:=IFELSE(HIGH>=REF(HIGH,1)&&HIGH>=REF(HIGH,2)&&HIGH>=REF(HIGH,3),LOW,0);
  25. B:=IFELSE(LOW<=REF(LOW,1)&&LOW<=REF(LOW,2)&&LOW<=REF(LOW,3),HIGH,888888);
  26. P1:=IFELSE(A>REF(L1,1),REF(L1,1),0);
  27. P2:=IFELSE(A>REF(L1,2)&&A<=REF(L1,1),REF(L1,2),0);
  28. P3:=IFELSE(A>REF(L1,3)&&A<=REF(L1,1)&&A<=REF(L1,2),REF(L1,3),0);
  29. P4:=IFELSE(A>REF(L1,4)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3),REF(L1,4),0);
  30. 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);
  31. 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);
  32. 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);
  33. 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);
  34. 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);
  35. 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);
  36. AA:=P1+P2+P3+P4+P5+P6+P7+P8+P9+P10;
  37. PP1:=IFELSE(AA>REF(L1,1),REF(L1,1),0);
  38. PP2:=IFELSE(AA>REF(L1,2)&&AA<=REF(L1,1),REF(L1,2),0);
  39. PP3:=IFELSE(AA>REF(L1,3)&&AA<=REF(L1,1)&&AA<=REF(L1,2),REF(L1,3),0);
  40. PP4:=IFELSE(AA>REF(L1,4)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3),REF(L1,4),0);
  41. 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);
  42. 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);
  43. 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);
  44. 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);
  45. 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);
  46. 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);
  47. AAA:=PP1+PP2+PP3+PP4+PP5+PP6+PP7+PP8+PP9+PP10;
  48. C1:=VALUEWHEN(AAA>0,AAA);
  49. T1:=IFELSE(B<REF(H1,1),REF(H1,1),0);
  50. T2:=IFELSE(B<REF(H1,2)&&B>=REF(H1,1),REF(H1,2),0);
  51. T3:=IFELSE(B<REF(H1,3)&&B>=REF(H1,1)&&B>=REF(H1,2),REF(H1,3),0);
  52. T4:=IFELSE(B<REF(H1,4)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3),REF(H1,4),0);
  53. 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);
  54. 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);
  55. 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);
  56. 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);
  57. 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);
  58. 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);
  59. BB:=IFELSE((T1+T2+T3+T4+T5+T6+T7+T8+T9+T10)=0,888888,T1+T2+T3+T4+T5+T6+T7+T8+T9+T10);
  60. TT1:=IFELSE(BB<REF(H1,1),REF(H1,1),0);
  61. TT2:=IFELSE(BB<REF(H1,2)&&BB>=REF(H1,1),REF(H1,2),0);
  62. TT3:=IFELSE(BB<REF(H1,3)&&BB>=REF(H1,1)&&BB>=REF(H1,2),REF(H1,3),0);
  63. TT4:=IFELSE(BB<REF(H1,4)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3),REF(H1,4),0);
  64. 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);
  65. 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);
  66. 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);
  67. 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);
  68. 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);
  69. 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);
  70. BBB:=TT1+TT2+TT3+TT4+TT5+TT6+TT7+TT8+TT9+TT10;
  71. 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);
  72. LC:=REF(CLOSE,1);
  73. RSV:=(CLOSE-LLV(LOW,10))/(HHV(HIGH,10)-LLV(LOW,10))*100;
  74. KK:=SMA(RSV,5,1);
  75. DD:=SMA(KK,5,1);
  76. JJ:=3*KK-2*DD;
  77. TR : =MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
  78. ATR := MA(TR,5);
  79. ATR1:= MA(TR,4);
  80. ATR2:=MA(TR,3);
  81. MTR:= IFELSE(TIME<=0912,ATR2/C*100000,IFELSE(TIME>0912&&TIME<=0915,ATR1/C*100000,ATR/C*100000));
  82. //RX:=REF(J,2)<10&&REF(H,1)>REF(H,2)&&REF(C,1)>REF(C,2)&&REF(C,1)>REF(O,2)&&REF(L,1)>REF(L,2);
  83. //X1:=REF(JJ,1)<10&&H>REF(H,1)&&C>REF(C,1)&&C>REF(O,1)&&L>REF(L,1);//超S
  84. //显示超卖和价升K线,抢反弹的敏感指标!
  85. VR:=SUM(IFELSE(CLOSE>LC,VOL,0),20)/SUM(IFELSE(CLOSE<=LC,VOL,0),20)*100;
  86. V2:=VALUEWHEN(TIME<=1000,COUNT(VR>50,NA));
  87. V1:=VALUEWHEN(TIME<=1000,COUNT(VR<100,NA));
  88. RC:=VALUEWHEN(DATE<>REF(DATE,1),REF(CLOSE,1));
  89. OO:=VALUEWHEN(DATE<>REF(DATE,1),O);
  90. TC:=VALUEWHEN(DATE<>REF(DATE,1),C);
  91. AB:=CLOSE-REF(CLOSE,24);
  92. MI:=SMA(AB,24,1);
  93. SK1:=COUNT((H-G)/G>=0.00169&&AB>=850,NA)>=1&&AB<REF(AB,1)&&CROSS(MAM,MA3);
  94. BK1:=DD>30&&COUNT((G-L)/L>=0.00169&&AB>=-950,NA)>=1&&AB>REF(AB,1)&&CROSS(MA3,MAM);
  95. SKSK:=TIME<=1430&&NOT(TIME>=1000&&(V2>21||V2>=19&&V1<9))&&(OO<G&&((EXIST(C>=(RC-(RC-OO)/2)*0.9995,20)||VALUEWHEN(DATE<>REF(DATE,1),AB)<=-20)&&MI<=0&&AB<=MI&&AB<=REF(AB,1))||(REF(G,1)-REF(L,1))/REF(L,1)>0.01&&CROSS(MAM,MA3)||CROSS(G,MA2M)&&MA3<MAM&&MAM<EMAN&&EMAN<MA2M&&MA2M<MAXX&&MA3<REF(MA3,1)&&MAM<REF(MAM,1)||CROSS(G,MA2M)&&MA3<MAM&&MAM<MA2M&&MA2M<MAXX&&MI<=0&&AB<=MI&&AB<=REF(AB,1));//
  96. BKBK:=IFELSE(TIME>=1000,V2>16,V2>0)&&TIME<=1430&&NOT(V1=21&&V2=0)&&(BK1||NA>3&&((OO>G||OO<RC&&TC>=G)&&(TIME<0957&&EXIST(CROSS(AB,MI),10)||TIME>=1330)&&(EXIST(AB>=400,NA)&&(H-OO)>=0.0076&&MA(MI,5)>REF(MA(MI,5),1)&&MI>=0&&AB>=MI&&AB>=REF(AB,1)&&MA3>REF(MA3,1)&&MA3>MAM*1.0001||(HHV(H,NA)-LLV(L,NA))/LLV(L,NA)>0.022&&MA3>MAM&&MAM>MA2M)||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)));
  97. WWW1:=VALUEWHEN(BARSLAST(BKBK)=1,CLOSE);
  98. //满足开仓条件收盘价格处的轴心位置
  99. DATE<>111010&&DATE<>111011&&DATE<>111017&&DATE<>110927&&DATE<>110928&&DATE<>110920&&DATE<>110921&&IFELSE(TIME>=1000,V2>16,V2>0)&&TIME<=1430&&NOT(V1=21&&V2=0)&&NA>3&&NOT((DD>80||JJ>90)&&MTR<200)&&NOT
  100. (NOT(EVERY(MAM-EMAN>-2||MA2M>G*0.99,BARSLAST(BKBK))||V1=0||OO>HH))&&C>=HH*1.0013||(NOT(EVERY(EMAN<MA2M,BARSLAST(BKBK)))||LONGCROSS(EMAN,MAM,BARSLAST(BKBK)))&&WWW1>G&&C<G||C<WWW1*0.985||TIME>=1457,SP;
  101. (RC-OO)/RC<=0.06&&NA>3&&NOT((DD<20||JJ<10)&&MTR<200)&&(TIME<=1430&&((OO<G||OO>RC&&TC<=G)&&((EXIST(C>=(RC-(RC-OO)/2)*0.9995,NA)||EXIST(AB<=-500,NA))&&MI<=0&&AB<=MI&&AB<=REF(AB,1)&&MA3<REF(MA3,1)&&C<G||(HHV(H,NA)-LLV(L,NA))/LLV(L,NA)>0.022&&MA3<MAM&&MAM<MA2M)||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))),SK;
  102. IFELSE(COUNT(SK1,NA)>=1,C<=LL*1.0039,(NOT(EVERY(EMAN-MAM>-2,BARSLAST(SKSK))||V2=0||OO<LL))&&C<=LL*1.0015||(NOT(EVERY(EMAN>MA2M,BARSLAST(SKSK)))||LONGCROSS(MAM,EMAN,BARSLAST(SKSK)))&&C>G)||TIME>=1457,BP;
复制代码

论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
 
期货论坛 - 版权/免责声明   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

返回列表