【金字塔策略源码】双均线穿越

0
回复
5133
查看
[复制链接]

39

主题

6

回帖

214

积分

超级版主

积分
214
来源: 2020-3-8 11:33:27 显示全部楼层 |阅读模式
  1. 1 runmode:0;
  2. 2
  3. 3 input:period1(20,5,100,5);
  4. 4 input:period2(60,5,100,5);
  5. 5
  6. 6 variable:myasset=30000;
  7. 7
  8. 8 entertime:=time>=092500 and time<=145500;
  9. 9 exittime:=time>=150000;
  10. 10
  11. 11 ma1:=ma(close,period1);
  12. 12 ma2:=ma(close,period2);
  13. 13
  14. 14 buycond:=entertime and ref(cross(ma1,ma2),1);
  15. 15 buyprice:=open;
  16. 16
  17. 17 buyshortcond:=entertime and ref(cross(ma2,ma1),1);
  18. 18 buyshortprice:=open;
  19. 19
  20. 20 if holding=0 and buycond then begin
  21. 21     buy(1,1,limitr,buyprice);
  22. 22 end
  23. 23
  24. 24 if holding=0 and buyshortcond then begin
  25. 25     buyshort(1,1,limitr,buyshortprice);
  26. 26 end
  27. 27
  28. 28 if holding>0 and exittime then begin
  29. 29     sell(1,holding,limitr,close);
  30. 30 end
  31. 31
  32. 32 if holding<0 and exittime then begin
  33. 33     sellshort(1,holding,limitr,close);
  34. 34 end
  35. 35
  36. 36 if exittime then
  37. 37     myasset:=asset;
  38. 38     
  39. 39 资产:myasset,noaxis,colormagenta;
  40. 40 次数:totaltrade,linethick0;
  41. 41 收益:(myasset-30000)/30000,linethick0;
  42. 42 胜率:percentwin,linethick0;
  43. 43 出击:totaltrade/(count(date<>ref(date,1),0)+1),linethick0;
  44. 44 连亏:maxseqloss,linethick0;
  45. 45 连赢:maxseqwin,linethick0;
  46. 46
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 免费注册
关注微信