相关标签:
// Dual Thrust
//这个系统是 Michael Chalek 在80 年代开发的 Dual Thrust。
// www.gszb.com
//1. 在今天的收盘,计算两个值: 最高价-收盘价, 和 收盘价-最低价。然后取这两个值较大的那个,乘以k值0.7。把结果称为 触发值。
//
//2. 在明天的开盘,记录开盘价,然后在价格超过(开盘+触发值)时马上买入,或者价格低于(开盘-触发值)时马上卖空。
金字塔公式 金字塔模型策略源码:
input:K1(0.5,0,2,0.1);//多头突破波动比例
input:K2(0.5,0,2,0.1);//多头突破波动比例
input:Mday(1,0,9,1);//M日期最大价差
input:Nday(1,0,9,1);//N日前最大价差
input:LOTS(1,0,9,1);
HighD:=callstock(stklabel,vthigh,6,-1);
LowD:=callstock(stklabel,vtlow,6,-1);
CloseD:=callstock(stklabel,vtclose,6,-1);
CYC:=barslast(date<>ref(date,1))+1;
OpenD:=valuewhen(cyc=1,open);
HH:= HHV(HighD,Mday);
HC:= HHV(CloseD,Mday);
LL:= LLV(LowD,Mday);
LC:= LLV(CloseD,Mday);
SellRange:=Max(HH - LC,HC - LL);
// www.gszb.com
HH:=HHV(HighD,Nday);
HC:=HHV(CloseD,Nday);
LL:=LLV(LowD,Nday);
LC:=LLV(CloseD,Nday);
BuyRange:=Max(HH - LC,HC - LL);
UpperBand: OpenD + K1*BuyRange;
LowerBand: OpenD - K2*SellRange;
If (HOLDING=0) THEN BEGIN
If (High>=UpperBand) THEN
Buy(HOLDING=0,lots,LIMITR,Max(Open,UpperBand));
If (Low<=LowerBand) THEN
BuyShort(HOLDING=0,lots,LIMITR,Min(Open,LowerBand));
END
If (HOLDING<0) THEN BEGIN
If (High>=UpperBand) THEN BEGIN
SELLSHORT(HOLDING<0,lots,LIMITR,Max(Open,UpperBand));
Buy(HOLDING=0,lots,LIMITR,Max(Open,UpperBand));
END
END
If (HOLDING>0) THEN BEGIN
If (Low<=LowerBand) THEN BEGIN
Sell(holding>0,lots,limitr,Min(Open,LowerBand));
BuyShort(holding=0,lots,limitr,Min(Open,LowerBand));
END
END
持仓:holding,noaxis ,linethick0 ;
盈亏:asset-1000000,noaxis,coloryellow,linethick2;