[PEL] 复制代码 variable:num:=0;
ma5:=ma(close, 5);
ma20:=ma(close, 20);
cond1:=ma5>ma20;
cond2:=ma5<ma20;
if cond2 and holding>0 then
begin
sell(1,1,market); //平多
num:=0;
end
if cond2 and holding=0 and num<=0 then
begin
buyshort(1,1,market); //开空
end
if cond1 and holding<0 then
begin
sellshort (1,1,market);//平空
num:=0;
end
if cond1 and holding=0 and num>=0 then //开多
begin
buy(1,1,market);
end
//-------------------- 百分之止赢 ------------------图表玻璃5分钟周期
if openprofitper>=1.70 and holding>0 then
begin
多止盈:sell(1,holding,market);
num:=-1;
end
//------------------- 多单止损 ------------------------------------------------
if openprofitper<-0.50 and holding>0 then
begin
多止损:sell(1,holding,market),FONTSZUP2;
num:=0;
end
if openprofitper>=1.70 and holding<0 then//0.7大概30个点
begin
空止盈:sellshort(1,holding,market) ,FONTSZUP2;
num:=1;
end
//------------------ 空单止损 --------------------------------------------------
if openprofitper<-0.50 and holding<0 then//0.7大概30个点
begin
空止损:sellshort(1,holding,market);
num:=0;
end
其他平仓也加入全局变量的重置;开平顺序调整下。 |