input: InitialBalance(500000);
vars: N(0), StopLoss(1), DV(0), BB(0), AccountBalance(0), DollarRisk(0), LTT(0), Tracker(0), LastTrade(0), HBP(0),
LBP(0);
if marketposition = 0 then begin BB = 0;
N = AvgTrueRange(20); DV= N*BigPointValue; AccountBalance =InitialBalance;
DV = N * BigPointValue; AccountBalance =InitialBalance + netprofit;
DollarRisk =AccountBalance * .01; LTT =IntPortion(DollarRisk/DV);
StopLoss = 2 * DV * LTT;
if LastTrade = -1 then begin
buy LTT shares next barhighest(h,20) or higher;
buy LTT shares next barhighest(h,20) + (0.5*N) or higher;
buy LTT shares next barhighest(h,20) + (1.0*N) or higher;
buy LTT shares next barhighest(h,20) + (1.5*N) or higher;
sellshort LTT shares nextbar lowest(l,20) or lower;
sellshort LTT shares nextbar lowest(l,20) - (0.5*N) or lower;
sellshort LTT shares nextbar lowest(l,20) - (1.0*N) or lower;
sellshort LTT shares nextbar lowest(l,20) - (1.5*N) or lower;
end;
// LONG 20
if LastTrade = -1 and marketposition =1 then begin
BB = BB + 1;
if currentshares = LTT then begin
buy LTT shares next barhighest(h,20)[BB] + (0.5*N) or higher;
buy LTT shares next barhighest(h,20)[BB] + (1.0*N) or higher;
buy LTT shares next barhighest(h,20)[BB]+ (1.5*N) or higher;
end;
if currentshares = LTT * 2 then begin
buy LTT shares next barhighest(h,20)[BB] + (1.0*N) or higher;
buy LTT shares next barhighest(h,20)[BB] + (1.5*N) or higher;
end;
if currentshares = LTT * 3 then
buy LTT shares next barhighest(h,20)[BB] + (1.5*N) or higher;
end;
sell ("out-S") next barlowest(l,10) or lower;
// SHORT 20
if LastTrade = -1 and marketposition =-1 then begin
BB = BB + 1; if currentshares = LTTthen begin
sellshort LTTshares next bar lowest(l,20)[BB] - (0.5*N) or lower;
sellshort LTTshares next bar lowest(l,20)[BB] - (1.0*N) or lower;
sellshort LTTshares next bar lowest(l,20)[BB] - (1.5*N) or lower;
end;
if currentshares = LTT * 2 then begin
sellshort LTT shares nextbar lowest(l,20)[BB] - (1.0*N) or lower;
sellshort LTT shares nextbar lowest(l,20)[BB] - (1.5*N) or lower;
end;
if currentshares = LTT * 3 then
sellshort LTT shares nextbar lowest(l,20)[BB] - (1.5*N) or lower;
end;
如果觉得《海龟交易系统和程式码(2) - 交易逻辑及策略探讨 - 策略交易高峰会 EasyLangu...》对你有帮助,请点赞、收藏,并留下你的观点哦!