请教有没有符合原版海龟的MC代码?官网下载的有点问题 [MC]
-
MC用户求助:
input: InitialBalance(1000000);
vars: N(0),StopLoss(1),DV(0),BB(0),AccountBalance(0),DollarRisk(0),LTT(0),LastTrade(0);
{/// Turtle 20-Day Breakout Replica //////////////////////////////////////}
if marketposition = 0 then begin
BB = 0;
N = AvgTrueRange(20);
DV = N*BigPointValue;
{AccountBalance = InitialBalance;}
AccountBalance = InitialBalance + netprofit;
DollarRisk = AccountBalance * .01;
LTT = IntPortion(DollarRisk/DV);
StopLoss = 2 * DV * LTT;
//Entry Contracts
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;
{// LONG 20 }
if marketposition = 1 then begin
BB = BB + 1;
if currentcontracts = 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 currentcontracts = 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 currentcontracts = LTT * 3 then
buy LTT shares next bar highest(h,20)[BB] + (1.5*N) or higher;
end;
Sell ("out-S") next bar lowest(l,10) or lower;
if marketposition = -1 then begin
BB = BB + 1;
if currentcontracts = 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 currentcontracts = 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 currentcontracts = LTT * 3 then
SellShort LTT shares next bar lowest(l,20)[BB] - (1.5*N) or lower;
end;
buytocover ("out-B") next bar highest(h,10) or higher;
{// STOPS}
if currentcontracts = (2 * LTT) then StopLoss = DV * 3.5 * LTT;
if currentcontracts = (3 * LTT) then StopLoss = DV * 4.5 * LTT;
if currentcontracts = (4 * LTT) then StopLoss = DV * 5.0 * LTT;
setstoploss (StopLoss);
-
MC回复讨论一:
input: InitialBalance(1000000);
vars: N(0),StopLoss(1),DV(0),BB(0),AccountBalance(0),DollarRisk(0),LTT(0),LastTrade(0);
{/// Turtle 20-Day Breakout Replica //////////////////////////////////////}
if marketposition = 0 then begin
BB = 0;
N = AvgTrueRange(20);
DV = N*BigPointValue;
{AccountBalance = InitialBalance;}
AccountBalance = InitialBalance + netprofit;
DollarRisk = AccountBalance * .01;
LTT = IntPortion(DollarRisk/DV);
StopLoss = 2 * DV * LTT;
//Entry Contracts
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;
{// LONG 20 }
if marketposition = 1 then begin
BB = BB + 1;
if currentcontracts = 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 currentcontracts = 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 currentcontracts = LTT * 3 then
buy LTT shares next bar highest(h,20)[BB] + (1.5*N) or higher;
end;
Sell ("out-S") next bar lowest(l,10) or lower;
if marketposition = -1 then begin
BB = BB + 1;
if currentcontracts = 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 currentcontracts = 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 currentcontracts = LTT * 3 then
SellShort LTT shares next bar lowest(l,20)[BB] - (1.5*N) or lower;
end;
buytocover ("out-B") next bar highest(h,10) or higher;
{// STOPS}
if currentcontracts = (2 * LTT) then StopLoss = DV * 3.5 * LTT;
if currentcontracts = (3 * LTT) then StopLoss = DV * 4.5 * LTT;
if currentcontracts = (4 * LTT) then StopLoss = DV * 5.0 * LTT;
setstoploss (StopLoss);
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容