美国骗局在线:海龟交易系统和程式码(2) - 交易逻辑及策略探讨 - 策略交易高峰会 EasyLangu...

来源:百度文库 编辑:中财网 时间:2024/05/09 04:07:48

海龟交易系统和程式码(2)

楼主 发表于 2010-6-17 14:04 | 只看该作者 | 倒序看帖 | 打印 程式码.显示20日突破系统,另还有55日突破系统程式码,有兴趣者私下交流讨论

  1. input: InitialBalance(500000);

  2. vars: N(0), StopLoss(1), DV(0), BB(0), AccountBalance(0), DollarRisk(0), LTT(0), Tracker(0), LastTrade(0), HBP(0),

  3. LBP(0);

  4. if marketposition = 0 then begin BB = 0;

  5. N = AvgTrueRange(20); DV= N*BigPointValue; AccountBalance =InitialBalance;

  6. DV = N * BigPointValue; AccountBalance =InitialBalance + netprofit;

  7. DollarRisk =AccountBalance * .01; LTT =IntPortion(DollarRisk/DV);

  8. StopLoss = 2 * DV * LTT;

  9. if LastTrade = -1 then begin

  10. buy LTT shares next barhighest(h,20) or higher;

  11. buy LTT shares next barhighest(h,20) + (0.5*N) or higher;

  12. buy LTT shares next barhighest(h,20) + (1.0*N) or higher;

  13. buy LTT shares next barhighest(h,20) + (1.5*N) or higher;

  14. sellshort LTT shares nextbar lowest(l,20) or lower;

  15. sellshort LTT shares nextbar lowest(l,20) - (0.5*N) or lower;

  16. sellshort LTT shares nextbar lowest(l,20) - (1.0*N) or lower;

  17. sellshort LTT shares nextbar lowest(l,20) - (1.5*N) or lower;

  18. end;

  19. // LONG 20

  20. if LastTrade = -1 and marketposition =1 then begin

  21. BB = BB + 1;

  22. if currentshares = LTT then begin

  23. buy LTT shares next barhighest(h,20)[BB] + (0.5*N) or higher;

  24. buy LTT shares next barhighest(h,20)[BB] + (1.0*N) or higher;

  25. buy LTT shares next barhighest(h,20)[BB]+ (1.5*N) or higher;

  26. end;

  27. if currentshares = LTT * 2 then begin

  28. buy LTT shares next barhighest(h,20)[BB] + (1.0*N) or higher;

  29. buy LTT shares next barhighest(h,20)[BB] + (1.5*N) or higher;

  30. end;

  31. if currentshares = LTT * 3 then

  32. buy LTT shares next barhighest(h,20)[BB] + (1.5*N) or higher;

  33. end;

  34. sell ("out-S") next barlowest(l,10) or lower;




  35. // SHORT 20

  36. if LastTrade = -1 and marketposition =-1 then begin

  37. BB = BB + 1; if currentshares = LTTthen begin

  38. sellshort LTTshares next bar lowest(l,20)[BB] - (0.5*N) or lower;

  39. sellshort LTTshares next bar lowest(l,20)[BB] - (1.0*N) or lower;

  40. sellshort LTTshares next bar lowest(l,20)[BB] - (1.5*N) or lower;

  41. end;

  42. if currentshares = LTT * 2 then begin

  43. sellshort LTT shares nextbar lowest(l,20)[BB] - (1.0*N) or lower;

  44. sellshort LTT shares nextbar lowest(l,20)[BB] - (1.5*N) or lower;

  45. end;

  46. if currentshares = LTT * 3 then

  47. sellshort LTT shares nextbar lowest(l,20)[BB] - (1.5*N) or lower;

  48. end;
复制代码 延伸阅读

海龟交易系统和程式码(1)

海龟交易系统和程式码(2)

沪深300的简易海龟突破系统

类海龟系统调整的心得分享