海龟交易系统-EasyLanguage版input: InitialBalance(500000),loss(2),win(4);
vars: N(0),
StopLoss(0),
DV(0),canMakeIn(False),avgAtr(0),avgAtrLen(10),
AccountBalance(0),system(0),
DollarRisk(0),AvgEtyPrice(0),
LTT(0),
Tracker(0),
Last...
input: InitialBalance(500000),loss(2),win(4);
vars: N(0),
StopLoss(0),
DV(0),canMakeIn(False),avgAtr(0),avgAtrLen(10),
AccountBalance(0),system(0),
DollarRisk(0),AvgEtyPrice(0),
LTT(0),
Tracker(0),
LastTrade(-1),myprofit(0),
HBP(0),
LBP(0),
Ndays(20);
array:EtyPrice_L1[3](0),EtyPrice_S1[3](0),EtyPrice_L2[3](0),EtyPrice_S2[3](0);
/// Turtle 20-Day Breakout //////////////////////////////////////
if marketposition=0 then
begin
N = ATR(Ndays);
DV = N*BigPointValue;
AccountBalance = InitialBalance + netprofit;
DollarRisk = AccountBalance * 0.01;
LTT = IntPortion(DollarRisk/DV);
StopLoss = 2 * DV * LTT;
HBP=0;LBP=0;
if LastTrade = -1 then begin
buy("b-20-1") LTT shares next bar highest(h,20) or higher;
EtyPrice_L1[0]= highest(h,20);
buy("b-20-2") LTT shares next bar highest(h,20) + (0.5*N) or higher;
EtyPrice_L1[1]= highest(h,20) + (0.5*N);
buy("b-20-3") LTT shares next bar highest(h,20) + (1.0*N) or higher;
EtyPrice_L1[2]= highest(h,20) + (1.0*N);
buy("b-20-4") LTT shares next bar highest(h,20) + (1.5*N) or higher;
EtyPrice_L1[3]= highest(h,20) + (1.5*N);
sellshort("s-20-1") LTT shares next bar lowest(l,20) or lower;
EtyPrice_S1[0]= lowest(l,20);
sellshort("s-20-2") LTT shares next bar lowest(l,20) - (0.5*N) or lower;
EtyPrice_S1[1]= lowest(l,20) - (0.5*N);
sellshort("s-20-3") LTT shares next bar lowest(l,20) - (1.0*N) or lower;
EtyPrice_S1[2]= lowest(l,20) - (1.0*N);
sellshort("s-20-4") LTT shares next bar lowest(l,20) - (1.5*N) or lower;
EtyPrice_S1[3]= lowest(l,20) - (1.5*N);
system=1;
end;
if LastTrade = 1 then begin
buy("b-55-1") LTT shares next bar highest(h,55) or higher;
EtyPrice_L2[0]= highest(h,55);
buy("b-55-2") LTT shares next bar highest(h,55) + (0.5*N) or higher;
EtyPrice_L2[1]= highest(h,55)+ (0.5*N);
buy("b-55-3") LTT shares next bar highest(h,55) + (1.0*N) or higher;
EtyPrice_L2[2]= highest(h,55)+ (1.0*N);
buy("b-55-4") LTT shares next bar highest(h,55) + (1.5*N) or higher;
EtyPrice_L2[3]= highest(h,55)+ (1.5*N);
sellshort("s-55-1") LTT shares next bar lowest(l,55) or lower;
EtyPrice_S2[0]= lowest(l,55);
sellshort("s-55-2") LTT shares next bar lowest(l,55) - (0.5*N) or lower;
EtyPrice_S2[1]= lowest(l,55)- (0.5*N) ;
sellshort("s-55-3") LTT shares next bar lowest(l,55) - (1.0*N) or lower;
EtyPrice_S2[2]= lowest(l,55)- (1.0*N) ;
sellshort("s-55-4") LTT shares next bar lowest(l,55) - (1.5*N) or lower;
EtyPrice_S2[3]= lowest(l,55)- (1.5*N) ;
system=2;
end;
end;
// PREVIOUS TRADE TRACKER
if HBP = 0 and LBP=0 and h > highest(h,19)[1] then begin
Tracker = 1;
HBP = h;
LBP = 0;
end;
if HBP=0 and 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 - (loss*N) then LastTrade = -1;
if h > HBP + (win*N) then LastTrade = 1;
end;
if Tracker = -1 then begin
if h > LBP + (loss*N) then LastTrade = -1;
if l < LBP - (win*N) then LastTrade = 1;
end;
////jia cang system 1
if LastTrade=-1 and marketposition=1 then begin
if currentshares=LTT then begin
buy("b-20-2.") LTT shares next bar EtyPrice_L1[1] or higher;
buy("b-20-3.") LTT shares next bar EtyPrice_L1[2] or higher;
buy("b-20-4.") LTT shares next bar EtyPrice_L1[3] or higher;
end;
if currentshares=2*LTT then begin
buy("b-20-3..") LTT shares next bar EtyPrice_L1[2] or higher;
buy("b-20-4..") LTT shares next bar EtyPrice_L1[3] or higher;
end;
if currentshares=3*LTT then
buy("b-20-4...") LTT shares next bar EtyPrice_L1[3] or higher;
end;
if LastTrade=-1 and marketposition=-1 then begin
if currentshares=LTT then begin
sellshort("s-20-2.") LTT shares next bar EtyPrice_S1[1] stop;
sellshort("s-20-3.") LTT shares next bar EtyPrice_S1[2] stop;
sellshort("s-20-4.") LTT shares next bar EtyPrice_S1[3] stop;
end;
if currentshares=2*LTT then begin
sellshort("s-20-3..") LTT shares next bar EtyPrice_S1[2] stop;
sellshort("s-20-4..") LTT shares next bar EtyPrice_S1[3] stop;
end;
if currentshares=3*LTT then
sellshort("s-20-4...") LTT shares next bar EtyPrice_S1[3] stop;
end;
////jia cang system 2
if LastTrade=1 and marketposition=1 then begin
if currentshares=LTT then begin
buy("b-55-2.") LTT shares next bar EtyPrice_L2[1] stop;
buy("b-55-3.") LTT shares next bar EtyPrice_L2[2] stop;
buy("b-55-4.") LTT shares next bar EtyPrice_L2[3] stop;
end;
if currentshares=2*LTT then begin
buy("b-55-3..") LTT shares next bar EtyPrice_L2[2] stop;
buy("b-55-4..") LTT shares next bar EtyPrice_L2[3] stop;
end;
if currentshares=3*LTT then
buy("b-55-4...") LTT shares next bar EtyPrice_L2[3] stop;
end;
if LastTrade=1 and marketposition=-1 then begin
if currentshares=LTT then begin
sellshort("s-55-2.") LTT shares next bar EtyPrice_S2[1] stop;
sellshort("s-55-3.") LTT shares next bar EtyPrice_S2[2] stop;
sellshort("s-55-4.") LTT shares next bar EtyPrice_S2[3] stop;
end;
if currentshares=2*LTT then begin
sellshort("s-55-3..") LTT shares next bar EtyPrice_S2[2] stop;
sellshort("s-55-4..") LTT shares next bar EtyPrice_S2[3] stop;
end;
if currentshares=3*LTT then
sellshort("s-55-4...") LTT shares next bar EtyPrice_S2[3] stop;
end;
// STOPS
if currentshares = LTT then StopLoss = 2.0* DV * LTT ;
if currentshares = (2 * LTT) then StopLoss = 3.5* DV * LTT ;
if currentshares = (3 * LTT) then StopLoss = 4.5* DV * LTT ;
if currentshares = (4 * LTT) then StopLoss = 5.0* DV * LTT ;
setstoploss (stoploss);
print(date,"LTT:",LTT,"shares:",currentshares,"stop:",StopLoss,"DV:",DV);
//out system
if system=1 then begin
if marketposition=1 then sell("20_L-exit") next bar Lowest(l,10) stop;
if marketposition=-1 then buytocover("20_S-exit") next bar Highest(h,10) stop;
end;
if system=2 then begin
if marketposition=1 then sell("55_L-exit") next bar Lowest(l,20) stop;
if marketposition=-1 then buytocover("55_S-exit")next bar Highest(h,20) stop;
end;
本文档为【海龟交易系统-EasyLanguage版】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。