INPUT:N(8,1,100,1); //设置参数时;
INPUT:M(21,1,100,1); //设置参数时;;
INPUT:M2(10,1,100,1); //设置参数时;
INPUT:M4(10,1,100,1); //设置参数时;
MA1:MA(C,n);
MA3:MA(C,m);
//建立多头的进场条件
long := time>093000 and time<140000;
if long and cross(ma1,ma3) then
begin
sellshort(holding < 0 , 0, thisclose);
end
if long and cross(ma1,ma3) then
begin
buy(holding = 0 , N, thisclose);
end
//14:00-14:55平空仓
if cross(ma3,ma1) and time>140000 and time<145500 then
begin
sellshort(holding < 0, 0, thisclose);
end
//开空条件
short := time > 093000 and time < 140000;
if short and cross(ma3,ma1) then
begin
sell(holding > 0, 0, thisclose);
end
if short and l < cross(ma3,ma1) then
begin
buyshort(holding = 0 ,N, thisclose);
end
//140000-1455平多仓
if cross(ma3,ma1) and time>=140000 and time<=145500 then
begin
sell(holding > 0, 0, thisclose);
end
//收盘前5分钟平仓
if time > 145400 then
begin
sell(holding > 0, 0, thisclose);
sellshort(holding < 0, 0, thisclose);
end
//赢10点(m2及M4均先设为10)
If holding < 0 then begin
sellshort(Enterprice-l>=M2, 1, limitr, enterprice-M2+mindiff);
end
If holding > 0 then begin
sell(h-Enterprice>=M2, 1, limitr, enterprice+m2-mindiff);
end
//赢20点
If holding < 0 then begin
sellshort(Enterprice-l>=M2+M4, 1, limitr, enterprice-M2-m4+mindiff);
end
If holding > 0 then begin
sell(h-Enterprice>=M2+M4, 1, limitr, enterprice+m2+m4-mindiff);
end
//赢30点
If Enterprice-l>=M2+2*M4 then begin
sellshort(holding < 0, 1, limitr, enterprice-M2-2*m4+mindiff);
end
If h-Enterprice>=M2+2*M4 then begin
sell(holding > 0, 1, limitr, enterprice+m2+2*m4-mindiff);
end
//赢40点
If Enterprice-l>=M2+3*M4 then begin
sellshort(holding < 0, 1, limitr, enterprice-M2-3*m4+mindiff);
end
If h-Enterprice>=M2+3*M4 then begin
sell(holding > 0, 1, limitr, enterprice+m2+3*m4-mindiff);
end
//赢50点
If Enterprice-l>=M2+4*M4 then begin
sellshort(holding < 0, 1, limitr, enterprice-M2-4*m4+mindiff);
end
If h-Enterprice>=M2+4*M4 then begin
sell(holding > 0, 1, limitr, enterprice+m2+4*m4-mindiff);
end
//赢60点
If Enterprice-l>=M2+5*M4 then begin
sellshort(holding < 0, 1, limitr, enterprice-M2-5*m4+mindiff);
end
If h-Enterprice>=M2+5*M4 then begin
sell(holding > 0, 1, limitr, enterprice+m2+5*m4-mindiff);
end
//赢70点
If Enterprice-l>=M2+6*M4 then begin
sellshort(holding < 0, 1, limitr, enterprice-M2-6*m4+mindiff);
end
If h-Enterprice>=M2+6*M4 then begin
sell(holding > 0, 1, limitr, enterprice+m2+6*m4-mindiff);
end
//赢80点
If Enterprice-l>=M2+7*M4 then begin
sellshort(holding < 0, 1, limitr, enterprice-M2-7*m4+mindiff);
end
If h-Enterprice>=M2+7*M4 then begin
sell(holding > 0, 1, limitr, enterprice+m2+7*m4-mindiff);
end
//赢90点
If Enterprice-l>=M2+8*M4 then begin
sellshort(holding < 0, 1, limitr, enterprice-M2-8*m4+mindiff);
end
If h-Enterprice>=M2+8*M4 then begin
sell(holding > 0, 1, limitr, enterprice+m2+8*m4-mindiff);
end
//赢100点
If Enterprice-l>=M2+9*M4 then begin
sellshort(holding < 0, 1, limitr, enterprice-M2-9*m4+mindiff);
end
If h-Enterprice>=M2+9*M4 then begin
sell(holding > 0, 1, limitr, enterprice+m2+9*m4-mindiff);
end
//赢110点
If Enterprice-l>=M2+10*M4 then begin
sellshort(holding < 0, 1, limitr, enterprice-M2-10*m4+mindiff);
end
If h-Enterprice>=M2+10*M4 then begin
sell(holding > 0, 1, limitr, enterprice+m2+10*m4-mindiff);
end