Board logo

标题: [TS源码] 我们的 "涡轮增压罗素日间交易系统 "需要调整吗?【原文+程式码】 [打印本页]

作者: 龙听    时间: 2023-12-8 13:45     标题: 我们的 "涡轮增压罗素日间交易系统 "需要调整吗?【原文+程式码】

本帖隐藏的内容需要回复才可以浏览

作者: 我爱期货    时间: 2023-12-11 09:49

11
作者: 明铭明铭    时间: 2023-12-15 23:44

学习!
作者: 龙听    时间: 2024-1-5 11:46

  1. inputs: atrLen(10),stopAmtPoints(10.00),offSetAmt(.2),profitObj1(5),endTradeTime(1530);

  2. vars: atrAmt(0),smallRange(false),canBuy(true),canSell(true),stb(0),sts(0),tkpS(0),tkpL(0),yesTrueRange(0); vars: buysToday(0),sellsToday(0),j(0),longLossPt(0),shortLossPt(0);

  3. {Plot on 5 minute day session - programmed by George Pruitt}
  4. {I used the OpenD(),HighD(),LowD(),CloseD() functions to get the prior day’s highs and lows and closes }

  5. value1 = 0;

  6. for j = 1 to atrLen begin
  7. value1 = value1 + maxList(closeD(j+1),highD(j)) - minList(closeD(j+1),lowD(j));
  8. end;

  9. atrAmt = value1/atrLen;

  10. yesTrueRange = maxList(closeD(2),highD(1)) - minList(closeD(2),lowD(1));
  11. smallRange = yesTrueRange < atrAmt;

  12. if(date<>date[1]) then // first bar of the day begin
  13. canBuy = false;
  14. canSell = false;
  15. buysToday = 0;
  16. sellsToday = 0;
  17. end;

  18. if marketPosition = 1 then buysToday = 1; // if we already bot then no more buys
  19. if marketPosition =-1 then sellsToday = 1;

  20. stb = openD(0) + offSetAmt * atrAmt;
  21. sts = openD(0) - offSetAmt * atrAmt;

  22. if(closeD(1)>=closeD(2) and smallRange) then canBuy = true;
  23. if(closeD(1)<closeD(2) and smallRange) then canSell = true;

  24. if(canBuy and buysToday = 0 and time < endTradeTime) then buy(“SFOBuy”) 2 contracts next bar stb stop;
  25. if(canSell and sellsToday = 0 and time < endTradeTime ) then sellShort(“SFOSell”) 2 contracts next bar sts stop;

  26. if currentContracts = 2 and marketPosition = 1 and highD(0) > entryPrice + profitObj1 then sell(“LongProf1”) 1 contract next bar at highD(0) - 5 stop;
  27. if currentContracts = 2 and marketPosition =-1 and lowD(0) < entryPrice - profitObj1 then buyToCover(“ShrtProf1”) 1 contract next bar at lowD(0) + 5 stop;

  28. if currentContracts = 1 then sell(“L-BreakEven”) next bar at entryPrice stop;
  29. if currentContracts = 1 then buyToCover(“S-BreakEven”) next bar at entryPrice stop;

  30. if marketPosition = 1 then sell(“MM-L-Out”) next bar at entryPrice - stopAmtPoints stop;
  31. if marketPosition =-1 then buyToCover(“MM-S-Out”) next bar at entryPrice + stopAmtPoints stop; setExitOnClose;
复制代码





欢迎光临 龙听期货论坛 (http://www.qhlt.cn/) Powered by Discuz! 7.2