分享和风版海龟源码
以下内容为程序代码: 1 2 input:inb(20,1,500,1),outb(10,1,500,1),risk(2,0,10,0.1); 3 //和风版海龟源码 4 variable:times=0,i=0,n=0; 5 rn:=ema(ref(tr,1),20); 6 n:=valuewhen(holding=0,rn); 7 rh:=ref(h,1); 8 rl:=ref(l,1); 9 h1:hhv(rh,inb); 10 h2:hhv(rh,outb),linedot; 11 l1:llv(rl,inb); 12 l2:llv(rl,outb),linedot; 13 lotst:asset risk 0.01/(n 2 multiplier),linethick0; 14 lots:=if(risk=0,1,lotst); //如果risk取0,表示固定开1手 15 tbc:=h<>l;//判断是否停板 16 partline(holding>0,enterprice-2 n); 17 if barpos<inb+1 then exit; 18 if holding=0 and tbc then //不是停板才可以交易 19 begin 20 if h>h1 then //开多 21 begin 22 buyp:=max(o,h1); 23 buy(1,lots