Board logo

标题: [金字塔源码] 金字塔趋势跟踪指标源码[金字塔模型] [打印本页]

作者: 龙听    时间: 2020-5-5 07:54     标题: 金字塔趋势跟踪指标源码[金字塔模型]

  1. runmode:0;



  2. input:length(20,5,60,5);

  3. input:ratio(4,1,5,1);



  4. variable:trend=0;

  5. variable:stopprice=0;



  6. prebarhigh:=ref(high,1);

  7. prebarlow:=ref(low,1);



  8. atr:=trimprice(ref(ema(high-low,length),1));

  9. trailingstop:=ratio*atr;



  10. if barpos>length and trend=0 then begin

  11. trend:=1;

  12. stopprice:=prebarlow-trailingstop;

  13. drawicon(1,prebarlow-trailingstop,8,0);

  14. drawtext(1,prebarlow-trailingstop,\'开多\',colorred,1);

  15. end



  16. if trend=1 then begin

  17. if prebarlow-trailingstop>stopprice then

  18. stopprice:=prebarlow-trailingstop;

  19.   

  20. if low<=stopprice then begin

  21.   trend:=-1;

  22. stopprice:=prebarhigh+trailingstop;

  23. drawicon(1,prebarhigh+trailingstop,9,0);

  24. drawtext(1,prebarhigh+trailingstop,\'开空\',colorgreen,1);  

  25. end



  26. stickline(close>=open,high,close,1,1,colorred);

  27. stickline(close>=open,close,open,10,1,colorred);

  28. stickline(close>=open,open,low,1,1,colorred);

  29. stickline(close

  30. stickline(close

  31. stickline(close

  32. end



  33. if trend=-1 then begin

  34. if prebarhigh+trailingstop

  35. stopprice:=prebarhigh+trailingstop;

  36.   

  37. if high>=stopprice then begin

  38.   trend:=1;  

  39. stopprice:=prebarlow-trailingstop;

  40. drawicon(1,prebarlow-trailingstop,8,0);

  41. drawtext(1,prebarlow-trailingstop,\'开多\',colorred,1);  

  42. end



  43. stickline(close>=open,high,close,1,1,colorgreen);

  44. stickline(close>=open,close,open,10,1,colorgreen);

  45. stickline(close>=open,open,low,1,1,colorgreen);

  46. stickline(close

  47. stickline(close

  48. stickline(close

  49. end



  50. drawicon(trend=1,stopprice,10);

  51. drawicon(trend=-1,stopprice,11);
复制代码





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