著名的海龜交易法則-easylanguge編寫(2010-07-23 10:43:52)海龜交易法則細(xì)則 一、市場(chǎng)----買賣什么 •中國金融交易所-滬深300期指 •上海交易所-銅、橡膠、螺紋鋼 •大連交易所-豆油、塑料 二、市場(chǎng)規(guī)模----買賣多少 •N表示某個(gè)特定市場(chǎng)根本的波動(dòng)率 •N=(19×PDN+TR)/20 TR=max(H-L,H-PDC,PDC-L) H-當(dāng)日最高價(jià) L-當(dāng)日最低價(jià) PDC-前個(gè)交易日的收盤價(jià) •單位=帳戶的1%/市場(chǎng)價(jià)值量波動(dòng)率或單位=帳戶的1%/(N×每點(diǎn)價(jià)值量) 三、進(jìn)場(chǎng)----何時(shí)買 •系統(tǒng)1 突破20日高點(diǎn)買進(jìn) 跌破20日低點(diǎn)賣出 •系統(tǒng)2 突破55日高點(diǎn)買進(jìn) 跌破55日低點(diǎn)賣出 資金配置:系統(tǒng)1 (50%),系統(tǒng)2(50%) 四、停損----何時(shí)退出虧損的部位 •停損1-2N停損法 買進(jìn)部位以最后成交價(jià)-2n為停損點(diǎn) 賣出部位以最后成交價(jià)+2n為停損點(diǎn) •停損2-1/2N停損法 買進(jìn)部位以最后成交價(jià)-1/2n為停損點(diǎn) 賣出部位以最后成交價(jià)+1/2n為停損點(diǎn) 五、出場(chǎng)----何時(shí)退出獲利的部位 •系統(tǒng)一出場(chǎng)對(duì)于多頭部位為10日最低價(jià),對(duì)于空頭部位為10日最高價(jià)。如果價(jià)格波動(dòng)與部位背離至10日突破,部位中的所有單位都會(huì)退出。系統(tǒng)二出場(chǎng)對(duì)于多頭部位為20日最低價(jià),對(duì)于空頭部位為20日最高價(jià)。如果價(jià)格波動(dòng)與部位背離至20日突破,部位中的所有單位都會(huì)退出。 /// Turtle 20-Day Breakout Replica ////////////////////////////////////// if marketposition = 0 then begin BB = 0; N = xAverage( TrueRange, Length ); DV = N * BigPointValue; AccountBalance = InitialBalance; DollarRisk = AccountBalance * .01; LTT = IntPortion(DollarRisk/DV); StopLoss = 2 * DV * LTT; if LastTrade = -1 then begin buy LTT shares next bar highest(h,20) or higher; buy LTT shares next bar highest(h,20) + (0.5*N) or higher; buy LTT shares next bar highest(h,20) + (1.0*N) or higher; buy LTT shares next bar highest(h,20) + (1.5*N) or higher; sellshort LTT shares next bar lowest(l,20) or lower; sellshort LTT shares next bar lowest(l,20) - (0.5*N) or lower; sellshort LTT shares next bar lowest(l,20) - (1.0*N) or lower; sellshort LTT shares next bar lowest(l,20) - (1.5*N) or lower; end; if LastTrade = 1 then begin buy LTT shares next bar highest(h,55) or higher; buy LTT shares next bar highest(h,55) + (0.5*N) or higher; buy LTT shares next bar highest(h,55) + (1.0*N) or higher; buy LTT shares next bar highest(h,55) + (1.5*N) or higher; sellshort LTT shares next bar lowest(l,55) or lower; sellshort LTT shares next bar lowest(l,55) - (0.5*N) or lower; sellshort LTT shares next bar lowest(l,55) - (1.0*N) or lower; sellshort LTT shares next bar lowest(l,55) - (1.5*N) or lower; end; end; // PREVIOUS TRADE TRACKER if HBP = 0 and h > highest(h,19)[1] then begin Tracker = 1; HBP = h; LBP = 0; end; if LBP = 0 and l < lowest(l,19)[1] then begin Tracker = -1; LBP = l; HBP = 0; end; if Tracker = 1 then begin if l < HBP - (2*N) then LastTrade = -1; if h > HBP + (4*N) then LastTrade = 1; end; if Tracker = -1 then begin if h > LBP + (2*N) then LastTrade = -1; if l < LBP - (4*N) then LastTrade = 1; end; // LONG 20 if LastTrade = -1 and marketposition = 1 then begin BB = BB + 1; if currentshares = LTT then begin buy LTT shares next bar highest(h,20)[BB] + (0.5*N) or higher; buy LTT shares next bar highest(h,20)[BB] + (1.0*N) or higher; buy LTT shares next bar highest(h,20)[BB]+ (1.5*N) or higher; end; if currentshares = LTT * 2 then begin buy LTT shares next bar highest(h,20)[BB] + (1.0*N) or higher; buy LTT shares next bar highest(h,20)[BB] + (1.5*N) or higher; end; if currentshares = LTT * 3 then buy LTT shares next bar highest(h,20)[BB] + (1.5*N) or higher; end; // LONG 55 if LastTrade = 1 and marketposition = 1 then begin BB = BB + 1; if currentshares = LTT then begin buy LTT shares next bar highest(h,55)[BB] + (0.5*N) or higher; buy LTT shares next bar highest(h,55)[BB] + (1.0*N) or higher; buy LTT shares next bar highest(h,55)[BB]+ (1.5*N) or higher; end; if currentshares = LTT * 2 then begin buy LTT shares next bar highest(h,55)[BB] + (1.0*N) or higher; buy LTT shares next bar highest(h,55)[BB] + (1.5*N) or higher; end; if currentshares = LTT * 3 then buy LTT shares next bar highest(h,55)[BB] + (1.5*N) or higher; end; sell ("out-S") next bar lowest(l,10) or lower; // SHORT 20 if LastTrade = -1 and marketposition = -1 then begin BB = BB + 1; if currentshares = LTT then begin sellshort LTT shares next bar lowest(l,20)[BB] - (0.5*N) or lower; sellshort LTT shares next bar lowest(l,20)[BB] - (1.0*N) or lower; sellshort LTT shares next bar lowest(l,20)[BB] - (1.5*N) or lower; end; if currentshares = LTT * 2 then begin sellshort LTT shares next bar lowest(l,20)[BB] - (1.0*N) or lower; sellshort LTT shares next bar lowest(l,20)[BB] - (1.5*N) or lower; end; if currentshares = LTT * 3 then sellshort LTT shares next bar lowest(l,20)[BB] - (1.5*N) or lower; end; // SHORT 55 if LastTrade = 1 and marketposition = -1 then begin BB = BB + 1; if currentshares = LTT then begin sellshort LTT shares next bar lowest(l,55)[BB] - (0.5*N) or lower; sellshort LTT shares next bar lowest(l,55)[BB] - (1.0*N) or lower; sellshort LTT shares next bar lowest(l,55)[BB] - (1.5*N) or lower; end; if currentshares = LTT * 2 then begin sellshort LTT shares next bar lowest(l,55)[BB] - (1.0*N) or lower; sellshort LTT shares next bar lowest(l,55)[BB] - (1.5*N) or lower; end; if currentshares = LTT * 3 then sellshort LTT shares next bar lowest(l,55)[BB] - (1.5*N) or lower; end; buytocover ("out-B") next bar highest(h,10) or higher; // STOPS if currentshares = (2 * LTT) then StopLoss = DV * 3.5 * LTT; if currentshares = (3 * LTT) then StopLoss = DV * 4.5 * LTT; if currentshares = (4 * LTT) then StopLoss = DV * 5.0 * LTT; setstoploss (StopLoss); // COMMENTARY commentary ("LTT: ",LTT,Newline); commentary ("CurrentShares: ",CurrentShares,Newline); commentary ("StopLoss: ",StopLoss,Newline); commentary ("AccountBalance:",AccountBalance,NewLine); commentary ("LastTrade: ",LastTrade,NewLine); |
|