【金字塔策略源码】三均线指路

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

39

主题

6

回帖

214

积分

超级版主

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


回复

使用道具 举报

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