Board logo

标题: [金字塔源码] 金字塔超简单海龟代码,供入门者学习[金字塔源码] [打印本页]

作者: 龙听    时间: 2018-9-30 13:40     标题: 金字塔超简单海龟代码,供入门者学习[金字塔源码]

源码如下:
  1. //超简单海龟代码,供入门者学习,

  2. h10:ref(hhv(h,10),1),colorgreen;//前10根K线高点
  3. l10:ref(llv(l,10),1),colorgreen;//前10根K线低点
  4. h20:ref(hhv(h,20),1),colorred;//前20根K线高点
  5. l20:ref(llv(l,20),1),colorred;//前20根K线低点。

  6. long:=cross(c,h20);//价格上穿前20根线高点,做多条件
  7. longend:=cross(l10,c);//价格跌破前10根K线低点,做多终止条件

  8. short:=cross(l20,c);//价格跌破前20根K线低点,做空条件
  9. shortend:=cross(c,h10);//价格上穿前10根K线高点,做空终止条件
  10. if holding=0 then begin//建仓代码 来源 www.cxh99.com
  11. buy(long,1,thisclose);
  12. buyshort(short,1,thisclose);
  13. end

  14. if holding<>0 then begin//平仓代码
  15. sell(longend,1,thisclose);
  16. sellshort(shortend,1,thisclose);
  17. end
复制代码





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