相關標簽:阿里云紅包購物專區,阿里云紅包專區,突破交易策略,惠比特交易和配種專區,夢三國交易專區,夢三國交易專區速秒,靈緹格力交易專區,中京交易市場下載專區,古幣銀元交易專區,
模型策略源碼:runmode:0; variable:longtrade=0; variable:shorttrade=0; variable:stopline=0; predayhigh:=callstock(stklabel,vthigh,6,-1); predaylow:=callstock(stklabel,vtlow,6,-1); predayrange:=(predayhigh-predaylow)*0.5; predayrange:=round(predayrange/mindiff)*mindiff; dayopen:=callstock(stklabel,vtopen,6,0); trailingstop:=predayrange; dist:=barslast(date>ref(date,1))+1; myentrytime:=time<=145500; myexittime:=time>=150000; upperband:=ref(hhv(high,dist),1); lowerband:=ref(llv(low,dist),1); hh:=ref(high,1); ll:=ref(low,1); if holding=0 then begin if myentrytime and dayopenpredaylow then begin if high>=predayhigh and longtrade=0 then begin buy(1,1,limitr,max(open,predayhigh)); longtrade:=1; end if low<=predaylow and shorttrade=0 then begin buyshort(1,1,limitr,min(open,predaylow)); shorttrade:=1; end end if myentrytime and dayopen>=predayhigh then begin if dist>=4 and high>=upperband and longtrade=0 then begin buy(1,1,limitr,max(open,upperband)); longtrade:=1; end end if myentrytime and dayopen<=predaylow then begin if dist>=4 and low<=lowerband and shorttrade=0 then begin buyshort(1,1,limitr,min(open,lowerband)); shorttrade:=1; end end end if holding>0 and enterbars>=1 then begin myexitprice:=0; if stopline=0 then stopline:=enterprice-trailingstop; if hh-trailingstop>stopline then stopline:=hh-trailingstop; if low<=stopline then myexitprice:=min(open,stopline); if myexittime then myexitprice:=close; if myexitprice>0 then begin sell(1,holding,limitr,myexitprice); stopline:=0; end end if holding<0 and enterbars>=1 then begin myexitprice:=0; if stopline=0 then stopline:=enterprice+1000; if ll+trailingstop stopline:=ll+trailingstop; if high>=stopline then myexitprice:=max(open,stopline); if myexittime then myexitprice:=close; if myexitprice>0 then begin sellshort(1,holding,limitr,myexitprice); stopline:=0; end end if myexittime then begin longtrade:=0; shorttrade:=0; end 盈虧:asset-500000,noaxis,coloryellow,linethick2; 點擊復制上述代碼粘貼到到公式管理器
{別忘了將本網告訴您身邊的朋友,向朋友傳達有用資料,也是一種人情,你朋友會感謝你的。}