海龟交易大智慧公式
-
相关简介:VARIABLE:dayCount=1,PositionCount=1,SellSign=0; VARIABLE:EntAndExitSign=1,EntPoint=0,ExitPoint=0; VARIABLE:True=1,False=0,N=0; TR:=MAX(HIGH,CLOSE[1])-MIN(LOW,CLOSE[1]); IFBARPOS=20THENBEGIN IFBARPOS=20THEN N:=MA(TR,20); IFDayCount=5ORBARPOS=20THENBEG
-
文章来源:股海网作者:股海网发布时间:2013-09-21浏览次数:
VARIABLE:dayCount=1,PositionCount=1,SellSign=0;
VARIABLE:EntAndExitSign=1,EntPoint=0,ExitPoint=0;
VARIABLE:True=1,False=0,N=0;
TR:=MAX(HIGH,CLOSE[1])-MIN(LOW,CLOSE[1]);
IFBARPOS>=20THENBEGIN
IFBARPOS=20THEN
N:=MA(TR,20);
IFDayCount=5ORBARPOS=20THENBEGIN{5天调整N值}
N:=(19*N+TR)/20;{计算N值}
DayCount:=1;
END
DayCount:=DayCount+1;
EntPoint:=ENTERBARS+1;
IFEntPoint=EntAndExitSignTHENBEGIN{说明STOP指令买进头寸成功}
PositionCount:=PositionCount+1;{头寸计数}
SellSign:=True;{开始以STOP卖出,如果达到指定的价格}
END
IFPositionCount=1THENBEGIN{第一头寸}
HOW:=CASH*0.01/N;{波动性百分比决定头寸规模}
BUY(HOW,STOP,HHV(H,20));{在20日新高STOP指令买进}
END
IFPositionCount=2THENBEGIN{如到第二头寸}
HOW:=CASH*0.01/N;{波动性百分比决定头寸规模}
BUY(HOW,STOP,ENTERPRICE+0.5*N);{在上头寸(即第一头寸)+0.5个N以STOP指令买进}
END
IFPositionCount=3THENBEGIN{如到第三头寸}
HOW:=CASH*0.01/N;
BUY(HOW,STOP,ENTERPRICE+0.5*N);{在上头寸(即第二头寸)+0.5个N以STOP指令买进}
END
IFPositionCount=4THENBEGIN
HOW:=CASH*0.01/N;
BUY(HOW,STOP,ENTERPRICE+0.5*N);
END
IFSellSign=TrueTHENBEGIN
ExitPoint:=EXITBARS+1;
IFExitPoint=EntAndExitSignTHENBEGIN{说明卖出成功}
PositionCount:=1;{头寸计算复原}
SellSign:=False;
END
IFENTERPRICE-2*NSELL(100%,STOP,LLV(L,10));{退出离盈利头寸}
ELSE
SELL(100%,STOP,ENTERPRICE-2*N);{退出亏损头寸}
END
END;